public EmailTemplate GetByID(int _emailTemplateID) { EmailTemplateDAC _emailTemplateComponent = new EmailTemplateDAC(); IDataReader reader = _emailTemplateComponent.GetByIDEmailTemplate(_emailTemplateID); EmailTemplate _emailTemplate = null; while(reader.Read()) { _emailTemplate = new EmailTemplate(); if(reader["EmailTemplateID"] != DBNull.Value) _emailTemplate.EmailTemplateID = Convert.ToInt32(reader["EmailTemplateID"]); if(reader["SystemEmailTypeID"] != DBNull.Value) _emailTemplate.SystemEmailTypeID = Convert.ToInt32(reader["SystemEmailTypeID"]); if(reader["ConferenceID"] != DBNull.Value) _emailTemplate.ConferenceID = Convert.ToInt32(reader["ConferenceID"]); if(reader["LanguageID"] != DBNull.Value) _emailTemplate.LanguageID = Convert.ToInt32(reader["LanguageID"]); if(reader["Name"] != DBNull.Value) _emailTemplate.Name = Convert.ToString(reader["Name"]); if(reader["Description"] != DBNull.Value) _emailTemplate.Description = Convert.ToString(reader["Description"]); if(reader["EmailContent"] != DBNull.Value) _emailTemplate.EmailContent = Convert.ToString(reader["EmailContent"]); _emailTemplate.NewRecord = false; } reader.Close(); return _emailTemplate; }
public List<EmailTemplate> GetAll() { EmailTemplateDAC _emailTemplateComponent = new EmailTemplateDAC(); IDataReader reader = _emailTemplateComponent.GetAllEmailTemplate().CreateDataReader(); List<EmailTemplate> _emailTemplateList = new List<EmailTemplate>(); while(reader.Read()) { if(_emailTemplateList == null) _emailTemplateList = new List<EmailTemplate>(); EmailTemplate _emailTemplate = new EmailTemplate(); if(reader["EmailTemplateID"] != DBNull.Value) _emailTemplate.EmailTemplateID = Convert.ToInt32(reader["EmailTemplateID"]); if(reader["SystemEmailTypeID"] != DBNull.Value) _emailTemplate.SystemEmailTypeID = Convert.ToInt32(reader["SystemEmailTypeID"]); if(reader["ConferenceID"] != DBNull.Value) _emailTemplate.ConferenceID = Convert.ToInt32(reader["ConferenceID"]); if(reader["LanguageID"] != DBNull.Value) _emailTemplate.LanguageID = Convert.ToInt32(reader["LanguageID"]); if(reader["Name"] != DBNull.Value) _emailTemplate.Name = Convert.ToString(reader["Name"]); if(reader["Description"] != DBNull.Value) _emailTemplate.Description = Convert.ToString(reader["Description"]); if(reader["EmailContent"] != DBNull.Value) _emailTemplate.EmailContent = Convert.ToString(reader["EmailContent"]); _emailTemplate.NewRecord = false; _emailTemplateList.Add(_emailTemplate); } reader.Close(); return _emailTemplateList; }
protected void btnSave_Click(object sender, EventArgs e) { template = new EmailTemplate(); template.EmailContent = txtContent.Html; template.Description = txtDesc.Text; template.Name = txtName.Text; template.ConferenceID = Convert.ToInt32(cbConference.Value); template.SystemEmailTypeID = Convert.ToInt32(cbEmailType.Value); template.LanguageID = Convert.ToInt32(cbLang.Value); if (Request.QueryString["ID"] != null) new EmailTemplateLogic().Update(template, Convert.ToInt32(Request.QueryString["ID"])); else new EmailTemplateLogic().Insert(template); Response.Redirect("Manage.aspx"); }
private void FillFOrmControls() { if (Request.QueryString["ID"] != null) { cbConference.DataBind(); cbEmailType.DataBind(); cbLang.DataBind(); template = new EmailTemplateLogic().GetByID(Convert.ToInt32(Request.QueryString["ID"])); txtContent.Html = template.EmailContent; txtDesc.Text = template.Description; txtName.Text = template.Name; cbConference.SelectedIndex = cbConference.Items.FindByValue(template.ConferenceID).Index; cbEmailType.SelectedIndex = cbEmailType.Items.FindByValue(template.SystemEmailTypeID).Index; cbLang.SelectedIndex = cbLang.Items.FindByValue(template.LanguageID).Index; } }
public EmailTemplate GetTemplate(int TemplateTypeID,int ConferenceID,int LanguageID) { EmailTemplateDAC _emailTemplateComponent = new EmailTemplateDAC(); IDataReader reader = _emailTemplateComponent.GetAllEmailTemplate(string.Format("SystemEmailTypeID = {0} and ConferenceID = {1} and LanguageID = {2}",TemplateTypeID,ConferenceID,LanguageID)).CreateDataReader(); EmailTemplate _emailTemplate = null; while (reader.Read()) { _emailTemplate = new EmailTemplate(); if (reader["EmailTemplateID"] != DBNull.Value) _emailTemplate.EmailTemplateID = Convert.ToInt32(reader["EmailTemplateID"]); if (reader["SystemEmailTypeID"] != DBNull.Value) _emailTemplate.SystemEmailTypeID = Convert.ToInt32(reader["SystemEmailTypeID"]); if (reader["ConferenceID"] != DBNull.Value) _emailTemplate.ConferenceID = Convert.ToInt32(reader["ConferenceID"]); if (reader["LanguageID"] != DBNull.Value) _emailTemplate.LanguageID = Convert.ToInt32(reader["LanguageID"]); if (reader["Name"] != DBNull.Value) _emailTemplate.Name = Convert.ToString(reader["Name"]); if (reader["Description"] != DBNull.Value) _emailTemplate.Description = Convert.ToString(reader["Description"]); if (reader["EmailContent"] != DBNull.Value) _emailTemplate.EmailContent = Convert.ToString(reader["EmailContent"]); _emailTemplate.NewRecord = false; } reader.Close(); if(_emailTemplate == null && LanguageID != Convert.ToInt32(Common.DefaultLanguageId)) return GetTemplate(TemplateTypeID, ConferenceID, Convert.ToInt32(Common.DefaultLanguageId)); return _emailTemplate; }
public bool Update(EmailTemplate emailtemplate ,int old_emailTemplateID) { EmailTemplateDAC emailtemplateComponent = new EmailTemplateDAC(); return emailtemplateComponent.UpdateEmailTemplate( emailtemplate.SystemEmailTypeID, emailtemplate.ConferenceID, emailtemplate.LanguageID, emailtemplate.Name, emailtemplate.Description, emailtemplate.EmailContent, old_emailTemplateID); }
public bool Insert(EmailTemplate emailtemplate) { int autonumber = 0; EmailTemplateDAC emailtemplateComponent = new EmailTemplateDAC(); bool endedSuccessfuly = emailtemplateComponent.InsertNewEmailTemplate( ref autonumber, emailtemplate.SystemEmailTypeID, emailtemplate.ConferenceID, emailtemplate.LanguageID, emailtemplate.Name, emailtemplate.Description, emailtemplate.EmailContent); if(endedSuccessfuly) { emailtemplate.EmailTemplateID = autonumber; } return endedSuccessfuly; }