internal int UpdateIncrementSalary(HRM_SalaryIncrement objEmp) { try { //HRM_TemporySalaryIncrement obj = _context.HRM_TemporySalaryIncrement.First(x => x.EID == objEmp.EID); //obj.CurrentSalary = objEmp.CurrentSalary; //obj.OldSalary = objEmp.OldSalary; //obj.IncrementRate = objEmp.IncrementRate; //obj.UpdateBy = objEmp.UpdateBy; //obj.OCODE = objEmp.OCODE; //obj.EDIT_USER = objEmp.EDIT_USER; //obj.EDIT_DATE = objEmp.EDIT_DATE; //obj.IncrementDate = objEmp.IncrementDate; //_context.HRM_SalaryIncrement.AddObject(objEmp); //_context.SaveChanges(); //HRM_PersonalInformations obj1 = _context.HRM_PersonalInformations.First(x => x.EID == objEmp.EID); //obj1.Salary = objEmp.CurrentSalary; //obj1.OldSalary = objEmp.OldSalary; //obj1.GrossRate = objEmp.IncrementRate; //obj1.SalaryUpdateDate = objEmp.IncrementDate; //_context.SaveChanges(); return(1); } catch (Exception) { throw; } }
private void UpdateSlaryIncrementLog(SalaryIncrementR aitem) { try { HRM_SalaryIncrement _salaryIncrementLog = _context.HRM_SalaryIncrement.Where(x => x.EID == aitem.Eid && x.ApprovedStatus == false).FirstOrDefault(); _salaryIncrementLog.ApprovedStatus = true; _context.SaveChanges(); } catch (Exception) { throw; } }
internal int DeleteSalryIncrementLog(string E_ID) { try { HRM_SalaryIncrement _SalaryIncrement = _context.HRM_SalaryIncrement.Where(x => x.EID == E_ID).FirstOrDefault(); _context.HRM_SalaryIncrement.Attach(_SalaryIncrement); _context.HRM_SalaryIncrement.DeleteObject(_SalaryIncrement); _context.SaveChanges(); return(1); } catch (Exception ex) { throw ex; } }
protected void btnConformation_Click(object sender, EventArgs e) { try { List <HRM_SalaryIncrement> EMP_LIST = new List <HRM_SalaryIncrement>(); foreach (GridViewRow gvRow in gridviewTemployeData.Rows) { HRM_SalaryIncrement objEmp = new HRM_SalaryIncrement(); Label lblEID = ((Label)gvRow.FindControl("lblEID")); //eid = lblEID.Text; Label oldSalary = ((Label)gvRow.FindControl("lblOldSalary")); Label currentSalary = ((Label)gvRow.FindControl("CurrentSalary")); Label IncrementAmount = ((Label)gvRow.FindControl("IncrementAmount")); objEmp.EID = lblEID.Text; // objEmp.CurrentSalary = Convert.ToDecimal(currentSalary.Text); objEmp.IncrementDate = DateTime.Now; // objEmp.IncrementRate = Convert.ToDecimal(IncrementAmount.Text); // objEmp.OldSalary = Convert.ToDecimal(oldSalary.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 = 0;//objIncrementBll.SaveSalaryEmployeeInfoinHRM_SalaryIncrement(EMP_LIST); if (result == 1) { int result1 = objIncrementBll.DeleteTemporyTableInfo(EMP_LIST); //lblStatus.Text = "Data Save Successfully."; ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('Data Save Successfully')", true); //LoadEmpGrid(); LoadIncrementDetails(); } } catch (Exception ex) { ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('" + ex.Message + "')", true); } }
protected void imgbtnEdit_Click(object sender, EventArgs e) { ImageButton imgbtn = (ImageButton)sender; GridViewRow row = (GridViewRow)imgbtn.NamingContainer; try { Label lblEID = ((Label)gridviewTemployeData.Rows[row.RowIndex].FindControl("lblEID")); Label oldSalary = ((Label)gridviewTemployeData.Rows[row.RowIndex].FindControl("lblOldSalary")); TextBox txtbxIncrementAmount = (TextBox)gridviewTemployeData.Rows[row.RowIndex].FindControl("txtbxIncrementAmount"); HRM_SalaryIncrement objEmp = new HRM_SalaryIncrement(); if (txtbxIncrementAmount != null) { decimal incrementAmount = Convert.ToDecimal(txtbxIncrementAmount.Text); decimal olSalary = Convert.ToDecimal(oldSalary.Text); decimal CurrentSalary = incrementAmount + olSalary; objEmp.EID = lblEID.Text; //objEmp.CurrentSalary = CurrentSalary; objEmp.IncrementDate = DateTime.Now; // objEmp.IncrementRate = incrementAmount; // objEmp.OldSalary = olSalary; // 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; int result = objIncrementBll.UpdateIncrementSalary(objEmp); if (result == 1) { //lblStatus.Text = "Data Update Successfully."; ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('Data Update Successfully')", true); objIncrementBll.DeleteSlaryIncrementTemporyInfoByEmployeId(objEmp.EID, objEmp.OCODE); //LoadEmpGrid(); LoadIncrementDetails(); } } } catch (Exception ex) { ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('" + ex.Message + "')", true); } }
internal int UpDateSalryIncrementLog(List <HRM_SalaryIncrement> SalaryIncrements, string EID, DateTime ExistEffictiveDate) { try { foreach (HRM_SalaryIncrement aitem in SalaryIncrements) { HRM_SalaryIncrement _SalaryIncrement = _context.HRM_SalaryIncrement.Where(x => (x.EID == EID) && (x.EffectiveDate == ExistEffictiveDate)).FirstOrDefault(); _SalaryIncrement.previousSalary = aitem.previousSalary; _SalaryIncrement.IncrementSalary = aitem.IncrementSalary; _SalaryIncrement.IncrementDate = aitem.IncrementDate; _SalaryIncrement.ApprovedStatus = aitem.ApprovedStatus; _SalaryIncrement.OCODE = aitem.OCODE; _SalaryIncrement.EDIT_DATE = aitem.EDIT_DATE; _SalaryIncrement.EDIT_USER = aitem.EDIT_USER; _context.SaveChanges(); } return(1); } catch (Exception ex) { throw ex; } }
protected void btn_Confirm_Clcik(object sender, EventArgs e) { try { SalaryIncrementBLL _SalryIncrementBll = new SalaryIncrementBLL(); List <HRM_SalaryIncrement> SalaryIncrements = new List <HRM_SalaryIncrement>(); List <HRM_SalaryIncrement> SalaryIncrementList = new List <HRM_SalaryIncrement>(); //For Getting Date string E_ID = ""; if (chSalaryIncrementStatus.Checked == false) { foreach (GridViewRow gvRow in grdview.Rows) { CheckBox rowChkBox = ((CheckBox)gvRow.FindControl("rowLevelCheckBox")); HRM_SalaryIncrement _salaryincrement = new HRM_SalaryIncrement(); if (rowChkBox.Checked == true) { Label lblEID = ((Label)gvRow.FindControl("lblEID")); Label lblPreviusSalary = ((Label)gvRow.FindControl("lblPreviusSalry")); Label lblIncrementSlary = ((Label)gvRow.FindControl("lblIncrementSalary")); Label lblIncrementDate = ((Label)gvRow.FindControl("lblIncrementDate")); Label lblEffectiveDate = ((Label)gvRow.FindControl("lblEffectiveDate")); E_ID = lblEID.Text; _salaryincrement.EID = lblEID.Text; _salaryincrement.previousSalary = Convert.ToDecimal(lblPreviusSalary.Text); _salaryincrement.IncrementSalary = Convert.ToDecimal(lblIncrementSlary.Text); _salaryincrement.IncrementDate = Convert.ToDateTime(lblIncrementDate.Text); _salaryincrement.EffectiveDate = Convert.ToDateTime(lblEffectiveDate.Text); _salaryincrement.ApprovedStatus = false; _salaryincrement.OCODE = ((SessionUser)Session["SessionUser"]).OCode; _salaryincrement.EDIT_DATE = DateTime.Now; _salaryincrement.EDIT_USER = ((SessionUser)Session["SessionUser"]).UserId; SalaryIncrements.Add(_salaryincrement); } } #region MyRegion if (SalaryIncrements.Count > 0) { DateTime ExistEffictiveDate = Convert.ToDateTime(txtbxEffectiveDate.Text); SalaryIncrementList = _SalryIncrementBll.Get_SalryIncrementByEID_Date(E_ID, ExistEffictiveDate); if (SalaryIncrementList.Count > 0) { int result = _SalryIncrementBll.UpDateSalryIncrementLog(SalaryIncrements, E_ID, ExistEffictiveDate); if (result == 1) { GetSalaryIncrementLog(); ClearUI(); drpEntryType.SelectedValue = drpEntryType.SelectedValue.ToString(); ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('Data Update Successfully')", true); } } else { int result = _SalryIncrementBll.InsertSalryIncrementLog(SalaryIncrements); if (result == 1) { GetSalaryIncrementLog(); ClearUI(); drpEntryType.SelectedValue = drpEntryType.SelectedValue.ToString(); ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('Data Process Successfully')", true); txtbxEID.Focus(); } } } else { ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('No Employee selected in the list!')", true); } #endregion } else { foreach (GridViewRow gvRow in grdviewIndivitual.Rows) { HRM_SalaryIncrement _salaryincrement = new HRM_SalaryIncrement(); Label lblEID = ((Label)gvRow.FindControl("lblEID")); Label lblPreviusSalary = ((Label)gvRow.FindControl("lblPreviusSalry")); Label lblIncrementSlary = ((Label)gvRow.FindControl("lblIncrementSalary")); Label lblIncrementDate = ((Label)gvRow.FindControl("lblIncrementDate")); Label lblEffectiveDate = ((Label)gvRow.FindControl("lblEffectiveDate")); E_ID = lblEID.Text; _salaryincrement.EID = lblEID.Text; _salaryincrement.previousSalary = Convert.ToDecimal(lblPreviusSalary.Text); _salaryincrement.IncrementSalary = Convert.ToDecimal(lblIncrementSlary.Text); _salaryincrement.IncrementDate = Convert.ToDateTime(lblIncrementDate.Text); _salaryincrement.EffectiveDate = Convert.ToDateTime(lblEffectiveDate.Text); _salaryincrement.ApprovedStatus = false; _salaryincrement.OCODE = ((SessionUser)Session["SessionUser"]).OCode; _salaryincrement.EDIT_DATE = DateTime.Now; _salaryincrement.EDIT_USER = ((SessionUser)Session["SessionUser"]).UserId; SalaryIncrements.Add(_salaryincrement); #region MyRegion if (SalaryIncrements.Count > 0) { DateTime ExistEffictiveDate = Convert.ToDateTime(txtbxEffectiveDate.Text); SalaryIncrementList = _SalryIncrementBll.Get_SalryIncrementByEID_Date(E_ID, ExistEffictiveDate); if (SalaryIncrementList.Count > 0) { int result = _SalryIncrementBll.UpDateSalryIncrementLog(SalaryIncrements, E_ID, ExistEffictiveDate); if (result == 1) { GetSalaryIncrementLog(); ClearUI(); drpEntryType.SelectedValue = drpEntryType.SelectedValue.ToString(); ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('Data Update Successfully')", true); //txtbxEID.Focus(); } } else { int result = _SalryIncrementBll.InsertSalryIncrementLog(SalaryIncrements); if (result == 1) { GetSalaryIncrementLog(); ClearUI(); drpEntryType.SelectedValue = drpEntryType.SelectedValue.ToString(); ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('Data Process Successfully')", true); txtbxEID.Focus(); } } } else { ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('No Employee selected in the list!')", true); } #endregion } } } catch (Exception ex) { ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('" + ex.Message + "')", true); } }
internal int SaveIncremntTemp(HRM_SalaryIncrement objEmp) { return(objIncrementDal.SaveIncremntTemp(objEmp)); }
internal int UpdateIncrementSalary(HRM_SalaryIncrement objEmp) { return(objIncrementDal.UpdateIncrementSalary(objEmp)); }
//protected void btnProcess_Click(object sender, EventArgs e) //{ // try // { // if (chSalaryIncrementStatus.Checked) // individual process // { // Attendance_BLL _attendancebll = new Attendance_BLL(); // string eid = txtbxEID.Text.Trim(); // List<HRM_EMPLOYEES_VIEWER> employess = _attendancebll.GetEmployeesByE_id(eid, Convert.ToDateTime(txtbxEffectiveDate.Text)); // if (employess.Count > 0) // { // if (chSalaryIncrementStatus.Checked) // { // grdviewIndivitual.DataSource = employess; // grdviewIndivitual.DataBind(); // } // else // { // grdview.DataSource = employess; // grdview.DataBind(); // } // } // } // else //dept/section/subsection wise process // { // if (ddlRegion1.SelectedItem.ToString() == "--Select--") // { // ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('Select Region!')", true); // return; // } // else if (ddlOffice1.SelectedItem.ToString() == "--Select--") // { // ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('Select Office!')", true); // return; // } // else if (ddlDept1.SelectedItem.ToString() == "--Select--") // { // ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('Select Department!')", true); // return; // } // else if (txtbxEffectiveDate.Text == "") // { // ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('Select Effective Date!')", true); // return; // } // else // { // try // { // Attendance_BLL _attendancebll = new Attendance_BLL(); // if (ddlSubSections.SelectedValue.ToString() == "" || ddlSubSections.SelectedValue.ToString() == "0" || ddlSection.SelectedValue.ToString() == "" || ddlSection.SelectedValue.ToString() == "0") // { // int RegionId = Convert.ToInt32(ddlRegion1.SelectedValue); // int OfficeId = Convert.ToInt32(ddlOffice1.SelectedValue); // int DeptId = Convert.ToInt32(ddlDept1.SelectedValue); // List<HRM_EMPLOYEES_VIEWER> employess = _attendancebll.GetEmployeeByDepartment(RegionId, OfficeId, DeptId, Convert.ToDateTime(txtbxEffectiveDate.Text)); // if (employess.Count > 0) // { // if (chSalaryIncrementStatus.Checked) // { // grdviewIndivitual.DataSource = employess; // grdviewIndivitual.DataBind(); // } // else // { // grdview.DataSource = employess; // grdview.DataBind(); // } // } // } // else // { // int ResionId = Convert.ToInt32(ddlRegion1.SelectedValue); // int OfficeId = Convert.ToInt32(ddlOffice1.SelectedValue); // int DeptId = Convert.ToInt32(ddlDept1.SelectedValue); // int sction = Convert.ToInt32(ddlSection.SelectedValue); // int subsction = Convert.ToInt32(ddlSubSections.SelectedValue); // List<HRM_EMPLOYEES_VIEWER> employess = _attendancebll.GetEmployeeBySubsectionWise(ResionId, OfficeId, DeptId, sction, subsction, Convert.ToDateTime(txtbxEffectiveDate.Text)); // if (employess.Count > 0) // { // if (chSalaryIncrementStatus.Checked) // { // grdviewIndivitual.DataSource = employess; // grdviewIndivitual.DataBind(); // } // else // { // grdview.DataSource = employess; // grdview.DataBind(); // } // } // } // } // catch (Exception ex) // { // ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('" + ex.Message + "')", true); // } // } // } // } // catch (Exception ex) // { // string EID = Convert.ToString(((SessionUser)Session["SessionUser"]).EID); // LogController<SalaryIncrementList>.SetLog(ex, EID); // ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('" + ex.Message + "')", true); // } //} protected void btnConfirm_Click(object sender, EventArgs e) { try { SalaryIncrementBLL _SalryIncrementBll = new SalaryIncrementBLL(); List <HRM_SalaryIncrement> SalaryIncrements = new List <HRM_SalaryIncrement>(); List <HRM_SalaryIncrement> SalaryIncrementList = new List <HRM_SalaryIncrement>(); //For Getting Date string E_ID = ""; //string EID = ""; int I_D = 0; if (chSalaryIncrementStatus.Checked == false) //individual { foreach (GridViewRow gvRow in grdview.Rows) { //string E_ID = ""; CheckBox rowChkBox = ((CheckBox)gvRow.FindControl("rowLevelCheckBox")); HRM_SalaryIncrement _salaryincrement = new HRM_SalaryIncrement(); if (rowChkBox.Checked == true) { Label lblEID = ((Label)gvRow.FindControl("lblEID")); //Label lblID = ((Label)gvRow.FindControl("lblID")); //Label lblPreviusSalary = ((Label)gvRow.FindControl("lblPreviusSalry")); //Label lblIncrementSlary = ((Label)gvRow.FindControl("lblIncrementSalary")); //Label lblIncrementDate = ((Label)gvRow.FindControl("lblIncrementDate")); //Label lblEffectiveDate = ((Label)gvRow.FindControl("lblEffectiveDate")); //I_D = Convert.ToInt32(lblID); E_ID = lblEID.Text; ////_salaryincrement.ID = Convert.ToInt32(lblID); _salaryincrement.EID = lblEID.Text; //_salaryincrement.previousSalary = Convert.ToDecimal(lblPreviusSalary.Text); //_salaryincrement.IncrementSalary = Convert.ToDecimal(lblIncrementSlary.Text); //_salaryincrement.IncrementDate = Convert.ToDateTime(lblIncrementDate.Text); //_salaryincrement.EffectiveDate = Convert.ToDateTime(lblEffectiveDate.Text); //_salaryincrement.ApprovedStatus = false; //_salaryincrement.OCODE = ((SessionUser)Session["SessionUser"]).OCode; //_salaryincrement.EDIT_DATE = DateTime.Now; //_salaryincrement.EDIT_USER = ((SessionUser)Session["SessionUser"]).UserId; SalaryIncrements.Add(_salaryincrement); } #region MyRegion if (SalaryIncrements.Count > 0) { //int result = _SalryIncrementBll.DeleteSalryIncrementLog(SalaryIncrements, E_ID); int result = _SalryIncrementBll.DeleteSalryIncrementLog(E_ID); if (result == 1) { GetSalaryIncrementLog(); ClearUI(); ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('Data Process Successfully')", true); txtbxEID.Focus(); } } else { ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('Data Delete Successfully!')", true); } #endregion } } else // dpt/section/subsection wise process { foreach (GridViewRow gvRow in grdviewIndivitual.Rows) { //string E_ID = ""; HRM_SalaryIncrement _salaryincrement = new HRM_SalaryIncrement(); Label lblEID = ((Label)gvRow.FindControl("lblEID")); Label lblPreviusSalary = ((Label)gvRow.FindControl("lblPreviusSalry")); Label lblIncrementSlary = ((Label)gvRow.FindControl("lblIncrementSalary")); Label lblIncrementDate = ((Label)gvRow.FindControl("lblIncrementDate")); Label lblEffectiveDate = ((Label)gvRow.FindControl("lblEffectiveDate")); E_ID = lblEID.Text; _salaryincrement.EID = lblEID.Text; _salaryincrement.previousSalary = Convert.ToDecimal(lblPreviusSalary.Text); _salaryincrement.IncrementSalary = Convert.ToDecimal(lblIncrementSlary.Text); _salaryincrement.IncrementDate = Convert.ToDateTime(lblIncrementDate.Text); _salaryincrement.EffectiveDate = Convert.ToDateTime(lblEffectiveDate.Text); _salaryincrement.ApprovedStatus = false; _salaryincrement.OCODE = ((SessionUser)Session["SessionUser"]).OCode; _salaryincrement.EDIT_DATE = DateTime.Now; _salaryincrement.EDIT_USER = ((SessionUser)Session["SessionUser"]).UserId; SalaryIncrements.Add(_salaryincrement); #region MyRegion if (SalaryIncrements.Count > 0) { int result = _SalryIncrementBll.DeleteSalryIncrementLog(E_ID); if (result == 1) { GetSalaryIncrementLog(); ClearUI(); ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('Data Process Successfully')", true); txtbxEID.Focus(); } } else { ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('Data Delete Successfully!')", true); } #endregion } } btnConfirm.Visible = false; } catch (Exception ex) { string EID = Convert.ToString(((SessionUser)Session["SessionUser"]).EID); //LogController<SalaryIncrementList>.SetLog(ex, EID); ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('" + ex.Message + "')", true); } }
internal int SaveIncremntTemp(HRM_SalaryIncrement objEmp) { _context.HRM_SalaryIncrement.AddObject(objEmp); _context.SaveChanges(); return(1); }