protected void ImgDelete_Click(object sender, ImageClickEventArgs e) { try { if (txtModuleName.Text.Trim() == "") { string js = "alert('Please Enter Module name');"; ScriptManager.RegisterStartupScript(this, this.GetType(), "errorMail", js, true); return; } else { BLL_Infra_Lib_ModuleTemp.DELETE_Module(UDFLib.ConvertToInteger(hdnModuleTypeID.Value), txtModuleName.Text.Trim(), GetSessionUserID()); string js = "alert('Module Deleted.');"; ScriptManager.RegisterStartupScript(Page, Page.GetType(), "SUCCESS", js, true); rpt1.DataSource = BLL_Infra_Lib_ModuleTemp.Get_ModuleList(); rpt1.DataBind(); } } catch (Exception ex) { string js = "alert('Error Deleting module" + ex.Message.Replace("'", "") + "');window.close();"; ScriptManager.RegisterStartupScript(this, this.GetType(), "mailerror", js, true); } }
protected void btnModuleEditSave_Click(object sender, ImageClickEventArgs e) { try { if (txtModuleName.Text.Trim() == "") { string js = "alert('Please Enter Module name');"; ScriptManager.RegisterStartupScript(this, this.GetType(), "errorMail", js, true); return; } else { BLL_Infra_Lib_ModuleTemp.Update_ModuleName(UDFLib.ConvertToInteger(hdnModuleTypeID.Value), txtModuleName.Text.Trim(), GetSessionUserID()); string js = "alert('Module Updated..!.');"; ScriptManager.RegisterStartupScript(Page, Page.GetType(), "SUCCESS", js, true); ImageButton1.Visible = true; btnModuleEdit.Visible = false; txtModuleName.Enabled = false; } } catch (Exception ex) { string js = "alert('Error editing module" + ex.Message.Replace("'", "") + "');window.close();"; ScriptManager.RegisterStartupScript(this, this.GetType(), "mailerror", js, true); } }
protected void Page_Load(object sender, EventArgs e) { if (Session["USERID"] == null) { Response.Redirect("~/account/Login.aspx"); } UserAccessValidation(); if (!IsPostBack) { rpt1.DataSource = BLL_Infra_Lib_ModuleTemp.Get_ModuleList(); rpt1.DataBind(); txtTemplateBody.config.toolbar = new object[] { new object[] { "Preview" }, new object[] { "Source" }, new object[] { "Cut", "Copy", "Paste", "PasteText", "-", "Print", "SpellChecker", "Scayt" }, new object[] { "Undo", "Redo", "-", "Find", "Replace", "-", "SelectAll", "RemoveFormat" }, new object[] { "Bold", "Italic", "Underline", "Strike", "-", "Subscript", "Superscript" }, new object[] { "NumberedList", "BulletedList", "-", "Outdent", "Indent", "Blockquote" }, new object[] { "JustifyLeft", "JustifyCenter", "JustifyRight", "JustifyBlock" }, "/", new object[] { "HorizontalRule", "Smiley", "PageBreak" }, new object[] { "Styles", "Format", "Font", "FontSize" }, new object[] { "TextColor", "BGColor" }, new object[] { "Maximize", "ShowBlocks" }, new object[] { "Image" } }; txtTemplateBody.Height = 600; } }
protected void btnsaveModule_Click(object sender, EventArgs e) { if (HiddenFlag.Value == "Add") { int retval = BLL_Infra_Lib_ModuleTemp.Save_Module(txtModule.Text, Convert.ToInt32(Session["USERID"])); } rpt1.DataSource = BLL_Infra_Lib_ModuleTemp.Get_ModuleList(); rpt1.DataBind(); string hidemodal = String.Format("hideModal('divadd')"); ScriptManager.RegisterStartupScript(Page, Page.GetType(), "hidemodal", hidemodal, true); }
protected string Load_ModuleTemplate(int ModuletypeId) { string TemplateText = ""; ImageButton1.Visible = true; btnModuleEdit.Visible = false; txtModuleName.Enabled = false; DataTable dt = BLL_Infra_Lib_ModuleTemp.Get_ModuleTemplate(ModuletypeId); DataTable dtTemplate = BLL_Infra_Lib_ModuleTemp.Get_ModuleList(ModuletypeId); if (dt.Rows.Count > 0) { if (MainView.ActiveViewIndex == 0) { txtTemplateName.Text = dt.Rows[0]["Template_Name"].ToString();; TemplateText = dt.Rows[0]["template_text"].ToString(); TemplateText = TemplateText.Replace("<p></p>", ""); } if (MainView.ActiveViewIndex == 1) { txtTemplateName.Text = dt.Rows[0]["Template_Name"].ToString();; TemplateText = dt.Rows[0]["HeaderText"].ToString(); TemplateText = TemplateText.Replace("<p></p>", ""); } if (MainView.ActiveViewIndex == 2) { txtTemplateName.Text = dt.Rows[0]["Template_Name"].ToString();; TemplateText = dt.Rows[0]["FooterText"].ToString(); TemplateText = TemplateText.Replace("<p></p>", ""); } if (MainView.ActiveViewIndex == -1)// This will set for default { txtTemplateName.Text = dt.Rows[0]["Template_Name"].ToString();; TemplateText = TemplateText = dt.Rows[0]["HeaderText"].ToString() + dt.Rows[0]["template_text"].ToString() + dt.Rows[0]["FooterText"].ToString(); TemplateText = TemplateText.Replace("<p></p>", ""); } txtModuleName.Text = dtTemplate.Rows[0]["ModuleTypeName"].ToString(); // txtModuleName.Enabled = true; } else { txtTemplateName.Text = dtTemplate.Rows[0]["ModuleTypeName"].ToString(); txtModuleName.Text = dtTemplate.Rows[0]["ModuleTypeName"].ToString(); } return(TemplateText); }
protected void btnSaveTemplate_Click(object sender, EventArgs e) { try { if (txtTemplateName.Text.Trim() == "") { string js = "alert('Enter template name');"; ScriptManager.RegisterStartupScript(this, this.GetType(), "errorMail", js, true); return; } else if (txtTemplateBody.Text == "") { string js = "alert('Enter template body');"; ScriptManager.RegisterStartupScript(this, this.GetType(), "errorMail", js, true); return; } else { if (MainView.ActiveViewIndex == 0) { BLL_Infra_Lib_ModuleTemp.Save_Module_Template(UDFLib.ConvertToInteger(hdnModuleTypeID.Value), txtTemplateName.Text.Trim(), txtTemplateBody.Text, GetSessionUserID(), 0); string js = "alert('Module Template Saved.');"; ScriptManager.RegisterStartupScript(Page, Page.GetType(), "SUCCESS", js, true); } if (MainView.ActiveViewIndex == 1) { BLL_Infra_Lib_ModuleTemp.Save_Module_Template(UDFLib.ConvertToInteger(hdnModuleTypeID.Value), txtTemplateName.Text.Trim(), txtTemplateBody.Text, GetSessionUserID(), 1); string js = "alert('Module Template Saved.');"; ScriptManager.RegisterStartupScript(Page, Page.GetType(), "SUCCESS", js, true); } if (MainView.ActiveViewIndex == 2) { BLL_Infra_Lib_ModuleTemp.Save_Module_Template(UDFLib.ConvertToInteger(hdnModuleTypeID.Value), txtTemplateName.Text.Trim(), txtTemplateBody.Text, GetSessionUserID(), 2); string js = "alert('Module Template Saved.');"; ScriptManager.RegisterStartupScript(Page, Page.GetType(), "SUCCESS", js, true); } } } catch (Exception ex) { string js = "alert('Error saving module template" + ex.Message.Replace("'", "") + "');window.close();"; ScriptManager.RegisterStartupScript(this, this.GetType(), "mailerror", js, true); } }