private void GetSalaryIncrementLog() { DESIGNATION_BLL objDeg_BLL = new DESIGNATION_BLL(); SalaryIncrementBLL _salaryIncrementBll = new SalaryIncrementBLL(); try { string OCODE = ((SessionUser)Session["SessionUser"]).OCode; List <HRM_SalaryIncrement> salaryIncrements = _salaryIncrementBll.GetSalaryIncrementLog(OCODE); DateTime serverDate = _salaryIncrementBll.GetServerDate(); List <HRM_PersonalInformations> personalInfoes = _salaryIncrementBll.GetAllEmployess(OCODE); List <HRM_DESIGNATIONS> designationes = _salaryIncrementBll.GetAllDesgination(OCODE); List <SalaryIncrementR> slaryIncrementRes = new List <SalaryIncrementR>(); foreach (HRM_SalaryIncrement aitem in salaryIncrements) { if (serverDate >= aitem.EffectiveDate) { SalaryIncrementR _salaryIncrementR = new SalaryIncrementR(); int? desId = personalInfoes.Where(x => x.EID == aitem.EID).FirstOrDefault().DesginationId; string desName = designationes.Where(x => x.DEG_ID == desId).FirstOrDefault().DEG_NAME; string grade = designationes.Where(x => x.DEG_ID == desId).FirstOrDefault().GRADE; decimal?Gosssalary = aitem.IncrementSalary; //designationes.Where(x => x.DEG_ID == desId).FirstOrDefault().GROSS_SAL; bool Status = CheckDesignation(desName, grade, Gosssalary); if (Status == false) { InsertDesgination(desName, grade, Gosssalary); } HRM_DESIGNATIONS _Desobj = objDeg_BLL.GetDesignationIdByDesNameGradAndGoss(desName, grade, Gosssalary); if (_Desobj != null) { _salaryIncrementR.Eid = aitem.EID; _salaryIncrementR.IncrementDate = aitem.IncrementDate; _salaryIncrementR.Grade = grade; _salaryIncrementR.SalaryIncrementStatus = "Salary Increment"; _salaryIncrementR.EffectiveDate = aitem.EffectiveDate; _salaryIncrementR.previousSalary = aitem.previousSalary; _salaryIncrementR.Slary = Convert.ToDecimal(aitem.IncrementSalary); _salaryIncrementR.DesId = _Desobj.DEG_ID; _salaryIncrementR.Ocode = ((SessionUser)Session["SessionUser"]).OCode; _salaryIncrementR.EDIT_USER = ((SessionUser)Session["SessionUser"]).UserId; _salaryIncrementR.EDIT_DATE = DateTime.Now; slaryIncrementRes.Add(_salaryIncrementR); } } } if (slaryIncrementRes.Count > 0) { int result = _salaryIncrementBll.AutomaticSalaryUpdate(slaryIncrementRes); } } catch (Exception ex) { ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('" + ex.Message + "')", true); } }
private bool CheckDesignation(string Desgination, string Grad, decimal?Gosssalary) { bool Status = false; try { SalaryIncrementBLL _salaryIncrementBll = new SalaryIncrementBLL(); Status = _salaryIncrementBll.CheckDesignation(Desgination, Grad, Gosssalary); return(Status); } catch (Exception ex) { } return(Status); }
private bool CheckDesignation(string Desgination, string Grad, decimal?Gosssalary) { bool Status = false; try { SalaryIncrementBLL _salaryIncrementBll = new SalaryIncrementBLL(); Status = _salaryIncrementBll.CheckDesignation(Desgination, Grad, Gosssalary); return(Status); } catch (Exception ex) { string EID = Convert.ToString(((SessionUser)Session["SessionUser"]).EID); //LogController<Salary_Update>.SetLog(ex, EID); ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('" + ex.Message + "')", true); } return(Status); }
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); } }
//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); } }