protected void btnSaveDocPaper_Click(object sender, EventArgs e) { try { BLDocument bldb = new BLDocument(); setparameters(); if (Session["DocId"] != null) { intDocumentID = int.Parse(Session["DocId"].ToString()); bldb.updateDocument1(intDocumentID, strDocument, intIsDeleted, intApprove); fillgrid(); lblResult.Visible = true; lblResult.ForeColor = System.Drawing.Color.Green; lblResult.Text = "Document Details are Updated Successfully"; btnClearDocPaper.Enabled = true; lblErrorMsg.Text = ""; Session["DocId"] = null; fillgrid(); } else { string msg = bldb.saveDocument1(strDocument, intIsDeleted, intApprove); fillgrid(); if (msg == "1") { lblResult.Visible = true; lblResult.ForeColor = System.Drawing.Color.Green; lblResult.Text = "Document Details are Saved Successfully"; fillDDLDocument(); } else { lblResult.Visible = true; lblResult.ForeColor = System.Drawing.Color.Red; lblResult.Text = "Document Details Details are already Exists"; } Session["DocId"] = null; lblErrorMsg.Text = ""; fillgrid(); } Clearfields(); } catch (Exception ex) { lblCatchError.Text = ex.Message.ToString(); } }
protected void ddlApprovDoc_SelectedIndexChanged(object sender, EventArgs e) { try { if (ddlApprovDoc.SelectedItem.Text == "--Select--") { GdVwDocPaper.DataSource = null; GdVwDocPaper.DataBind(); } else { string strDocument = ddlDocumentDoc.SelectedItem.Text; int intApprove = int.Parse(ddlApprovDoc.SelectedItem.Value); if (ddlDocumentDoc.SelectedItem.Text == "--Select--" && ddlApprovDoc.SelectedItem.Text != "--Select--") { BLDocument blpr = new BLDocument(); SqlDataReader dr = blpr.gridFillApproveDoc1(intApprove); DataTable dt = new DataTable(); if (dr.HasRows == true) { dt.Load(dr); GdVwDocPaper.DataSource = dt; GdVwDocPaper.DataBind(); } else { lblErrorMsg.Text = "Records not Available"; GdVwDocPaper.DataSource = null; GdVwDocPaper.DataBind(); } dr.Close(); } if (ddlDocumentDoc.SelectedItem.Text != "--Select--" && ddlApprovDoc.SelectedItem.Text != "--Select--") { BLDocument blpr = new BLDocument(); SqlDataReader dr = blpr.gridFillApproveDocName1(strDocument, intApprove); DataTable dt = new DataTable(); if (dr.HasRows == true) { dt.Load(dr); GdVwDocPaper.DataSource = dt; GdVwDocPaper.DataBind(); } else { lblErrorMsg.Text = "Records not Available"; GdVwDocPaper.DataSource = null; GdVwDocPaper.DataBind(); } dr.Close(); } } } catch (Exception ex) { lblCatchError.Text = ex.Message.ToString(); } }
protected void GdVwDocPaper_RowCommand(object sender, GridViewCommandEventArgs e) { try { BLDocument blc = new BLDocument(); if (e.CommandName == "EditDocument") { GridViewRow gvr = (GridViewRow)((Control)e.CommandSource).NamingContainer; int rowIndex = gvr.RowIndex; int DocId = Convert.ToInt32(GdVwDocPaper.Rows[rowIndex].Cells[1].Text); Session["DocId"] = DocId; SqlDataReader dr2 = blc.getDocDetailsForUpdate1(DocId); if (dr2.HasRows) { while (dr2.Read()) { btnClearDocPaper.Enabled = false; txtDocPaper.Text = dr2.GetString(1); bool isdel = dr2.GetBoolean(2); if (isdel == true) rbYesIsDelDoc.Checked = true; else rbNoIsDelDoc.Checked = true; int approve = dr2.GetInt32(3); if (approve == 1) ChkBxApprovDoc.Checked = true; else ChkBxApprovDoc.Checked = false; } dr2.Close(); } } } catch (Exception ex) { lblCatchError.Text = ex.Message.ToString(); } }
protected void ChkbxShowDeletedDocPaper1_CheckedChanged(object sender, EventArgs e) { try { string strDocument = ddlDocumentDoc.SelectedItem.Text; int intIsDeleted; if (ChkbxShowDeletedDocPaper1.Checked == true) intIsDeleted = 1; else intIsDeleted = 0; if (ddlDocumentDoc.SelectedItem.Text == "--Select--" && ddlApprovDoc.SelectedItem.Text == "--Select--" && (ChkbxShowDeletedDocPaper1.Checked == true || ChkbxShowDeletedDocPaper1.Checked == false)) { BLDocument blpr = new BLDocument(); SqlDataReader dr = blpr.isDelDocChecked1(intIsDeleted); DataTable dt = new DataTable(); if (dr.HasRows) { dt.Load(dr); } GdVwDocPaper.DataSource = dt; GdVwDocPaper.DataBind(); } if (ddlDocumentDoc.SelectedItem.Text != "--Select--" && ddlApprovDoc.SelectedItem.Text == "--Select--" && (ChkbxShowDeletedDocPaper1.Checked == true || ChkbxShowDeletedDocPaper1.Checked == false)) { BLDocument blpr = new BLDocument(); SqlDataReader dr = blpr.isDelDocNameChecked1(strDocument, intIsDeleted); DataTable dt = new DataTable(); if (dr.HasRows) { dt.Load(dr); } GdVwDocPaper.DataSource = dt; GdVwDocPaper.DataBind(); } if (ddlDocumentDoc.SelectedItem.Text != "--Select--" && ddlApprovDoc.SelectedItem.Text != "--Select--" && (ChkbxShowDeletedDocPaper1.Checked == true || ChkbxShowDeletedDocPaper1.Checked == false)) { int intApprove = int.Parse(ddlApprovDoc.SelectedItem.Value); BLDocument blpr = new BLDocument(); SqlDataReader dr = blpr.isDelDocNameAppChecked1(strDocument, intApprove, intIsDeleted); DataTable dt = new DataTable(); if (dr.HasRows) { dt.Load(dr); } GdVwDocPaper.DataSource = dt; GdVwDocPaper.DataBind(); } } catch (Exception ex) { lblCatchError.Text = ex.Message.ToString(); } }