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;
            }
        }
Example #2
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);
            }
        }