private void Clone() { if (CurrentRow() == null) { MessageBox.Show("No current template on binding source."); return; } appDB.TemplateRow trCurrent = CurrentRow(); appDB.TemplateRow trCopy = (appDB.TemplateRow)AtMng.GetTemplate().Add(null); trCopy.LetterName = trCurrent.LetterName + "COPY"; trCopy.LetterDescEng = "(Copy of) " + trCurrent.LetterDescEng; trCopy.LetterDescFre = "(Copie de) " + trCurrent.LetterDescFre; docDB.DocumentRow docCurrent = AtMng.GetTemplate().GetTemplateDoc(trCurrent); docDB.DocContentRow docContentCurrent = docCurrent.DocContentRow; docDB.DocumentRow docCopy = AtMng.GetTemplate().GetTemplateDoc(trCopy); docDB.DocContentRow docContentCopy = docCopy.DocContentRow; docCopy.CommMode = docCurrent.CommMode; docCopy.efSubject = docCurrent.efSubject; docCopy.efType = docCurrent.efType; docContentCopy.Contents = docContentCurrent.Contents; docContentCopy.Ext = docContentCurrent.Ext; CurrentDocRow = docCopy; templateBindingSource.Position = templateBindingSource.Find("TemplateId", trCopy.TemplateId); }
private void New(string fileExtention) { appDB.TemplateRow tr = (appDB.TemplateRow)AtMng.GetTemplate().Add(null); CurrentDocRow = AtMng.GetTemplate().GetTemplateDoc(tr); switch (fileExtention.ToUpper()) { case "HTML": CurrentDocRow.DocContentRow.Ext = ".html"; break; case "TXT": CurrentDocRow.DocContentRow.Ext = ".txt"; break; default: CurrentDocRow.DocContentRow.Ext = ".rtf"; break; } templateBindingSource.Position = templateBindingSource.Find("TemplateId", tr.TemplateId); }