private void LoadSecureWordTemplate() { try { MSOTemplateDTO wordSecureTemplate = dao.GetMSOTemplate(WordSecureTemplateID, true, null, null); if (wordSecureTemplate != null) { WordSecureTemplateID = wordSecureTemplate.TemplateID; if (!String.IsNullOrEmpty(wordSecureTemplate.OriginalFileName)) { lblWordSecureOriginalFileName.Text = wordSecureTemplate.OriginalFileName; currentWordSecureTemplate.Visible = true; } else { lblWordSecureOriginalFileName.Text = string.Empty; currentWordSecureTemplate.Visible = false; } } } catch (Exception ex) { lblMessage.Text = ex.Message; } }
private void LoadWordTemplate() { try { MSOTemplateDTO wordTemplate = dao.GetMSOTemplate(WordTemplateID); if (wordTemplate != null) { WordTemplateID = wordTemplate.TemplateID; isWordTemplateActive.Checked = wordTemplate.IsActive; lblWordOriginalFileName.Text = wordTemplate.OriginalFileName; hfWordFileName.Value = wordTemplate.FileName; if (!String.IsNullOrEmpty(wordTemplate.OriginalFileName)) { currentWordTemplate.Visible = true; } else { currentWordTemplate.Visible = false; } } } catch (Exception ex) { lblMessage.Text = ex.Message; } }
public MSOTemplateDTO GetMSOTemplate(int?templateID, bool isSecure, string templateType, int?docID) { SqlDatabase db = DatabaseFactory.CreateDatabase() as SqlDatabase; if (db == null) { throw new Exception("Do poprawnego działania wymagany jest SQL Server 2005!"); } MSOTemplateDTO template = null; DbCommand cmd = db.GetStoredProcCommand("Dokumenty.pobierzSzablonMSO", templateID, isSecure, templateType, docID); using (IDataReader dr = db.ExecuteReader(cmd)) { if (dr.Read()) { template = new MSOTemplateDTO( int.Parse(dr["id"].ToString()), dr["filename"].ToString(), dr["originalFileName"].ToString(), bool.Parse(dr["isSecure"].ToString()), bool.Parse(dr["isActive"].ToString()) ); } }; return(template); }