Fixed problem using a dash character in the Title field. Bug Fix : B2012-292, fix the saving of the Title field when creating a new Word section

Added a check for the existence of a temporary word file before trying to create it
Part two of fix for bug B2012-292, don’t delete word section if user deletes the Title text in the step editor
This commit is contained in:
John Jenko 2012-11-05 18:58:13 +00:00
parent ca98dba877
commit 4ed39bda97
3 changed files with 9 additions and 4 deletions

View File

@ -40,6 +40,7 @@ namespace VEPROMS
this.Text = string.Format("{0} {1} Properties", ii.DisplayNumber, ii.DisplayText);
else
this.Text = string.Format("{0} Properties", ii.DisplayText);
ppSectTitleStpRTB.Font = ppSectTitleStpRTB.FormatFont = new System.Drawing.Font("Microsoft Sans Serif", 10F);
ppSectTitleStpRTB.FieldToEdit = E_FieldToEdit.Text;
ppSectTitleStpRTB.BorderStyle = BorderStyle.Fixed3D;
ppSectTitleStpRTB.MyItemInfo = ii;
@ -96,15 +97,15 @@ namespace VEPROMS
_SectionConfig.MySection.MyContent.DTS = DateTime.Now;
_SectionConfig.MySection.MyContent.UserID = Volian.Base.Library.VlnSettings.UserID;
Section mySection = _SectionConfig.MySection.Save();
FinishSectionSave(mySection);
SaveText(ppSectNumberStpRTB); // save the section number
SaveText(ppSectTitleStpRTB); // save the section title
FinishSectionSave(mySection); // this will also create an empty Word Doc if this is a word section
// if there was a document to delete, do it.
if (_DocumentToDelete != null)
{
Document.Delete(_DocumentToDelete.DocID);
_DocumentToDelete = null;
}
SaveText(ppSectNumberStpRTB);
SaveText(ppSectTitleStpRTB);
mySection.Dispose();
this.DialogResult = DialogResult.OK;
this.Close();

View File

@ -332,6 +332,10 @@ namespace VEPROMS.CSLA.Library
if (_MyDocument != null)
{
_MyFile = new FileInfo(string.Format(@"{0}\tmp_{1}{2}{3}", VlnSettings.TemporaryFolder, MyDocument.DocID, Unique, MyDocument.FileExtension));
while (_MyFile.Exists)
{
_MyFile = new FileInfo(string.Format(@"{0}\tmp_{1}{2}{3}", VlnSettings.TemporaryFolder, MyDocument.DocID, Unique, MyDocument.FileExtension));
}
FileStream fs = _MyFile.Create();
if (MyDocument.DocContent != null) fs.Write(MyDocument.DocContent, 0, MyDocument.DocContent.Length);
fs.Close();

View File

@ -397,7 +397,7 @@ namespace Volian.Controls.Library
if (lastEI != null && lastEI.BeingDisposed == false)
{
bool shouldDelete = !lastEI.BeingRemoved && lastEI.Empty;
bool shouldDelete = !lastEI.BeingRemoved && lastEI.Empty && (lastEI.MyItemInfo.MyContent.ContentEntryCount <= 0);
if (shouldDelete)
{
if (lastEI.HasChildren)