/// <summary> /// Gets the name of the template file. /// </summary> public string GetTemplateFileName() { string fileName = null; view.WithSchema = true; try { if (view.Mode == Modes.Create) { fileName = new MSOIntegrationDAO().GetMSOTemplateFileName(view.DocumentID); } else if (view.Mode == Modes.Edit) { MSOIntegrationDAO msoIntegrationDao = new MSOIntegrationDAO(); fileName = msoIntegrationDao.GetMSOFileName(view.DocumentID); if (string.IsNullOrEmpty(fileName)) { fileName = msoIntegrationDao.GetMSOTemplateFileName(view.DocumentID); } } if (string.IsNullOrEmpty(fileName)) { MSOTemplateDTO msoTemplateDto = new MSOTemplateDAO().GetCurrentMSOTemplate(true); if (msoTemplateDto != null) { fileName = msoTemplateDto.FileName; } view.WithSchema = false; } if (string.IsNullOrEmpty(fileName)) { view.ErrorMessage = "Nie udało się pobrać nazwy pliku template'u."; view.WithSchema = false; return(null); } fileName = Path.Combine(MSOProcessingHelper.MSODirectoryPath, fileName); if (!File.Exists(fileName)) { view.ErrorMessage = "Podany plik nie istnieje: " + fileName; view.WithSchema = false; return(null); } } catch (SqlException se) { view.ErrorMessage = "Wystąpił wyjątek podczas pobierania nazwy pliku template'u: " + se.Message; view.WithSchema = false; } return(fileName); }
protected void Page_Load(object sender, EventArgs e) { dao = new MSOTemplateDAO(); lblMessage.Text = string.Empty; if (!Page.IsPostBack) { LoadWordTemplate(); LoadSecureWordTemplate(); LoadTicketDuration(); LoadTicketLifeTime(); LoadLegalActsSettings(); } }
/// <summary> /// Gets the name of the template file. /// </summary> public string GetTemplateFileName(out string originalFileName) { string fileName = null; originalFileName = string.Empty; try { MSOTemplateDTO msoTemplateDto = new MSOTemplateDAO().GetLAWTemplate(view.DocumentID); if (msoTemplateDto != null) { fileName = msoTemplateDto.FileName; if (!string.IsNullOrEmpty(fileName)) { originalFileName = "Akt prawny" + Path.GetExtension(fileName); fileName = Path.Combine(MSOProcessingHelper.MSODirectoryPath, fileName); } } if (string.IsNullOrEmpty(fileName)) { view.ErrorMessage = "Nie udało się pobrać nazwy pliku template'u."; return(null); } if (!File.Exists(fileName)) { view.ErrorMessage = "Podany plik nie istnieje: " + fileName; return(null); } } catch (SqlException se) { view.ErrorMessage = "Wystąpił wyjątek podczas pobierania nazwy pliku template'u: " + se.Message; } return(fileName); }
/// <summary> /// Gets the name of the template file. /// </summary> public string GetTemplateFileName(out string originalFileName) { string fileName = null; originalFileName = string.Empty; try { if (view.Mode == Modes.Create) { MSOTemplateDTO msoTemplateDto = new MSOTemplateDAO().GetCurrentMSOTemplate(false); if (msoTemplateDto != null) { fileName = msoTemplateDto.FileName; if (!string.IsNullOrEmpty(fileName)) { originalFileName = "Nowy dokument eSody" + Path.GetExtension(fileName); fileName = Path.Combine(MSOProcessingHelper.MSODirectoryPath, fileName); } } } else if (view.Mode == Modes.Edit) { if (string.IsNullOrEmpty(view.ItemGuid)) { view.ErrorMessage = "Nie można odnaleźć elementu z powodu braku jego identyfikatora."; return(null); } DocumentItemDTO documentItemDto = new DocumentDAO().GetItem(new Guid(view.ItemGuid)); if (documentItemDto != null) { fileName = documentItemDto.FSGUID.ToString(); } if (!string.IsNullOrEmpty(fileName)) { fileName = Path.Combine(ConfigurationManager.AppSettings["katalogDokumentow"], fileName); if (!string.IsNullOrEmpty(documentItemDto.OriginalName)) { originalFileName = documentItemDto.OriginalName; } } } if (string.IsNullOrEmpty(fileName)) { view.ErrorMessage = "Nie udało się pobrać nazwy pliku template'u."; return(null); } if (!File.Exists(fileName)) { view.ErrorMessage = "Podany plik nie istnieje: " + fileName; return(null); } } catch (SqlException se) { view.ErrorMessage = "Wystąpił wyjątek podczas pobierania nazwy pliku template'u: " + se.Message; } return(fileName); }