private void InsertDesgination(string desName, string grade, decimal?Gosssalary)
        {
            try
            {
                DESIGNATION_BLL objDeg_BLL   = new DESIGNATION_BLL();
                double          gross_Salary = Convert.ToDouble(Gosssalary);

                double medical = 250;

                double taransport     = 200;
                double food           = 650;
                double withoutMedical = (gross_Salary - (medical + taransport + food));
                double Basic          = (withoutMedical) / 1.4;
                double houseRent      = (Basic * 40) / 100;

                HRM_DESIGNATIONS designationObj = new HRM_DESIGNATIONS();
                designationObj.DEG_NAME   = desName.ToString();
                designationObj.GRADE      = grade;
                designationObj.GROSS_SAL  = Convert.ToDecimal(gross_Salary);
                designationObj.HOUSE_RENT = Convert.ToDecimal(houseRent);
                designationObj.BASIC      = Convert.ToDecimal(Basic);
                designationObj.MEDICAL    = Convert.ToDecimal(medical);
                designationObj.FOOD_ALLOW = Convert.ToDecimal(0.00);
                designationObj.CONVEYANCE = Convert.ToDecimal(0.00);
                designationObj.EDIT_USER  = ((SessionUser)Session["SessionUser"]).UserId;
                designationObj.EDIT_DATE  = DateTime.Now;
                designationObj.OCODE      = ((SessionUser)Session["SessionUser"]).OCode;

                int result = objDeg_BLL.InsertDeignation(designationObj);
            }
            catch (Exception ex)
            {
                ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('" + ex.Message + "')", true);
            }
        }
        private void InsertDesgination(string desName, string grade, decimal?Gosssalary)
        {
            try
            {
                DESIGNATION_BLL objDeg_BLL   = new DESIGNATION_BLL();
                decimal         gross_Salary = Convert.ToDecimal(Gosssalary);

                decimal medical = 200;

                decimal withoutMedical = (gross_Salary - medical);

                decimal houseRent = (withoutMedical * 44) / 100;

                decimal          Basic          = (withoutMedical * 56) / 100;
                HRM_DESIGNATIONS designationObj = new HRM_DESIGNATIONS();
                designationObj.DEG_NAME   = desName.ToString();
                designationObj.GRADE      = grade;
                designationObj.GROSS_SAL  = gross_Salary;
                designationObj.HOUSE_RENT = houseRent;
                designationObj.BASIC      = Basic;
                designationObj.MEDICAL    = medical;
                designationObj.FOOD_ALLOW = Convert.ToDecimal(0.00);
                designationObj.CONVEYANCE = Convert.ToDecimal(0.00);
                designationObj.EDIT_USER  = ((SessionUser)Session["SessionUser"]).UserId;
                designationObj.EDIT_DATE  = DateTime.Now;
                designationObj.OCODE      = ((SessionUser)Session["SessionUser"]).OCode;
                int result = objDeg_BLL.InsertDeignation(designationObj);
            }
            catch (Exception)
            {
                throw;
            }
        }
        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);
            }
        }
        protected void btnUpdate_click(object sender, EventArgs e)
        {
            try
            {
                DESIGNATION_BLL          objDeg_BLL   = new DESIGNATION_BLL();
                HRM_PersonalInformations personalInfo = new HRM_PersonalInformations();
                string EmployeeId = Convert.ToString(Session["EID"]);

                string grossSalary;
                personalInfo.Grade  = txtbxGarde.Text;
                grossSalary         = txtbxGrossSalary.Text.ToString();
                personalInfo.Salary = Convert.ToDecimal(grossSalary);

                string DesginationName = ddlDesignations.SelectedItem.Text.ToString();
                bool   Status          = CheckDesignation(DesginationName, Convert.ToString(personalInfo.Grade), Convert.ToDecimal(personalInfo.Salary));
                if (Status == false)
                {
                    //Change Logic Provide By MasumVai ----- Edited------- Kamruzzaman.
                    double gross_Salary   = Convert.ToDouble(personalInfo.Salary);
                    double medical        = 250;
                    double taransport     = 200;
                    double food           = 650;
                    double withoutMedical = (gross_Salary - (medical + taransport + food));
                    double Basic          = (withoutMedical) / 1.4;
                    double houseRent      = (Basic * 40) / 100;


                    HRM_DESIGNATIONS designationObj = new HRM_DESIGNATIONS();
                    designationObj.DEG_NAME   = ddlDesignations.SelectedItem.ToString();
                    designationObj.GRADE      = personalInfo.Grade;
                    designationObj.GROSS_SAL  = Convert.ToDecimal(gross_Salary);
                    designationObj.HOUSE_RENT = Convert.ToDecimal(houseRent);
                    designationObj.BASIC      = Convert.ToDecimal(Basic);
                    designationObj.MEDICAL    = Convert.ToDecimal(medical);
                    designationObj.CONVEYANCE = Convert.ToDecimal(taransport);
                    designationObj.FOOD_ALLOW = Convert.ToDecimal(food);

                    designationObj.EDIT_USER = ((SessionUser)Session["SessionUser"]).UserId;
                    designationObj.EDIT_DATE = DateTime.Now;
                    designationObj.OCODE     = ((SessionUser)Session["SessionUser"]).OCode;
                    int resultforDesgination = objDeg_BLL.InsertDeignation(designationObj);
                }

                HRM_DESIGNATIONS _Desobj = objDeg_BLL.GetDesignationId(DesginationName, Convert.ToString(personalInfo.Grade), Convert.ToDecimal(personalInfo.Salary));

                if (_Desobj != null)
                {
                    personalInfo.DesginationId = _Desobj.DEG_ID;
                    personalInfo.Grade         = _Desobj.GRADE;
                    personalInfo.Salary        = _Desobj.GROSS_SAL;

                    personalInfo.EmployeeType  = Convert.ToInt32(drpEmployeeType.SelectedValue);
                    personalInfo.EmpCategoryId = Convert.ToInt32(drpEmployeeCate.SelectedValue);
                    personalInfo.RegionsId     = Convert.ToInt32(drpRegion.SelectedValue);
                    personalInfo.OfficeId      = Convert.ToInt32(ddlOffice.SelectedValue);
                    personalInfo.DepartmentId  = Convert.ToInt32(ddlDepartment.SelectedValue);
                    personalInfo.SectionId     = Convert.ToInt32(ddlSection.SelectedValue);
                    personalInfo.SubSectionId  = Convert.ToInt32(ddlSubSections.SelectedValue);
                    //personalInfo.EffectiveSlary = Convert.ToDecimal(txtbxEffectiveSlary.Text);
                    personalInfo.EffectiveSlary = 0;
                    //personalInfo.DesginationId = Convert.ToInt32(ddlDesignations.SelectedValue);
                    personalInfo.ShiftCode = ddlShift.SelectedValue.ToString();

                    personalInfo.OTApplicable     = Convert.ToBoolean(drpdwnOTApplicable.SelectedValue);
                    personalInfo.Attendance_Bouns = Convert.ToBoolean(drpAttandenceApplicable.SelectedValue);

                    if (drpLateApplicable.SelectedValue == "0")
                    {
                        personalInfo.Late_Applicable = false;
                    }
                    else
                    {
                        personalInfo.Late_Applicable = Convert.ToBoolean(drpLateApplicable.SelectedValue);
                    }

                    if (drpAbsenceApplicable.SelectedValue == "0")
                    {
                        personalInfo.Absence_Applicable = false;
                    }
                    else
                    {
                        personalInfo.Absence_Applicable = Convert.ToBoolean(drpAbsenceApplicable.SelectedValue);
                    }

                    if (drpTaxApplicable.SelectedValue == "0")
                    {
                        personalInfo.Tax_Applicable = false;
                    }
                    else
                    {
                        personalInfo.Tax_Applicable = Convert.ToBoolean(drpTaxApplicable.SelectedValue);
                    }

                    if (drpPFApplicable.SelectedValue == "0")
                    {
                        personalInfo.PF_Applicable = false;
                    }
                    else
                    {
                        personalInfo.PF_Applicable = Convert.ToBoolean(drpPFApplicable.SelectedValue);
                    }

                    personalInfo.JoiningDate         = Convert.ToDateTime(txtbxJoingDate.Text);
                    personalInfo.ProbationPeriodFrom = Convert.ToDateTime(txtbxProbationProbationPeriodFrom.Text);
                    personalInfo.ProbationPeriodTo   = Convert.ToDateTime(txtbxProbationPeriodTo.Text);
                    personalInfo.ConfiramtionDate    = Convert.ToDateTime(txtbxConformationDate.Text);
                    personalInfo.JobResponsibility   = txtbxJobResponsibility.Text;

                    if (EmployeeId != null)
                    {
                        int result = employeeSetUpBll.UpdateemployemetPart(EmployeeId, personalInfo);
                        if (result == 1)
                        {
                            ScriptManager.RegisterStartupScript(Page, Page.GetType(), "text", "func('Data Update successfully!')", true);
                            // lblModalMessage.Text = "Data Update Successfully.";
                            GetEmployemntInfo(EmployeeId);
                        }
                    }
                }
            }
            catch (Exception)
            {
                throw;
            }
        }
