protected void GdVwViewTypWrk_RowCommand(object sender, GridViewCommandEventArgs e) { try { BLTypeOfWork bltow = new BLTypeOfWork(); if (e.CommandName == "EditTypWrk") { GridViewRow gvr = (GridViewRow)((Control)e.CommandSource).NamingContainer; int rowIndex = gvr.RowIndex; int TypWrkId = Convert.ToInt32(GdVwViewTypWrk.Rows[rowIndex].Cells[1].Text); Session["TypWrkId"] = TypWrkId.ToString(); SqlDataReader dr1 = bltow.getTypeWrkDetailsForUpdate1(TypWrkId); if (dr1.HasRows == true) { while (dr1.Read()) { btnClearTypWrk.Enabled = false; txtTypeOfWork.Text = dr1.GetString(1); bool isdel = dr1.GetBoolean(2); if (isdel == true) rbYesIsDeltypWrk.Checked = true; else rbNoIsDeltypWrk.Checked = true; int approve = dr1.GetInt32(3); if (approve == 1) ChkBxApprovTypOfWrk.Checked = true; else ChkBxApprovTypOfWrk.Checked = false; } } } } catch (Exception ex) { lblCatchError.Text = ex.Message.ToString(); } }
protected void ChkbxShowDeletedTypWrk_CheckedChanged(object sender, EventArgs e) { try { string strWork = ddlTypWrk.SelectedItem.Text; int intIsDeleted; if (ChkbxShowDeletedTypWrk.Checked == true) intIsDeleted = 1; else { intIsDeleted = 0; } if (ddlTypWrk.SelectedItem.Text == "--Select--" && ddlApprvtypWrk.SelectedItem.Text == "--Select--" && (ChkbxShowDeletedTypWrk.Checked == true || ChkbxShowDeletedTypWrk.Checked == false)) { BLTypeOfWork blpr = new BLTypeOfWork(); SqlDataReader dr = blpr.isDelTypWrkChecked1(intIsDeleted); DataTable dt = new DataTable(); if (dr.HasRows == true) { dt.Load(dr); GdVwViewTypWrk.DataSource = dt; GdVwViewTypWrk.DataBind(); } else { lblErrorMsg.Text = "Records not Available"; GdVwViewTypWrk.DataSource = null; GdVwViewTypWrk.DataBind(); } dr.Close(); } if (ddlTypWrk.SelectedItem.Text != "--Select--" && ddlApprvtypWrk.SelectedItem.Text == "--Select--" && (ChkbxShowDeletedTypWrk.Checked == true || ChkbxShowDeletedTypWrk.Checked == false)) { BLTypeOfWork blpr = new BLTypeOfWork(); SqlDataReader dr = blpr.isDelTypWrkCheckedWork1(strWork, intIsDeleted); DataTable dt = new DataTable(); if (dr.HasRows == true) { dt.Load(dr); GdVwViewTypWrk.DataSource = dt; GdVwViewTypWrk.DataBind(); } else { lblErrorMsg.Text = "Records not Available"; GdVwViewTypWrk.DataSource = null; GdVwViewTypWrk.DataBind(); } dr.Close(); } if (ddlTypWrk.SelectedItem.Text != "--Select--" && ddlApprvtypWrk.SelectedItem.Text != "--Select--" && (ChkbxShowDeletedTypWrk.Checked == true || ChkbxShowDeletedTypWrk.Checked == false)) { int intApprove = int.Parse(ddlApprvtypWrk.SelectedItem.Value); BLTypeOfWork blpr = new BLTypeOfWork(); SqlDataReader dr = blpr.isDelTypWrkAppCheckedWork1(strWork, intApprove, intIsDeleted); DataTable dt = new DataTable(); if (dr.HasRows == true) { dt.Load(dr); GdVwViewTypWrk.DataSource = dt; GdVwViewTypWrk.DataBind(); } else { lblErrorMsg.Text = "Records not Available"; GdVwViewTypWrk.DataSource = null; GdVwViewTypWrk.DataBind(); } dr.Close(); } } catch (Exception ex) { lblCatchError.Text = ex.Message.ToString(); } }
protected void ddlApprvtypWrk_SelectedIndexChanged(object sender, EventArgs e) { try { string strWork = ddlTypWrk.SelectedItem.Text; int intApprove = int.Parse(ddlApprvtypWrk.SelectedItem.Value); if (ddlTypWrk.SelectedItem.Text == "--Select--" && ddlApprvtypWrk.SelectedItem.Text != "--Select--") { // int intApprove = int.Parse(ddlApprvtypWrk.SelectedItem.Value); BLTypeOfWork blpr = new BLTypeOfWork(); SqlDataReader dr = blpr.gridFillApproveTypWrk1(intApprove); DataTable dt = new DataTable(); if (dr.HasRows == true) { dt.Load(dr); GdVwViewTypWrk.DataSource = dt; GdVwViewTypWrk.DataBind(); } else { lblErrorMsg.Text = "Records not Available"; GdVwViewTypWrk.DataSource = null; GdVwViewTypWrk.DataBind(); } dr.Close(); } if (ddlTypWrk.SelectedItem.Text != "--Select--" && ddlApprvtypWrk.SelectedItem.Text != "--Select--") { // int intApprove = int.Parse(ddlApprvtypWrk.SelectedItem.Value); BLTypeOfWork blpr = new BLTypeOfWork(); SqlDataReader dr = blpr.gridFillApproveTypWrkName1(strWork, intApprove); DataTable dt = new DataTable(); if (dr.HasRows == true) { dt.Load(dr); GdVwViewTypWrk.DataSource = dt; GdVwViewTypWrk.DataBind(); } else { lblErrorMsg.Text = "Records not Available"; GdVwViewTypWrk.DataSource = null; GdVwViewTypWrk.DataBind(); } dr.Close(); } } catch (Exception ex) { lblCatchError.Text = ex.Message.ToString(); } }
protected void btnSaveTypWrk_Click(object sender, EventArgs e) { try { BLTypeOfWork bltow = new BLTypeOfWork(); //SqlDataReader dr = bldb.getDocDetailsForUpdate1(intDocumentID); setparameters(); if (Session["TypWrkId"] != null) { //setparameters(); intTypeofWorkID = int.Parse(Session["TypWrkId"].ToString()); bltow.updateTypeOfWork1(intTypeofWorkID, strwork, intIsDeleted, intApprove); fillgrid(); lblResult.Visible = true; lblResult.ForeColor = System.Drawing.Color.Green; lblResult.Text = "Type of Work Details are Updated Successfully"; lblErrorMsg.Text = ""; fillgrid(); btnClearTypWrk.Enabled = false; Session["TypWrkId"] = null; } else { string msg = bltow.saveTypeOfWork1(strwork, intIsDeleted, intApprove); fillgrid(); if (msg == "1") { lblResult.Visible = true; lblResult.ForeColor = System.Drawing.Color.Green; lblResult.Text = "Type of Work Details are Added Successfully"; fillDDLTypWork(); } else { lblResult.Visible = true; lblResult.ForeColor = System.Drawing.Color.Red; lblResult.Text = "Type of Work Details are Already Exists"; } fillgrid(); lblErrorMsg.Text = ""; Session["TypWrkId"] = null; } txtTypeOfWork.Text = ""; rbYesIsDeltypWrk.Checked = false; rbNoIsDeltypWrk.Checked = false; ChkBxApprovTypOfWrk.Checked = false; } catch (Exception ex) { lblCatchError.Text = ex.Message.ToString(); } }