protected void RG_Details_UpdateCommand(object source, GridCommandEventArgs e) { try { SMHR_LOB _obj_smhr_lob = new SMHR_LOB(); GridEditableItem editedItem = e.Item as GridEditableItem; int index = editedItem.DataSetIndex; DataTable newTable = GridSource(); Hashtable newValues = new Hashtable(); string ID = e.Item.OwnerTableView.Items[index]["emp_id"].Text; DataRow[] ChangedRows = newTable.Select("emp_id = " + Convert.ToString(ID)); e.Item.OwnerTableView.ExtractValuesFromItem(newValues, editedItem); ChangedRows[0].BeginEdit(); foreach (DictionaryEntry entry in newValues) { ChangedRows[0][(string)entry.Key] = entry.Value; } ChangedRows[0].EndEdit(); DataTable dt = (DataTable)ViewState["DataTable"]; RG_Details.DataSource = dt; dt.PrimaryKey = new DataColumn[] { dt.Columns["emp_id"] }; } catch (Exception ex) { SMHR.BLL.Error_Log(Session["USER_ID"].ToString(), ex.TargetSite.ToString(), ex.Message.Replace("'", "''"), "Default", ex.StackTrace, DateTime.Now); Response.Redirect("~/Frm_ErrorPage.aspx"); return; } }
protected void btn_Update_Click(object sender, EventArgs e) { try { SMHR_LOB _obj_smhr_lob = new SMHR_LOB(); foreach (GridDataItem item in this.Rg_LOB.MasterTableView.Items) { _obj_smhr_lob.OPERATION = operation.Delete; _obj_smhr_lob.LOB_EMPID = Convert.ToInt32(item.Cells[2].Text); BLL.set_UpdateEmpLOB(_obj_smhr_lob); } InsertGridDetails(strQry); _obj_smhr_lob.OPERATION = operation.Insert; bool result = BLL.set_EMpLOB(_obj_smhr_lob, strQry.ToString()); if (result == true) { btn_Finalise.Enabled = true; } else { BLL.ShowMessage(this, "Updation failed"); } } catch (Exception ex) { SMHR.BLL.Error_Log(Session["USER_ID"].ToString(), ex.TargetSite.ToString(), ex.Message.Replace("'", "''"), "frm_leaveopeningbalances", ex.StackTrace, DateTime.Now); Response.Redirect("~/Frm_ErrorPage.aspx"); } }
protected void btn_Finalise_Click(object sender, EventArgs e) { try { SMHR_LOB _obj_smhr_lob = new SMHR_LOB(); _obj_smhr_lob.OPERATION = operation.Update; StringBuilder strQry = new StringBuilder(); foreach (GridDataItem item in this.Rg_LOB.MasterTableView.Items) { _obj_smhr_lob.LOB_EMPID = Convert.ToInt32(item.Cells[2].Text); for (int j = 0; j < Rg_LOB.Columns.Count - 5; j++) { strQry.Append("EXEC USP_SMHR_LEAVEOPENINGBALANCES "); _obj_smhr_lob.LOB_EMPID = Convert.ToInt32(item.Cells[2].Text); string LT = Convert.ToString(Rg_LOB.MasterTableView.Columns[j + 4].UniqueName); string[] T = LT.Split(new char[] { '-' }); _obj_smhr_lob.LOB_LEAVETYPEID = Convert.ToInt32(T[0]); string ctrl = "ntxt_" + LT; RadNumericTextBox ntxt; // ntxt = (RadNumericTextBox)item[this.Rg_LOB.MasterTableView.Columns[j + 4].UniqueName].FindControl(ctrl); // Double db = double.Parse((item[LT].FindControl(ctrl) as RadNumericTextBox).Value.ToString()); //ntxt = new myNTemplate(Rg_LOB.MasterTableView.Columns[j + 4].UniqueName); _obj_smhr_lob.LOB_NOOFDAYS = 2;//Convert.ToInt32(ntxt.Text); _obj_smhr_lob.LOB_FINALISE = 1; _obj_smhr_lob.LOB_CREATEDBY = Convert.ToInt32(Session["USER_ID"]); _obj_smhr_lob.LOB_CREATEDDATE = System.DateTime.Now; _obj_smhr_lob.LOB_LASTMDFBY = Convert.ToInt32(Session["USER_ID"]); _obj_smhr_lob.LOB_LASTMDFDATE = System.DateTime.Now; string str = "@Operation = 'UPDATE'" + ",@LOB_EMPID = '" + _obj_smhr_lob.LOB_EMPID + "'" + ",@LOB_LEAVETYPEID = '" + _obj_smhr_lob.LOB_LEAVETYPEID + "'" + ",@LOB_NOOFDAYS = '" + _obj_smhr_lob.LOB_NOOFDAYS + "'" + ",@LOB_FINALISE = '" + _obj_smhr_lob.LOB_FINALISE + "'" + ",@LOB_CREATEDBY = '" + _obj_smhr_lob.LOB_CREATEDBY + "'" + ",@LOB_CREATEDDATE = '" + _obj_smhr_lob.LOB_CREATEDDATE + "'" + ",@LOB_LASTMDFBY = '" + _obj_smhr_lob.LOB_LASTMDFBY + "'" + ",@LOB_LASTMDFDATE = '" + _obj_smhr_lob.LOB_LASTMDFDATE + "'"; strQry.Append(str); } } bool result = BLL.set_EMpLOB(_obj_smhr_lob, strQry.ToString()); if (result == true) { BLL.ShowMessage(this, "Leave Opening Balances for this BU are Finalised!!"); } else { BLL.ShowMessage(this, "Record Updation Failed"); } } catch (Exception ex) { SMHR.BLL.Error_Log(Session["USER_ID"].ToString(), ex.TargetSite.ToString(), ex.Message.Replace("'", "''"), "frm_leaveopeningbalances", ex.StackTrace, DateTime.Now); Response.Redirect("~/Frm_ErrorPage.aspx"); } }
protected void rcmb_BUID_SelectedIndexChanged(object o, RadComboBoxSelectedIndexChangedEventArgs e) { try { SMHR_LOB _obj_smhr_lob = new SMHR_LOB(); int BUID = Convert.ToInt32(rcmb_BUID.SelectedItem.Value); DataTable dt; dt = BLL.get_EmpLOB(BUID); GetGridStructure(); ViewState["dt"] = dt; Rg_LOB.DataSource = dt; // Rg_LOB.MasterTableView.EditMode = GridEditMode.InPlace; Rg_LOB.DataBind(); //FOR UPDATING RECORDS _obj_smhr_lob.OPERATION = operation.Empty; _obj_smhr_lob.LOB_BUID = Convert.ToInt32(rcmb_BUID.SelectedItem.Value); DataTable dtreccount = BLL.get_LOBRecords(_obj_smhr_lob); if (dtreccount.Rows.Count > 0) { btn_Update.Visible = true; } else { btn_Submit.Visible = true; } } catch (Exception ex) { SMHR.BLL.Error_Log(Session["USER_ID"].ToString(), ex.TargetSite.ToString(), ex.Message.Replace("'", "''"), "frm_leaveopeningbalances", ex.StackTrace, DateTime.Now); Response.Redirect("~/Frm_ErrorPage.aspx"); } }
protected void btn_Finalise_Click(object sender, EventArgs e) { try { SMHR_LOB _obj_smhr_lob = new SMHR_LOB(); btn_Finalise.Enabled = true; for (int i = 0; i < RG_Details.Items.Count; i++) { _obj_smhr_lob.LOB_EMPID = null; for (int j = 0; j < RG_Details.MasterTableView.AutoGeneratedColumns.Count() - 4; j++) { strQry.Append("EXEC USP_SMHR_LEAVEOPENINGBALANCES "); _obj_smhr_lob.LOB_EMPID = Convert.ToInt32(RG_Details.Items[i]["EMP_ID"].Text); string LT = Convert.ToString(RG_Details.MasterTableView.AutoGeneratedColumns[j + 4].UniqueName); string[] T = LT.Split(new char[] { '-' }); _obj_smhr_lob.LOB_LEAVETYPEID = Convert.ToInt32(T[0]); _obj_smhr_lob.LOB_NOOFDAYS = Convert.ToInt32(RG_Details.Items[i][LT].Text); _obj_smhr_lob.LOB_FINALISE = 1; _obj_smhr_lob.LOB_CREATEDBY = Convert.ToInt32(Session["USER_ID"]); _obj_smhr_lob.LOB_CREATEDDATE = System.DateTime.Now; _obj_smhr_lob.LOB_LASTMDFBY = Convert.ToInt32(Session["USER_ID"]); _obj_smhr_lob.LOB_LASTMDFDATE = System.DateTime.Now; _obj_smhr_lob.ORGANISATION_ID = Convert.ToInt32(Session["ORG_ID"]); _obj_smhr_lob.OPERATION = operation.Insert; string str = "@Operation = 'UPDATE'" + ",@LOB_EMPID = '" + _obj_smhr_lob.LOB_EMPID + "'" + ",@LOB_LEAVETYPEID = '" + _obj_smhr_lob.LOB_LEAVETYPEID + "'" + ",@LOB_NOOFDAYS = '" + _obj_smhr_lob.LOB_NOOFDAYS + "'" + ",@LOB_FINALISE = '" + _obj_smhr_lob.LOB_FINALISE + "'" + ",@LOB_CREATEDBY = '" + _obj_smhr_lob.LOB_CREATEDBY + "'" + ",@LOB_CREATEDDATE = '" + _obj_smhr_lob.LOB_CREATEDDATE + "'" + ",@LOB_LASTMDFBY = '" + _obj_smhr_lob.LOB_LASTMDFBY + "'" + ",@LOB_LASTMDFDATE = '" + _obj_smhr_lob.LOB_LASTMDFDATE + "'" + ",@LOB_ORGANISATIONID='" + _obj_smhr_lob.ORGANISATION_ID + "'"; strQry.Append(str); } } bool rs = BLL.set_EMpLOB(_obj_smhr_lob, strQry.ToString()); if (rs == true) { BLL.ShowMessage(this, "Leave Opening Balances finalised Successfully"); btn_Finalise.Enabled = false; } else { BLL.ShowMessage(this, "Error found"); } } catch (Exception ex) { SMHR.BLL.Error_Log(Session["USER_ID"].ToString(), ex.TargetSite.ToString(), ex.Message.Replace("'", "''"), "Default", ex.StackTrace, DateTime.Now); Response.Redirect("~/Frm_ErrorPage.aspx"); return; } }
protected void btn_Update_Click(object sender, EventArgs e) { try { SMHR_LOB _obj_smhr_lob = new SMHR_LOB(); btn_Finalise.Enabled = true; StringBuilder strQry = new StringBuilder(); for (int i = 0; i < Rg_Details.Items.Count; i++) { _obj_smhr_lob.LOB_EMPID = null; for (int j = 0; j < Rg_Details.MasterTableView.AutoGeneratedColumns.Count() - 4; j++) { strQry.Append("EXEC USP_SMHR_LEAVEOPENINGBALANCES "); _obj_smhr_lob.LT_EMPID = Convert.ToInt32(Rg_Details.Items[i]["EMP_ID"].Text); string LT = Convert.ToString(Rg_Details.MasterTableView.AutoGeneratedColumns[j + 4].UniqueName); string[] T = LT.Split(new char[] { '-' }); _obj_smhr_lob.LT_PERIOD = Convert.ToInt32(rcmb_Period.SelectedItem.Value); _obj_smhr_lob.LT_LEAVETYPEID = Convert.ToInt32(T[0]); _obj_smhr_lob.LT_CURRENTBALANCE = Convert.ToDouble(Rg_Details.Items[i][LT].Text); _obj_smhr_lob.OPERATION = operation.Update; string str = "@Operation = 'Update'" + ",@LT_EMPID = '" + _obj_smhr_lob.LT_EMPID + "'" + ",@LT_PERIOD='" + _obj_smhr_lob.LT_PERIOD + "'" + ",@LT_LEAVETYPEID = '" + _obj_smhr_lob.LT_LEAVETYPEID + "'" + ",@LT_CURRENTBALANCE='" + _obj_smhr_lob.LT_CURRENTBALANCE + "'"; strQry.Append(str); } } bool rs = BLL.set_EMpLOB(_obj_smhr_lob, strQry.ToString()); if (rs == true) { BLL.ShowMessage(this, "Leave Opening Balances updated Successfully"); } else { BLL.ShowMessage(this, "Error found"); } getData(); Rg_Details.DataBind(); btn_Finalise.Visible = true; //btn_Save.Enabled = false; btn_Update.Enabled = false; } catch (Exception ex) { SMHR.BLL.Error_Log(Session["USER_ID"].ToString(), ex.TargetSite.ToString(), ex.Message.Replace("'", "''"), "frm_leaveopeningbalances", ex.StackTrace, DateTime.Now); Response.Redirect("~/Frm_ErrorPage.aspx"); return; } }
private string InsertGridDetails(StringBuilder strQry) { try { SMHR_LOB _obj_smhr_lob = new SMHR_LOB(); _obj_smhr_lob.OPERATION = operation.Delete; foreach (GridDataItem item in this.Rg_LOB.MasterTableView.Items) { _obj_smhr_lob.LOB_EMPID = Convert.ToInt32(item.Cells[2].Text); for (int j = 0; j < Rg_LOB.Columns.Count - 5; j++) { strQry.Append("EXEC USP_SMHR_LEAVEOPENINGBALANCES "); _obj_smhr_lob.LOB_EMPID = Convert.ToInt32(item.Cells[2].Text); string LT = Convert.ToString(Rg_LOB.MasterTableView.Columns[j + 4].UniqueName); string[] T = LT.Split(new char[] { '-' }); _obj_smhr_lob.LOB_LEAVETYPEID = Convert.ToInt32(T[0]); string ctrl = "ntxt_" + LT; RadNumericTextBox ntxt; // ntxt = (RadNumericTextBox)item[this.Rg_LOB.MasterTableView.Columns[j + 4].UniqueName].FindControl(ctrl); // Double db = double.Parse((item[LT].FindControl(ctrl) as RadNumericTextBox).Value.ToString()); //ntxt = new myNTemplate(Rg_LOB.MasterTableView.Columns[j + 4].UniqueName); _obj_smhr_lob.LOB_NOOFDAYS = 2;//Convert.ToInt32(ntxt.Text); _obj_smhr_lob.LOB_FINALISE = 0; _obj_smhr_lob.LOB_CREATEDBY = Convert.ToInt32(Session["USER_ID"]); _obj_smhr_lob.LOB_CREATEDDATE = System.DateTime.Now; _obj_smhr_lob.LOB_LASTMDFBY = Convert.ToInt32(Session["USER_ID"]); _obj_smhr_lob.LOB_LASTMDFDATE = System.DateTime.Now; _obj_smhr_lob.OPERATION = operation.Insert; string str = "@Operation = 'Insert'" + ",@LOB_EMPID = '" + _obj_smhr_lob.LOB_EMPID + "'" + ",@LOB_LEAVETYPEID = '" + _obj_smhr_lob.LOB_LEAVETYPEID + "'" + ",@LOB_NOOFDAYS = '" + _obj_smhr_lob.LOB_NOOFDAYS + "'" + ",@LOB_FINALISE = '" + _obj_smhr_lob.LOB_FINALISE + "'" + ",@LOB_CREATEDBY = '" + _obj_smhr_lob.LOB_CREATEDBY + "'" + ",@LOB_CREATEDDATE = '" + _obj_smhr_lob.LOB_CREATEDDATE + "'" + ",@LOB_LASTMDFBY = '" + _obj_smhr_lob.LOB_LASTMDFBY + "'" + ",@LOB_LASTMDFDATE = '" + _obj_smhr_lob.LOB_LASTMDFDATE + "'"; strQry.Append(str); } } } catch (Exception ex) { SMHR.BLL.Error_Log(Session["USER_ID"].ToString(), ex.TargetSite.ToString(), ex.Message.Replace("'", "''"), "frm_leaveopeningbalances", ex.StackTrace, DateTime.Now); Response.Redirect("~/Frm_ErrorPage.aspx"); } return(Convert.ToString(strQry)); }
private string InsertGridDetails(StringBuilder strQry) { try { SMHR_LOB _obj_smhr_lob = new SMHR_LOB(); _obj_smhr_lob.OPERATION = operation.Delete; foreach (GridDataItem item in this.RG_Details.MasterTableView.Items) { _obj_smhr_lob.LOB_EMPID = Convert.ToInt32(item.Cells[2].Text); for (int j = 0; j < RG_Details.Columns.Count - 5; j++) { strQry.Append("EXEC USP_SMHR_LEAVEOPENINGBALANCES "); _obj_smhr_lob.LOB_EMPID = Convert.ToInt32(item.Cells[2].Text); string LT = Convert.ToString(RG_Details.MasterTableView.Columns[j + 4].UniqueName); string[] T = LT.Split(new char[] { '-' }); _obj_smhr_lob.LOB_LEAVETYPEID = Convert.ToInt32(T[0]); _obj_smhr_lob.LOB_NOOFDAYS = Convert.ToInt32(item[LT].Text); _obj_smhr_lob.LOB_FINALISE = 0; _obj_smhr_lob.LOB_CREATEDBY = Convert.ToInt32(Session["USER_ID"]); _obj_smhr_lob.LOB_CREATEDDATE = System.DateTime.Now; _obj_smhr_lob.LOB_LASTMDFBY = Convert.ToInt32(Session["USER_ID"]); _obj_smhr_lob.LOB_LASTMDFDATE = System.DateTime.Now; _obj_smhr_lob.OPERATION = operation.Insert; string str = "@Operation = 'Insert'" + ",@LOB_EMPID = '" + _obj_smhr_lob.LOB_EMPID + "'" + ",@LOB_LEAVETYPEID = '" + _obj_smhr_lob.LOB_LEAVETYPEID + "'" + ",@LOB_NOOFDAYS = '" + _obj_smhr_lob.LOB_NOOFDAYS + "'" + ",@LOB_FINALISE = '" + _obj_smhr_lob.LOB_FINALISE + "'" + ",@LOB_CREATEDBY = '" + _obj_smhr_lob.LOB_CREATEDBY + "'" + ",@LOB_CREATEDDATE = '" + _obj_smhr_lob.LOB_CREATEDDATE + "'" + ",@LOB_LASTMDFBY = '" + _obj_smhr_lob.LOB_LASTMDFBY + "'" + ",@LOB_LASTMDFDATE = '" + _obj_smhr_lob.LOB_LASTMDFDATE + "'"; strQry.Append(str); } } } catch (Exception ex) { SMHR.BLL.Error_Log(Session["USER_ID"].ToString(), ex.TargetSite.ToString(), ex.Message.Replace("'", "''"), "Default", ex.StackTrace, DateTime.Now); Response.Redirect("~/Frm_ErrorPage.aspx"); //return; } return(Convert.ToString(strQry)); }
protected void btnUpdate_Click(object sender, EventArgs e) { try { SMHR_LOB _obj_SMHR_LOB = new SMHR_LOB(); _obj_SMHR_LOB.LT_EMPID = Convert.ToInt32(rcbEmp.SelectedValue); _obj_SMHR_LOB.LT_BAL = Convert.ToDouble(rntbOpenBal.Text); _obj_SMHR_LOB.LT_PERIOD = Convert.ToInt32(rcmb_Period.SelectedValue); //_obj_SMHR_LOB.LASTMDFBY = Convert.ToInt32(Session["EMP_ID"]); _obj_SMHR_LOB.CREATEDBY = Convert.ToInt32(Session["USER_ID"]); _obj_SMHR_LOB.CREATEDDATE = DateTime.Now; _obj_SMHR_LOB.LASTMDFBY = Convert.ToInt32(Session["USER_ID"]); _obj_SMHR_LOB.LASTMDFDATE = DateTime.Now; bool status = BLL.setEmpLOB(_obj_SMHR_LOB); if (status == true) { BLL.ShowMessage(this, "Leave Balances updated successfully"); } else { BLL.ShowMessage(this, "Leave Balances not updated"); } DataTable dt = BLL.get_EmpLOB(Convert.ToInt32(Session["ORG_ID"]), Convert.ToInt32(rcmb_BUID.SelectedItem.Value), Convert.ToInt32(rcmb_Period.SelectedItem.Value), Convert.ToInt32(rcmbLeaveStruct.SelectedValue)); Rg_Details.DataSource = dt; Rg_Details.DataBind(); rmpLOB.SelectedIndex = 0; } catch (Exception ex) { SMHR.BLL.Error_Log(Session["USER_ID"].ToString(), ex.TargetSite.ToString(), ex.Message.Replace("'", "''"), "frm_leaveopeningbalances", ex.StackTrace, DateTime.Now); Response.Redirect("~/Frm_ErrorPage.aspx"); return; } }
//protected void btn_Save_Click(object sender, EventArgs e) //{ // try // { // SMHR_LOB _obj_smhr_lob = new SMHR_LOB(); // btn_Finalise.Enabled = true; // StringBuilder strQry = new StringBuilder(); // for (int i = 0; i < Rg_Details.Items.Count; i++) // { // _obj_smhr_lob.LOB_EMPID = null; // for (int j = 0; j < Rg_Details.MasterTableView.AutoGeneratedColumns.Count() - 4; j++) // { // //strQry.Append("EXEC USP_SMHR_LEAVEOPENINGBALANCES "); // _obj_smhr_lob.LT_EMPID = Convert.ToInt32(Rg_Details.Items[i]["EMP_ID"].Text); // string LT = Convert.ToString(Rg_Details.MasterTableView.AutoGeneratedColumns[j + 4].UniqueName); // string[] T = LT.Split(new char[] { '-' }); // _obj_smhr_lob.LT_PERIOD = Convert.ToInt32(rcmb_Period.SelectedItem.Value); // _obj_smhr_lob.LT_LEAVETYPEID = Convert.ToInt32(T[0]); // _obj_smhr_lob.OPERATION = operation.Check1; // // _obj_smhr_lob.OPERATION = operation.Check; // DataTable dt_Check1 = BLL.get_UpdateEmpLOB(_obj_smhr_lob); // //if (dt_Check1.Rows.Count != 0) // //{ // strQry.Append("EXEC USP_SMHR_LEAVEOPENINGBALANCES "); // _obj_smhr_lob.LT_CURRENTBALANCE = Convert.ToDouble(Rg_Details.Items[i][LT].Text); // _obj_smhr_lob.OPERATION = operation.Update; // string str = "@Operation = 'Update'" + // ",@LT_EMPID = '" + _obj_smhr_lob.LT_EMPID + "'" + // ",@LT_PERIOD='" + _obj_smhr_lob.LT_PERIOD + "'" + // ",@LT_LEAVETYPEID = '" + _obj_smhr_lob.LT_LEAVETYPEID + "'" + // ",@LT_CURRENTBALANCE='" + _obj_smhr_lob.LT_CURRENTBALANCE + "'"; // strQry.Append(str); // //bool rs = BLL.set_EMpLOB(_obj_smhr_lob, strQry.ToString()); // //if (rs == true) // // BLL.ShowMessage(this, "Leave Opening Balances updated Successfully"); // //else // // BLL.ShowMessage(this, "Error found"); // //getData(); // //Rg_Details.DataBind(); // //btn_Finalise.Visible = true; // //btn_Save.Enabled = false; // //btn_Update.Enabled = false; // //} // // commneted by aravinda // //else // //{ // // _obj_smhr_lob.LT_LOB = 0; // // _obj_smhr_lob.LT_LEAVEENTITLED = Convert.ToInt32(Rg_Details.Items[i][LT].Text); // // _obj_smhr_lob.LT_CURRENTBALANCE = Convert.ToInt32(Rg_Details.Items[i][LT].Text); // // _obj_smhr_lob.OPERATION = operation.Insert; // // string str = "@Operation = 'Insert'" + // // ",@LT_EMPID = '" + _obj_smhr_lob.LT_EMPID + "'" + // // ",@LT_PERIOD='" + _obj_smhr_lob.LT_PERIOD + "'" + // // ",@LT_LEAVETYPEID = '" + _obj_smhr_lob.LT_LEAVETYPEID + "'" + // // ",@LT_LOB='" + _obj_smhr_lob.LT_LOB + "'" + // // ",@LT_LEAVEENTITLED = '" + _obj_smhr_lob.LT_LEAVEENTITLED + "'" + // // ",@LT_CURRENTBALANCE='" + _obj_smhr_lob.LT_CURRENTBALANCE + "'"; // // strQry.Append(str); // //}// commneted by aravinda till here // } // } // _obj_smhr_lob.OPERATION = operation.Update; // bool rs = BLL.set_EMpLOB(_obj_smhr_lob, strQry.ToString()); // if (rs == true) // BLL.ShowMessage(this, "Leave Opening Balances Inserted Successfully"); // else // BLL.ShowMessage(this, "Error found"); // getData(); // Rg_Details.DataBind(); // btn_Finalise.Visible = true; // //btn_Save.Visible = false; // //Rg_Details.Visible = false; // //LoadCombos(); // //LoadPeriods(); // //loadLeaveStruct(); // } // catch (Exception ex) // { // SMHR.BLL.Error_Log(Session["USER_ID"].ToString(), ex.TargetSite.ToString(), ex.Message.Replace("'", "''"), "frm_leaveopeningbalances", ex.StackTrace, DateTime.Now); // Response.Redirect("~/Frm_ErrorPage.aspx"); // return; // } //} protected void btn_Finalise_Click(object sender, EventArgs e) { try { SMHR_LOB _obj_smhr_lob = new SMHR_LOB(); btn_Finalise.Enabled = true; for (int i = 0; i < Rg_Details.Items.Count; i++) { _obj_smhr_lob.LOB_EMPID = null; for (int j = 0; j < Rg_Details.MasterTableView.AutoGeneratedColumns.Count() - 4; j++) { strQry.Append("EXEC USP_SMHR_LEAVEOPENINGBALANCES "); _obj_smhr_lob.LOB_EMPID = Convert.ToInt32(Rg_Details.Items[i]["EMP_ID"].Text); string LT = Convert.ToString(Rg_Details.MasterTableView.AutoGeneratedColumns[j + 4].UniqueName); //string[] T = LT.Split(new char[] { '-' }); //TO GET LEAVE TYPE ID _obj_smhr_lob.LT_LEAVECODE = Convert.ToString(LT); _obj_smhr_lob.ORGANISATION_ID = Convert.ToInt32(Session["ORG_ID"]); _obj_smhr_lob.OPERATION = operation.Empty1; DataTable dt_id = BLL.get_UpdateEmpLOB(_obj_smhr_lob); if (dt_id.Rows.Count > 0) { int ID = Convert.ToInt32(dt_id.Rows[0]["LEAVEMASTER_ID"]); _obj_smhr_lob.LT_PERIOD = Convert.ToInt32(rcmb_Period.SelectedItem.Value); //_obj_smhr_lob.LT_LEAVETYPEID = Convert.ToInt32(T[0]); _obj_smhr_lob.LT_LEAVETYPEID = Convert.ToInt32(ID); _obj_smhr_lob.LT_LOB = 0; if ((Rg_Details.Items[i][LT].Text == " ")) { _obj_smhr_lob.LT_LEAVEENTITLED = Convert.ToDouble(0.00); _obj_smhr_lob.LT_CURRENTBALANCE = Convert.ToDouble(0.00); } else if (Rg_Details.Items[i][LT].Text == string.Empty) { _obj_smhr_lob.LT_LEAVEENTITLED = Convert.ToDouble(0.00); _obj_smhr_lob.LT_CURRENTBALANCE = Convert.ToDouble(0.00); } else { _obj_smhr_lob.LT_LEAVEENTITLED = Convert.ToDouble(Rg_Details.Items[i][LT].Text); _obj_smhr_lob.LT_CURRENTBALANCE = Convert.ToDouble(Rg_Details.Items[i][LT].Text); } _obj_smhr_lob.OPERATION = operation.Insert; string str = "@Operation = 'UPDATE'" + ",@LT_EMPID = '" + _obj_smhr_lob.LOB_EMPID + "'" + ",@LT_PERIOD='" + _obj_smhr_lob.LT_PERIOD + "'" + //",@LT_LEAVETYPEID = '" + _obj_smhr_lob.LT_LEAVETYPEID + "'" + //",@LT_LOB='" + _obj_smhr_lob.LT_LOB + "'" + //",@LT_LEAVEENTITLED = '" + _obj_smhr_lob.LT_LEAVEENTITLED + "'" + ",@LT_CURRENTBALANCE='" + _obj_smhr_lob.LT_CURRENTBALANCE + "'"; strQry.Append(str); } } } bool rs = BLL.set_EMpLOB(_obj_smhr_lob, strQry.ToString()); if (rs == true) { BLL.ShowMessage(this, "Leave Opening Balances finalised Successfully"); // btn_Finalise.Enabled = false; //Rg_Details.Enabled = false; btn_Finalise.Visible = false; Rg_Details.Visible = false; btn_Cancel.Visible = false; LoadCombos(); LoadPeriods(); loadLeaveStruct(); ViewState["DataTable"] = null; return; } else { BLL.ShowMessage(this, "Error found"); } return; } catch (Exception ex) { SMHR.BLL.Error_Log(Session["USER_ID"].ToString(), ex.TargetSite.ToString(), ex.Message.Replace("'", "''"), "frm_leaveopeningbalances", ex.StackTrace, DateTime.Now); Response.Redirect("~/Frm_ErrorPage.aspx"); return; } }