예제 #1
0
        public JsonResult SaveEmployeeHeader(EmployeeHeader employeeHeader)
        {
            JsonResult result = null;

            if (employeeHeader != null)
            {
                try
                {
                    if (employeeHeader.Id > 0)
                    {
                        EmployeeHeader _employeeHeader = employeeHeader;
                        _employeeHeader.ModifiedBy = USER_OBJECT.UserID;
                        _employeeHeader.ModifiedOn = DateTimeConverter.SingaporeDateTimeConversion(DateTime.Now);
                        _employeeHeader.FirstName  = employeeHeader.FirstName;
                        _employeeHeader.MiddleName = employeeHeader.MiddleName;
                        _employeeHeader.LastName   = employeeHeader.LastName;
                        _employeeHeader.EmployeePersonalInfo.Add(PrepareEmployeePersonalInfo(employeeHeader.EmployeePersonalInfo.FirstOrDefault(), employeeHeader));

                        _employeeHeader.Nationality = employeeHeader.Nationality;
                        EmployeeProfileService.SaveEmployeeProfile(_employeeHeader);
                        result = Json(new { sucess = true, message = C.SUCCESSFUL_SAVE_MESSAGE }, JsonRequestBehavior.AllowGet);
                    }
                }
                catch (Exception ex)
                {
                    if (ex.InnerException != null && !string.IsNullOrEmpty(ex.InnerException.Message))
                    {
                        return(Json(new { success = false, message = ex.InnerException.Message }, JsonRequestBehavior.DenyGet));
                    }
                }
            }
            return(result);
        }
예제 #2
0
        public JsonResult SaveEmployeeUser(User EmployeeUser, Int32 employeeId)
        {
            JsonResult result = null;

            if (EmployeeUser != null)
            {
                try
                {
                    if (EmployeeUser.Id > 0)
                    {
                        User           _user           = EmployeeUser;
                        EmployeeHeader _employeeHeader = EmployeeProfileService.GetEmployeeProfileDetailsById(employeeId);
                        _user.ModifiedOn = _employeeHeader.ModifiedOn = DateTimeConverter.SingaporeDateTimeConversion(DateTime.Now);
                        _user.ModifiedBy = _employeeHeader.ModifiedBy = USER_OBJECT.UserID;
                        _user.UserName   = _employeeHeader.UserEmailId = EmployeeUser.UserName;
                        _user.Password   = _employeeHeader.Password = _employeeHeader.ConfirmPassword = EmployeeUser.Password;

                        LogInLogOutService.Save(EmployeeUser, true);
                        EmployeeProfileService.SaveEmployeeProfile(_employeeHeader, true);

                        result = Json(new { sucess = true, message = C.SUCCESSFUL_SAVE_MESSAGE }, JsonRequestBehavior.AllowGet);
                    }
                }
                catch (Exception ex)
                {
                    if (ex.InnerException != null && !string.IsNullOrEmpty(ex.InnerException.Message))
                    {
                        return(Json(new { success = false, message = ex.InnerException.Message }, JsonRequestBehavior.DenyGet));
                    }
                }
            }
            return(result);
        }
예제 #3
0
        public JsonResult SaveEmlployee()
        {
            EmployeeHeader employeeHeader = JsonConvert.DeserializeObject <EmployeeHeader>(System.Web.HttpContext.Current.Request["EmployeeDetails"]);
            List <EmployeeDocumentViewModel> employeeDocumentViewModel = JsonConvert.DeserializeObject <List <EmployeeDocumentViewModel> >(System.Web.HttpContext.Current.Request["EmployeeDocument"]);

            HttpFileCollection hfc    = System.Web.HttpContext.Current.Request.Files;
            JsonResult         result = new JsonResult();

            if (employeeHeader != null)
            {
                try
                {
                    EmployeeHeader _employeeHeader = new EmployeeHeader();
                    _employeeHeader = PrepareEmployeeHeader(employeeHeader, hfc, employeeDocumentViewModel);

                    EmployeeProfileService.SaveEmployeeProfile(_employeeHeader);

                    PrepareEmail(_employeeHeader);

                    result = Json(new { sucess = true, message = C.SUCCESSFUL_SAVE_MESSAGE }, JsonRequestBehavior.AllowGet);
                }
                catch (Exception ex)
                {
                    if (ex.InnerException != null && !string.IsNullOrEmpty(ex.InnerException.Message))
                    {
                        return(Json(new { success = false, message = ex.InnerException.Message }, JsonRequestBehavior.DenyGet));
                    }
                }
            }
            return(result);
        }