protected void onDelete(object source, CommandEventArgs e) { int retval = BLL_QMSDB_ProcedureSection.DeleteReadMandatory(Convert.ToInt32(e.CommandArgument.ToString().Split(',')[1].ToString()), Convert.ToInt32(e.CommandArgument.ToString().Split(',')[0].ToString()), Convert.ToInt32(Session["USERID"].ToString())); BindProcedureRead(); UpdPnlGrid.Update(); }
protected void imgbtnViewSectionDetails_Command(object sender, CommandEventArgs e) { txtProcedureSectionDetails.Visible = true; gvSectionList.SelectedIndex = -1; gvSectionList.SelectedIndex = ((sender as ImageButton).Parent.Parent as GridViewRow).RowIndex; if (UDFLib.ConvertIntegerToNull(e.CommandArgument) != null) { if (UDFLib.ConvertIntegerToNull(ViewState["Selected_Section_Details_ID"]) != null) { if (Is_Selected_Section_Details_Changed()) { Save_Section_Details(); } } DataTable dt = BLL_QMSDB_ProcedureSection.Get_Section_Details(Convert.ToInt32(e.CommandArgument)); if (dt.Rows.Count > 0) { txtProcedureSectionDetails.Content = dt.Rows[0]["CHECKOUTDETAILS"].ToString(); ViewState["Selected_Section_Details_Text"] = txtProcedureSectionDetails.Content; ViewState["Selected_Section_Details_ID"] = e.CommandArgument; } } }
protected void btnSectionDelete_Command(object s, CommandEventArgs e) { btnSectionSave_Command(null, null); if (Convert.ToInt32(e.CommandArgument) > 0) { BLL_QMSDB_ProcedureSection.Upd_Delete_Section(Convert.ToInt32(e.CommandArgument), Convert.ToInt32(Session["userid"])); Load_Sections(); } else { DataTable dtSections = ((DataTable)ViewState["dtSectionClone"]).Clone(); DataRow dr = null; foreach (GridViewRow grItem in gvSectionList.Rows) { if (((s as ImageButton).Parent.Parent as GridViewRow).RowIndex != grItem.RowIndex) { dr = dtSections.NewRow(); dr["Section_ID"] = gvSectionList.DataKeys[grItem.RowIndex].Values["Section_ID"].ToString(); dr["SECTION_HEADER"] = (grItem.FindControl("txtSection_Header") as TextBox).Text; dtSections.Rows.Add(dr); } } gvSectionList.DataSource = dtSections; gvSectionList.DataBind(); ViewState["dtSectionClone"] = dtSections.Clone(); } }
public void LoadtreeView() { if (Request.QueryString["status"] != null && Request.QueryString["status"].ToString() == "New") { TreeNode parentNode = new TreeNode("Contents", "Contents", getNodeImageURL("Parent.doc")); parentNode.Target = "docPreview"; parentNode.SelectAction = TreeNodeSelectAction.Select; parentNode.Expand(); BrowseTreeView.Nodes.Add(parentNode); TreeNode NewNode = new TreeNode("Header", "0", getNodeImageURL("Parent.doc")); NewNode.Target = "docPreview"; NewNode.SelectAction = TreeNodeSelectAction.Select; NewNode.Expand(); parentNode.ChildNodes.Add(NewNode); NewNode = new TreeNode("Details", "1", getNodeImageURL("Parent.doc")); NewNode.Target = "docPreview"; NewNode.SelectAction = TreeNodeSelectAction.Select; NewNode.Expand(); parentNode.ChildNodes.Add(NewNode); NewNode = new TreeNode("Footer", "2", getNodeImageURL("Parent.doc")); NewNode.Target = "docPreview"; NewNode.SelectAction = TreeNodeSelectAction.Select; NewNode.Expand(); parentNode.ChildNodes.Add(NewNode); } else { DataTable dtSection = BLL_QMSDB_ProcedureSection.QMSDBProcedureSection_List(int.Parse(lblProcedureId.Text)); ddlSection.DataValueField = "SECTION_ID"; ddlSection.DataTextField = "FILESNAME"; ddlSection.DataSource = dtSection; ddlSection.DataBind(); if (dtSection.Rows.Count > 0) { TreeNode parentNode = new TreeNode(dtSection.Rows[0]["FILESNAME"].ToString(), dtSection.Rows[0]["SECTION_ID"].ToString(), getNodeImageURL("Parent.Doc")); parentNode.Target = "docPreview"; parentNode.SelectAction = TreeNodeSelectAction.Select; parentNode.Expand(); BrowseTreeView.Nodes.Add(parentNode); foreach (DataRow dr in dtSection.Rows) { if (dr["SECTION_ID"].ToString() != "0") { TreeNode NewNode = new TreeNode(dr["FILESNAME"].ToString(), dr["SECTION_ID"].ToString(), getNodeImageURL(dr["FILESNAME"].ToString() + ".doc")); NewNode.SelectAction = TreeNodeSelectAction.Select; NewNode.Expand(); parentNode.ChildNodes.Add(NewNode); } } } } }
protected void btnSave_Click(object sender, EventArgs e) { TreeNode selectedNode = BrowseTreeView.SelectedNode; int sectionId = int.Parse(selectedNode.Value.ToString()); int i = BLL_QMSDB_ProcedureSection.QMSDBProcedureSection_Update_Details(sectionId, int.Parse(lblProcedureId.Text), txtProcedureSectionDetails.Text, int.Parse(Session["USERID"].ToString())); string js = "alert('Query Saved !!');"; ScriptManager.RegisterStartupScript(this, this.GetType(), "script2", js, true); }
void Load_Procedure_Preview() { DataTable dtSections = BLL_QMSDB_ProcedureSection.Get_All_Sections(Convert.ToInt32(Request.QueryString["PROCEDURE_ID"])); lblPreviewProcedure.Text = ""; foreach (DataRow drSec in dtSections.Rows) { lblPreviewProcedure.Text += Convert.ToString(drSec["CHECKOUTDETAILS"]); } updPreview.Update(); }
protected void Load_Sections() { DataTable dt = BLL_QMSDB_ProcedureSection.Get_All_Sections(Convert.ToInt32(Request.QueryString["PROCEDURE_ID"])); gvSectionList.DataSource = dt; gvSectionList.DataBind(); ViewState["dtSectionClone"] = dt.Clone(); UpdatePanelEditSection.Update(); ScriptManager.RegisterStartupScript(this, this.GetType(), "showeditsection", "showModal('EditSection')", true); }
void Load_Procedure_Preview() { DataTable dtSections = BLL_QMSDB_ProcedureSection.Get_All_Sections(Convert.ToInt32(Request.QueryString["PROCEDURE_ID"])); txtProcedureSectionDetails.Content = ""; foreach (DataRow drSec in dtSections.Rows) { txtProcedureSectionDetails.Content += Convert.ToString(drSec["CHECKOUTDETAILS"]); } //updPreview.Update(); txtProcedureSectionDetails.PrevMode = true; }
protected void BrowseTreeView_SelectedNodeChanged(object sender, EventArgs e) { TreeNode selectedNode = BrowseTreeView.SelectedNode; if (selectedNode.Parent != null) { DataTable dt = BLL_QMSDB_ProcedureSection.QMSDBProcedureSection_Edit(int.Parse(selectedNode.Value.ToString()), int.Parse(lblProcedureId.Text)); if (dt.Rows.Count > 0) { txtProcedureSectionDetails.Text = dt.Rows[0]["CHECKOUTDETAILS"].ToString(); } } }
protected void BtnSaveApproved_Click(object s, EventArgs e) { int sts = 0; DataTable dtAttach = BLL_QMSDB_ProcedureSection.Upd_Publish_Procedure(Convert.ToInt32(Request.QueryString["PROCEDURE_ID"]), Convert.ToInt32(Session["USERID"]), txtApprovalComments.Text, ref sts); if (sts == 1) { // delete the attachment from folder foreach (DataRow drAttach in dtAttach.Rows) { File.Delete(Server.MapPath("/" + ConfigurationManager.AppSettings["QMSDBPath"] + "/") + drAttach["ATTACHMENT_NAME"].ToString()); } ScriptManager.RegisterStartupScript(this, this.GetType(), "close", "hideModal('DivApproval');alert('Published successfully.');window.open('','_self');window.close();", true); } }
protected void AjaxFileUploadInsertImage_OnUploadComplete(object sender, AjaxFileUploadEventArgs file) { Byte[] fileBytes = file.GetContents(); string sPath = Server.MapPath("/" + ConfigurationManager.AppSettings["QMSDBPath"] + "/"); string FileName = "QMSDB_" + Guid.NewGuid().ToString() + Path.GetExtension(file.FileName); string FullFilename = Path.Combine(sPath, FileName); FileStream fileStream = new FileStream(FullFilename, FileMode.Create, FileAccess.ReadWrite); fileStream.Write(fileBytes, 0, fileBytes.Length); fileStream.Close(); BLL_QMSDB_ProcedureSection.Ins_Procedure_Attachment(Convert.ToInt32(Request.QueryString["PROCEDURE_ID"]), FileName, Convert.ToInt32(Session["userid"])); Session["UploadedFiles_Name"] += FileName + ","; }
protected void chkAccess_CheckedChanged(object sender, EventArgs e) { CheckBox chkAccess = (sender as CheckBox); GridViewRow row = chkAccess.NamingContainer as GridViewRow; if (((CheckBox)row.FindControl("chkAccess")).Checked == true) { int retVal = BLL_QMSDB_ProcedureSection.InsertReadMandatory(UDFLib.ConvertIntegerToNull(((Label)row.FindControl("lblFolderID")).Text) , UDFLib.ConvertIntegerToNull(((Label)row.FindControl("lblRankID")).Text) , Convert.ToInt32(Session["USERID"]) , ((CheckBox)row.FindControl("chkAccess")).Checked == true ? 1 : 0); BindProcedureRead(); UpdPnlGrid.Update(); } }
protected void btnSectionSave_Command(object s, CommandEventArgs e) { DataTable dtSection = new DataTable(); dtSection.Columns.Add("PKID"); dtSection.Columns.Add("SECTION_ID"); dtSection.Columns.Add("SECTION_NAME"); dtSection.Columns.Add("SECTION_HEADER"); dtSection.Columns.Add("SECTION_ORDER"); int pkid = 1; foreach (GridViewRow gr in gvSectionList.Rows) { if (!string.IsNullOrWhiteSpace((gr.FindControl("txtSection_Header") as TextBox).Text)) { DataRow dr = dtSection.NewRow(); if (gvSectionList.DataKeys[gr.RowIndex].Values["Section_ID"].ToString() == "0") { dr["PKID"] = pkid.ToString(); dr["SECTION_ID"] = "0"; pkid++; } else { dr["PKID"] = "0"; dr["SECTION_ID"] = gvSectionList.DataKeys[gr.RowIndex].Values["Section_ID"].ToString(); } dr["SECTION_HEADER"] = (gr.FindControl("txtSection_Header") as TextBox).Text; dr["SECTION_ORDER"] = gr.RowIndex + 1; dtSection.Rows.Add(dr); } } BLL_QMSDB_ProcedureSection.Upd_All_Sections(Convert.ToInt32(Request.QueryString["PROCEDURE_ID"]), dtSection, Convert.ToInt32(Session["USERID"]), txtProcedureCode.Text.Trim(), txtProcedureName.Text.Trim()); if (Is_Selected_Section_Details_Changed()) { Save_Section_Details(); } Load_Sections(); }
protected void btnExport_Click(object sender, ImageClickEventArgs e) { int rowcount = ucCustomPagerItems.isCountRecord; string sortbycoloumn = (ViewState["SORTBYCOLOUMN"] == null) ? null : (ViewState["SORTBYCOLOUMN"].ToString()); int? sortdirection = null; if (ViewState["SORTDIRECTION"] != null) { sortdirection = Int32.Parse(ViewState["SORTDIRECTION"].ToString()); } DataTable dt = BLL_QMSDB_ProcedureSection.Get_RankList_Search(txtSearchBy.Text, UDFLib.ConvertIntegerToNull(ddlRank.SelectedValue), UDFLib.ConvertIntegerToNull(ddlRankCategory.SelectedValue), null , sortbycoloumn, sortdirection, null, null, ref rowcount); string[] HeaderCaptions = { "Rank Name", "Rank Short Name", "Read Access" }; string[] DataColumnsName = { "Rank_Name", "Rank_Short_Name", "READ_ACCESS_FLAG" }; GridViewExportUtil.ShowExcel(dt, HeaderCaptions, DataColumnsName, "FBMReadAccess", "FBM Read Access"); }
public void BindProcedureRead() { int rowcount = ucCustomPagerItems.isCountRecord; string sortbycoloumn = (ViewState["SORTBYCOLOUMN"] == null) ? null : (ViewState["SORTBYCOLOUMN"].ToString()); int? sortdirection = null; if (ViewState["SORTDIRECTION"] != null) { sortdirection = Int32.Parse(ViewState["SORTDIRECTION"].ToString()); } string NodeValue = ""; if (trvFolder.SelectedNode != null) { NodeValue = trvFolder.SelectedNode.Value; } DataTable dt = BLL_QMSDB_ProcedureSection.Get_RankList_Search(txtSearchBy.Text, UDFLib.ConvertIntegerToNull(ddlRank.SelectedValue), UDFLib.ConvertIntegerToNull(ddlRankCategory.SelectedValue), UDFLib.ConvertIntegerToNull(NodeValue) , sortbycoloumn, sortdirection, ucCustomPagerItems.CurrentPageIndex, ucCustomPagerItems.PageSize, ref rowcount); if (ucCustomPagerItems.isCountRecord == 1) { ucCustomPagerItems.CountTotalRec = rowcount.ToString(); ucCustomPagerItems.BuildPager(); } if (dt.Rows.Count > 0) { gvProcedureRead.DataSource = dt; gvProcedureRead.DataBind(); } else { gvProcedureRead.DataSource = dt; gvProcedureRead.DataBind(); } }
protected void btnInsertPic_Click(object sender, EventArgs e) { try { if (Request.Files.Count > 0 && txtProcedureSectionDetails.ActiveMode == AjaxControlToolkit.HTMLEditor.ActiveModeType.Design) { //string sPath = Server.MapPath("/" + ConfigurationManager.AppSettings["QMSDBPath"] + "/"); try { int Max_Height = 400; int Max_Width = 400; System.Text.StringBuilder size = new System.Text.StringBuilder(); string sPath = Server.MapPath("/" + ConfigurationManager.AppSettings["QMSDBPath"] + "/"); for (int i = 0; i < Request.Files.Count; i++) { HttpPostedFile postedFile = Request.Files[i]; string FileName = "QMSDB_" + Guid.NewGuid().ToString() + Path.GetExtension(postedFile.FileName); string FullFilename = Path.Combine(sPath, FileName); postedFile.SaveAs(FullFilename); //FileStream fileStream = new FileStream(FullFilename, FileMode.Create, FileAccess.ReadWrite); //fileStream.Write(fileBytes, 0, fileBytes.Length); //fileStream.Close(); BLL_QMSDB_ProcedureSection.Ins_Procedure_Attachment(Convert.ToInt32(Request.QueryString["PROCEDURE_ID"]), FileName, Convert.ToInt32(Session["userid"])); if (postedFile.ContentLength > 0) { if (!string.IsNullOrWhiteSpace(postedFile.FileName)) { System.Drawing.Image objUpdImg = System.Drawing.Image.FromFile(Path.Combine(sPath, FileName)); if (objUpdImg.Height > Max_Height) { size.Append("height:" + Max_Height.ToString() + "px;"); } if (objUpdImg.Width > Max_Width) { size.Append("width:" + Max_Width.ToString() + "px;"); } txtProcedureSectionDetails.Content += "<img style='" + size.ToString() + "' src='/" + ConfigurationManager.AppSettings["QMSDBPath"] + "/" + FileName + "'>"; size.Clear(); } } } } catch { } finally { //updInserImage.Update(); Session["UploadedFiles_Name"] = ""; } //Byte[] fileBytes = file.GetContents(); //string sPath = Server.MapPath("/" + ConfigurationManager.AppSettings["QMSDBPath"] + "/"); //string FileName = "QMSDB_" + Guid.NewGuid().ToString() + Path.GetExtension(file.FileName); //string FullFilename = Path.Combine(sPath, FileName); //FileStream fileStream = new FileStream(FullFilename, FileMode.Create, FileAccess.ReadWrite); //fileStream.Write(fileBytes, 0, fileBytes.Length); //fileStream.Close(); //BLL_QMSDB_ProcedureSection.Ins_Procedure_Attachment(Convert.ToInt32(Request.QueryString["PROCEDURE_ID"]), FileName, Convert.ToInt32(Session["userid"])); //Session["UploadedFiles_Name"] += FileName + ","; //Guid gFileName = PhoenixCommonFileAttachment.InsertAttachment(Request.Files, new Guid(ViewState["dtkey"].ToString()), PhoenixModule.PURCHASE, null, ".jpg,.png,.gif"); //DataTable dt = PhoenixCommonFileAttachment.AttachmentList(new Guid(ViewState["dtkey"].ToString())); //DataRow[] dr = dt.Select("FLDDTKEY = '" + gFileName.ToString() + "'"); //if (dr.Length > 0) // txtItemDetails.Content = txtItemDetails.Content + "<img src=\"" + HttpContext.Current.Session["sitepath"] + "/attachments/" + dr[0]["FLDFILEPATH"].ToString() + "\" />"; } else { //ucError.Text = Request.Files.Count > 0 ? "You are not in design mode" : "No Picture selected."; //ucError.Visible = true; } } catch (Exception ex) { //ucError.ErrorMessage = ex.Message; //ucError.Visible = true; } }
int Save_Section_Details() { return(BLL_QMSDB_ProcedureSection.Upd_Section_Details(Convert.ToInt32(ViewState["Selected_Section_Details_ID"]), txtProcedureSectionDetails.Content, Convert.ToInt32(Session["userid"]))); }