Exemple #1
0
        public JsonResult SaveEmployeeBasicNEmploymentInfo(EmployeeDetails objEmployeeDetails)
        {
            try
            {
                objLoginHelper = (LoginHelper)Session["LogInInformation"];

                Hrm_EmployeeInfo objEmployeeInfo = new Hrm_EmployeeInfo();
                objEmployeeInfo = hrmsData.ProcessEmployeeBasicNEmploymentInfo(objEmployeeDetails);

                Hrm_EmployeeWiseBankAccount objEmployeeWiseBankAccount = new Hrm_EmployeeWiseBankAccount();
                objEmployeeWiseBankAccount = hrmsData.ProcessEmployeeWiseBankAccount(objEmployeeDetails);

                Hrm_EmployeeWiseSalaryStructureMaster         objEmployeeSalaryStructureMaster = new Hrm_EmployeeWiseSalaryStructureMaster();
                List <Hrm_EmployeeWiseSalaryStructureDetails> lstEmloyeeSalaryStructureDetails = new List <Hrm_EmployeeWiseSalaryStructureDetails>();

                if (!hrmsData.EmployeeExistOrNot(objEmployeeDetails.EmployeeID))
                {
                    if (!Helper.EmployeeIdValidation(objEmployeeDetails.EmployeeID))
                    {
                        return(new JsonResult {
                            Data = ExceptionHelper.ExceptionCustomErrorMessage("Employee Id Is Not Valid")
                        });
                    }

                    objEmployeeSalaryStructureMaster = hrmsData.ProcessEmployeeWiseSalaryStructureMaster(objEmployeeInfo.EmployeeID, objEmployeeInfo.LastDesignation, objEmployeeInfo.LastEmploymentType, objEmployeeInfo.JoiningDate);
                    lstEmloyeeSalaryStructureDetails = hrmsData.ProcessEmployeeWiseSalaryStructureDetails(objEmployeeInfo.EmployeeID, objEmployeeSalaryStructureMaster.SalaryStructureSeqNo, objEmployeeInfo.LastDesignation, objEmployeeInfo.LastEmploymentType);

                    objEmployeeInfo.CreatedBy = objLoginHelper.LogInID;
                    objEmployeeInfo.CreatedOn = DateTime.Now;

                    hrmsData.CreateEmployeeBasicNEmploymentInfo(objEmployeeInfo, objEmployeeSalaryStructureMaster, lstEmloyeeSalaryStructureDetails, objEmployeeWiseBankAccount);
                }
                else
                {
                    objEmployeeInfo.ModifiedBy = objLoginHelper.LogInID;
                    objEmployeeInfo.ModifiedOn = DateTime.Now;

                    //objEmployeeSalaryStructureMaster = hrmsData.ProcessEmployeeWiseSalaryStructureMasterUpdate(objEmployeeInfo.EmployeeID, objEmployeeInfo.LastDesignation, objEmployeeInfo.LastEmploymentType, objEmployeeInfo.JoiningDate);
                    //lstEmloyeeSalaryStructureDetails = hrmsData.ProcessEmployeeWiseSalaryStructureDetails(objEmployeeInfo.EmployeeID, objEmployeeSalaryStructureMaster.SalaryStructureSeqNo, objEmployeeInfo.LastDesignation, objEmployeeInfo.LastEmploymentType);

                    hrmsData.UpdateEmployeeBasicNEmploymentInfo(objEmployeeInfo, objEmployeeSalaryStructureMaster, lstEmloyeeSalaryStructureDetails, objEmployeeWiseBankAccount);
                }

                return(new JsonResult {
                    Data = ExceptionHelper.ExceptionMessage(string.Empty)
                });
            }
            catch (Exception ex)
            {
                return(new JsonResult {
                    Data = ExceptionHelper.ExceptionMessage(ex)
                });
            }
        }