internal int DeleteTemporyTableInfo(List <HRM_SalaryIncrement> EMP_LIST) { foreach (HRM_SalaryIncrement aitem in EMP_LIST) { HRM_TemporySalaryIncrement objex = _context.HRM_TemporySalaryIncrement.First(x => x.EID == aitem.EID); _context.HRM_TemporySalaryIncrement.DeleteObject(objex); _context.SaveChanges(); } _context.SaveChanges(); return(1); }
internal int DeleteSlaryIncrementTemporyInfoByEmployeId(string eid, string OCODE) { try { HRM_TemporySalaryIncrement objex = _context.HRM_TemporySalaryIncrement.First(x => x.EID == eid); _context.HRM_TemporySalaryIncrement.DeleteObject(objex); _context.SaveChanges(); return(1); } catch (Exception) { throw; } }
protected void btnSave_Click(object sender, EventArgs e) { try { if (txtGross.Text == "" && txtbxGrossAmount.Text == "") { //lblStatus.Text = "Input Gross % or Gross Amount"; ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('Input Gross % or Gross Amount')", true); } else { decimal updatedSalary; decimal grossPercent; List <HRM_TemporySalaryIncrement> EMP_LIST = new List <HRM_TemporySalaryIncrement>(); //CheckBox headerChkBox = ((CheckBox)grdemployees.HeaderRow.FindControl("headerLevelCheckBox")); //if (headerChkBox.Checked == true) //{ // foreach (GridViewRow gvRow in grdemployees.Rows) // { // HRM_TemporySalaryIncrement objEmp = new HRM_TemporySalaryIncrement(); // CheckBox rowChkBox = ((CheckBox)gvRow.FindControl("rowLevelCheckBox")); // Label lblEID = ((Label)gvRow.FindControl("lblEID")); // //eid = lblEID.Text; // Label currentSalary = ((Label)gvRow.FindControl("lblSalary")); // if (txtGross.Text != "") // { // grossPercent = Convert.ToDecimal(txtGross.Text); // decimal calculateSalary = (Convert.ToDecimal(currentSalary.Text) * grossPercent) / 100; // grossPercent = calculateSalary; // updatedSalary = grossPercent + Convert.ToDecimal(currentSalary.Text); // } // else // { // grossPercent = Convert.ToDecimal(txtbxGrossAmount.Text); // updatedSalary = grossPercent + Convert.ToDecimal(currentSalary.Text); // } // objEmp.EID = lblEID.Text; // objEmp.CurrentSalary = updatedSalary; // objEmp.IncrementDate = DateTime.Now; // objEmp.IncrementRate = Convert.ToDecimal(grossPercent); // objEmp.OldSalary = Convert.ToDecimal(currentSalary.Text); // objEmp.UpdateBy = Convert.ToString(((SessionUser)Session["SessionUser"]).EID); // objEmp.EDIT_USER = ((SessionUser)Session["SessionUser"]).UserId; // objEmp.EDIT_DATE = DateTime.Now; // objEmp.OCODE = ((SessionUser)Session["SessionUser"]).OCode; // EMP_LIST.Add(objEmp); // rowChkBox.Checked = true;//((CheckBox)sender).Checked; // } //} //else //{ foreach (GridViewRow gvRow in grdemployees.Rows) { CheckBox rowChkBox = ((CheckBox)gvRow.FindControl("rowLevelCheckBox")); if (rowChkBox.Checked == true) { HRM_TemporySalaryIncrement objEmp = new HRM_TemporySalaryIncrement(); Label lblEID = ((Label)gvRow.FindControl("lblEID")); //eid = lblEID.Text; Label currentSalary = ((Label)gvRow.FindControl("lblSalary")); if (txtGross.Text != "") { grossPercent = Convert.ToDecimal(txtGross.Text); decimal calculateSalary = (Convert.ToDecimal(currentSalary.Text) * grossPercent) / 100; grossPercent = calculateSalary; updatedSalary = grossPercent + Convert.ToDecimal(currentSalary.Text); } else { grossPercent = Convert.ToDecimal(txtbxGrossAmount.Text); updatedSalary = grossPercent + Convert.ToDecimal(currentSalary.Text); } objEmp.EID = lblEID.Text; objEmp.CurrentSalary = updatedSalary; objEmp.IncrementDate = DateTime.Now; objEmp.IncrementRate = Convert.ToDecimal(grossPercent); objEmp.OldSalary = Convert.ToDecimal(currentSalary.Text); objEmp.UpdateBy = Convert.ToString(((SessionUser)Session["SessionUser"]).EID); objEmp.EDIT_USER = ((SessionUser)Session["SessionUser"]).UserId; objEmp.EDIT_DATE = DateTime.Now; objEmp.OCODE = ((SessionUser)Session["SessionUser"]).OCode; EMP_LIST.Add(objEmp); } } int result = objIncrementBll.SaveIncremntTemp(EMP_LIST); if (result == 1) { //lblStatus.Text = "Data Update Successfully."; ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('Data Update Successfully')", true); //LoadEmpGrid(); LoadIncrementDetails(); } } } catch (Exception ex) { ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('" + ex.Message + "')", true); } }