protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { if (!string.IsNullOrEmpty(Request.QueryString["title"])) { BAL_Template = new Template_BLogic(); oTemplate = new Template(); oTemplate.Templatepath = Server.MapPath("~/Template"); oTemplate.Title = Request.QueryString["title"]; ViewState["title"] = Request.QueryString["title"]; if (BAL_Template.BAL_Template_CheckExists(oTemplate)) { DataTable oTable = BAL_Template.BAL_Template_Select(oTemplate); txttitle.Text = Convert.ToString(oTable.Rows[0]["title"]); txttitle.Enabled = false; txtsubject.Text = Convert.ToString(oTable.Rows[0]["subject"]); txtsubject.Enabled = false; txtmail.Content = Convert.ToString(oTable.Rows[0]["body"]); txtmail.ActiveMode = AjaxControlToolkit.HTMLEditor.ActiveModeType.Preview; txtmail.Enabled = false; } } } }
protected void btnsubmitadd_Click(object sender, EventArgs e) { BAL_Template = new Template_BLogic(); oTemplate = new Template(); oTemplate.Templatepath = Server.MapPath("~/Template"); oTemplate.Title = txttitle.Text; oTemplate.Subject = txtsubject.Text; oTemplate.Body = txtmail.Content; if (Convert.ToString(ViewState["Mode"]) == "Add") { oTemplate.CreatedBy = AppSessions.EmpolyeeID; if (!BAL_Template.BAL_Template_CheckExists(oTemplate)) { bool status = BAL_Template.BAL_Template_Insert(oTemplate); if (status) { ScriptManager.RegisterStartupScript(this, GetType(), "alertMessage", "alert('Template has been added successfully.');", true); ResetControl(); } else { ScriptManager.RegisterStartupScript(this, GetType(), "alertMessage", "alert('Template has been added failed.');", true); } } } else { ScriptManager.RegisterStartupScript(this, GetType(), "alertMessage", "alert('Template already exists.');", true); } }
protected void gvtemplate_RowCommand(object sender, GridViewCommandEventArgs e) { BAL_Template = new Template_BLogic(); oTemplate = new Template(); oTemplate.Templatepath = Server.MapPath("~/Template"); oTemplate.Title = Convert.ToString(e.CommandArgument); if (e.CommandName == "templateedit") { Response.Redirect("AddUpdateTemplate.aspx?title=" + Convert.ToString(e.CommandArgument) + ""); } else if (e.CommandName == "templatedelete") { bool status = BAL_Template.BAL_Template_Delete(oTemplate); if (status) { ScriptManager.RegisterStartupScript(this, GetType(), "alertMessage", "alert('Template has been deleted successfully.');", true); BindGrid(); } else { ScriptManager.RegisterStartupScript(this, GetType(), "alertMessage", "alert('Template has been deleted failed.');", true); } } else if (e.CommandName == "templateview") { Response.Redirect("ViewTemplate.aspx?title=" + Convert.ToString(e.CommandArgument) + ""); } }
protected void btnSubmit_Click(object sender, EventArgs e) { BAL_Template = new Template_BLogic(); oTemplate = new Template(); oTemplate.Templatepath = Server.MapPath("~/Template"); oTemplate.Title = txttitle.Text; oTemplate.Subject = txtsubject.Text; oTemplate.Body = txtmail.Content; if (Convert.ToString(ViewState["Mode"]) == "Add") { oTemplate.CreatedBy = AppSessions.EmpolyeeID; if (!BAL_Template.BAL_Template_CheckExists(oTemplate)) { bool status = BAL_Template.BAL_Template_Insert(oTemplate); if (status) { Response.Redirect("ManageTemplate.aspx"); } else { ScriptManager.RegisterStartupScript(this, GetType(), "alertMessage", "alert('Template has been added failed.');", true); } } else { ScriptManager.RegisterStartupScript(this, GetType(), "alertMessage", "alert('Template already exists.');", true); } } else if (Convert.ToString(ViewState["Mode"]) == "Update") { oTemplate.Modifiedby = AppSessions.EmpolyeeID; if (!BAL_Template.BAL_Template_CheckExists(oTemplate) || oTemplate.Title == Convert.ToString(ViewState["title"])) { DeleteOldTemplate(); bool status = BAL_Template.BAL_Template_Update(oTemplate); if (status) { Response.Redirect("ManageTemplate.aspx"); } else { ScriptManager.RegisterStartupScript(this, GetType(), "alertMessage", "alert('Template has been updated failed.');", true); } } else { ScriptManager.RegisterStartupScript(this, GetType(), "alertMessage", "alert('Template already exists.');", true); } } }
private void BindGrid() { BAL_Template = new Template_BLogic(); oTemplate = new Template(); oTemplate.Templatepath = Server.MapPath("~/Template"); gvtemplate.DataSource = BAL_Template.BAL_Template_SelectALL(oTemplate); gvtemplate.DataBind(); }
/// <summary> /// Get Mail Subject and Body for selected template. /// </summary> /// <param name="TemplateName">Template title</param> /// <param name="MailSubject"></param> /// <param name="MailBody"></param> private void GetMailSubjectAndBody(string TemplateName, out string MailSubject, out string MailBody) { MailSubject = string.Empty; MailBody = string.Empty; oTemplate_BLogic = new Template_BLogic(); oTemplate = new Template(); oTemplate.Templatepath = Server.MapPath("~/Template"); oTemplate.Title = TemplateName; if (oTemplate_BLogic.BAL_Template_CheckExists(oTemplate)) { DataTable oTable = oTemplate_BLogic.BAL_Template_Select(oTemplate); MailSubject = Convert.ToString(oTable.Rows[0]["subject"]); MailBody = ReplaceTag(Convert.ToString(oTable.Rows[0]["body"])); } }
protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { stdlist.BMSID = AppSessions.BMSID; stdlist.DivisionID = AppSessions.DivisionID; stdlist.SchoolID = AppSessions.SchoolID; stdlist.PageTitle = "Send Assesment E-Mail"; if (PreviousPage != null) { if (PreviousPage.AttchmentList.Count > 0) { ArrayList array = new ArrayList(); foreach (string filepath in PreviousPage.AttchmentList) { if (Path.GetExtension(filepath).ToLower() == ".pdf") { array.Add(filepath); } } stdlist.Attachment = array; } if (!string.IsNullOrEmpty(PreviousPage.Templatetitle)) { BAL_Template = new Template_BLogic(); oTemplate = new Template(); oTemplate.Templatepath = Server.MapPath("~/Template"); oTemplate.Title = PreviousPage.Templatetitle; if (BAL_Template.BAL_Template_CheckExists(oTemplate)) { oTable = new DataTable(); oTable = BAL_Template.BAL_Template_Select(oTemplate); stdlist.Subject = Convert.ToString(oTable.Rows[0]["subject"]); stdlist.MailBody = Convert.ToString(oTable.Rows[0]["body"]); } } } } }
protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { if (!string.IsNullOrEmpty(Request.QueryString["title"])) { BAL_Template = new Template_BLogic(); oTemplate = new Template(); oTemplate.Templatepath = Server.MapPath("~/Template"); oTemplate.Title = Request.QueryString["title"]; ViewState["title"] = Request.QueryString["title"]; if (BAL_Template.BAL_Template_CheckExists(oTemplate)) { btnSubmit.Text = "Update"; btnsubmitadd.Visible = false; lblTitle.Text = "Update Template"; DataTable oTable = BAL_Template.BAL_Template_Select(oTemplate); txttitle.Text = Convert.ToString(oTable.Rows[0]["title"]); txtsubject.Text = Convert.ToString(oTable.Rows[0]["subject"]); txtmail.Content = Convert.ToString(oTable.Rows[0]["body"]); ViewState["Mode"] = "Update"; } else { ViewState["Mode"] = "Add"; } } else { ViewState["Mode"] = "Add"; } BindTagDropDown(); } }