예제 #5
0
        protected void txtUpdate_Click(object sender, EventArgs e)
        {
            try
            {
                DESIGNATION_BLL objDeg_BLL      = new DESIGNATION_BLL();
                Increment_BLL   objIncrementBll = new Increment_BLL();
                int             DesginationId   = Convert.ToInt16(DropDownList1.SelectedValue);
                string          Grad            = txtGrade.Text.Trim();
                decimal         Gosssalary      = Convert.ToDecimal(txtGrossSalary.Text.Trim());

                string DesginationName = DropDownList1.SelectedItem.ToString();
                bool   Status          = CheckDesignation(DesginationName, Grad, Gosssalary);

                if (Status == false)
                {
                    HRM_DESIGNATIONS designationObj = new HRM_DESIGNATIONS();
                    designationObj.DEG_NAME   = DropDownList1.SelectedItem.ToString();
                    designationObj.GRADE      = txtGrade.Text;
                    designationObj.GROSS_SAL  = Gosssalary;
                    designationObj.HOUSE_RENT = Convert.ToDecimal(txtHouseRent.Text);
                    designationObj.BASIC      = Convert.ToDecimal(txtBasic.Text);
                    designationObj.MEDICAL    = Convert.ToDecimal(txtMedical.Text);
                    designationObj.FOOD_ALLOW = Convert.ToDecimal(txtbxFoodAllowance.Text);
                    designationObj.CONVEYANCE = Convert.ToDecimal(txtConveynce.Text);
                    designationObj.EDIT_USER  = ((SessionUser)Session["SessionUser"]).UserId;
                    designationObj.EDIT_DATE  = DateTime.Now;
                    designationObj.OCODE      = ((SessionUser)Session["SessionUser"]).OCode;
                    int result = objDeg_BLL.InsertDeignation(designationObj);
                }

                HRM_DESIGNATIONS _Desobj = objDeg_BLL.GetDesignationId(DesginationName, Grad, Gosssalary);
                if (_Desobj != null)
                {
                    int    desId  = _Desobj.DEG_ID;
                    string eid    = txtEid_LV.Text;
                    int    result = objDeg_BLL.UpdatePersonalInfoForSalaryUpdate(eid, desId, Gosssalary);
                    if (result == 1)
                    {
                        HRM_SalaryUpdate objEmp = new HRM_SalaryUpdate();
                        objEmp.EID            = eid;
                        objEmp.CurrendSalary  = Gosssalary;
                        objEmp.DegID          = DesginationId;
                        objEmp.Grade          = Grad;
                        objEmp.EDIT_DATE      = DateTime.Now;
                        objEmp.Previoussalary = Convert.ToDecimal(txtCurrent_Salary.Text);
                        objEmp.EDIT_DATE      = DateTime.Now;
                        objEmp.OCODE          = ((SessionUser)Session["SessionUser"]).OCode;
                        int resultstatus = objIncrementBll.SalaryUpdate(objEmp);
                        if (resultstatus == 1)
                        {
                            ScriptManager.RegisterStartupScript(Page, Page.GetType(), "text", "func('Salary Update successfully!')", true);
                        }
                    }
                }
                UIClear();
            }

            catch (Exception ex)
            {
                ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('" + ex.Message + "')", true);
            }
        }