예제 #1
0
        public JsonResult DeleteImage(string imageType)
        {
            string        id     = GetQueryString("ID");
            S_HR_Employee entity = ComprehensiveDbContext.Set <S_HR_Employee>().Find(id);

            if (entity != null)
            {
                switch (imageType)
                {
                case "Portrait":
                    entity.Portrait = null;
                    break;

                case "IdentityCardFace":
                    entity.IdentityCardFace = null;
                    break;

                case "IdentityCardBack":
                    entity.IdentityCardBack = null;
                    break;

                case "Sign":
                    entity.SignImage = null;
                    break;
                }
            }
            ComprehensiveDbContext.SaveChanges();
            return(Json(new { ID = id, ImageType = imageType }));
        }
예제 #2
0
        public JsonResult UploadImg(string imageType)
        {
            S_HR_Employee entity = UpdateEntity <S_HR_Employee>();

            if (Request.Files.Count > 0)
            {
                var    t  = Request.Files[0].InputStream;
                byte[] bt = new byte[t.Length];
                t.Read(bt, 0, int.Parse(t.Length.ToString()));

                switch (imageType)
                {
                case "Portrait":
                    entity.Portrait = bt;
                    break;

                case "IdentityCardFace":
                    entity.IdentityCardFace = bt;
                    break;

                case "IdentityCardBack":
                    entity.IdentityCardBack = bt;
                    break;

                case "Sign":
                    entity.SignImage = bt;
                    break;
                }

                ComprehensiveDbContext.SaveChanges();
            }
            return(Json(new { ID = entity.ID, ImageType = imageType }));
        }
        public JsonResult SaveExcelData()
        {
            var    reader   = new System.IO.StreamReader(HttpContext.Request.InputStream);
            string data     = reader.ReadToEnd();
            var    tempdata = JsonConvert.DeserializeObject <Dictionary <string, string> >(data);
            var    list     = JsonConvert.DeserializeObject <List <Dictionary <string, string> > >(tempdata["data"]);

            //var currentUser = FormulaHelper.GetUserInfo();
            //var orgService = FormulaHelper.GetService<IOrgService>();
            //var orgs = orgService.GetOrgs();
            foreach (var salaryDic in list)
            {
                var salary = new T_HR_SalaryManage();
                UpdateEntity <T_HR_SalaryManage>(salary, salaryDic);
                if (salary.ID == null)
                {
                    salary.ID = FormulaHelper.CreateGuid();
                }
                EntityCreateLogic <T_HR_SalaryManage>(salary);
                var code        = salaryDic["Code"];
                var currentInfo = ComprehensiveDbContext.Set <S_HR_Employee>().FirstOrDefault(d => d.Code == code && d.IsDeleted == "0");
                if (currentInfo != null)
                {
                    salary.EmployeeName = currentInfo.Name;
                    salary.Employee     = currentInfo.ID;
                    salary.DeptName     = currentInfo.DeptName;
                    salary.Dept         = currentInfo.Dept;
                    salary.Position     = currentInfo.Post;
                }

                //if (!String.IsNullOrEmpty(salary.DeptName))
                //{
                //    var dept = orgs.FirstOrDefault(d => d.Name == salary.DeptName);
                //    if (dept != null)
                //    {
                //        salary.Dept = dept.ID;
                //        salary.DeptName = dept.Name;
                //    }
                //}
                //if (string.IsNullOrWhiteSpace(salary.EmployeeName))
                //{
                //    salary.EmployeeName = salary.Employee;
                //}
                this.ComprehensiveDbContext.Set <T_HR_SalaryManage>().Add(salary);
                ComprehensiveDbContext.SaveChanges();
            }
            return(Json("Success"));
        }
예제 #4
0
        public override JsonResult Delete()
        {
            string listIDs = Request["ListIDs"];

            string[] idArray = listIDs.Split(',');
            ComprehensiveDbContext.Set <S_HR_Employee>().Where(c => idArray.Contains(c.ID)).Update(c =>
            {
                c.IsDeleted  = "1";
                c.DeleteTime = DateTime.Now;
            });
            ComprehensiveDbContext.SaveChanges();
            EmployeeFo fo = new EmployeeFo();

            fo.EmployeeDeleteToUser(listIDs);
            return(Json(""));
            //return base.Delete();
        }
예제 #5
0
        public override JsonResult Delete()
        {
            string ids = Request["ListIDs"];

            string[] idArray    = ids.Split(',');
            string   employeeID = GetQueryString("EmployeeID");

            ComprehensiveDbContext.Set <S_HR_EmployeeJob>().Delete(c => idArray.Contains(c.ID));
            ComprehensiveDbContext.SaveChanges();

            var employee = ComprehensiveDbContext.Set <S_HR_Employee>().Find(employeeID);
            var fo       = new EmployeeFo();

            fo.SyncDeptByJob(employee);

            return(Json(""));
        }
예제 #6
0
        protected override void AfterSave(Dictionary <string, string> dic, Base.Logic.Domain.S_UI_Form formInfo, bool isNew)
        {
            var employee = ComprehensiveDbContext.Set <S_HR_Employee>().Find(dic.GetValue("EmployeeID"));

            if (employee != null)
            {
                //var isMain = dic.GetValue("IsMain");
                var ID       = dic.GetValue("ID");
                var postList = ComprehensiveDbContext.Set <S_HR_EmployeeWorkPost>().Where(a => a.EmployeeID == employee.ID && a.ID != ID).ToList();
                foreach (var item in postList)
                {
                    item.IsMain = "0";
                }
                employee.Post      = dic.GetValue("Post");
                employee.PostLevel = dic.GetValue("PostLevel");
                ComprehensiveDbContext.SaveChanges();
            }
        }
예제 #7
0
        public override JsonResult Delete()
        {
            string ids = Request["ListIDs"];

            string[] idArray    = ids.Split(',');
            string   employeeID = GetQueryString("EmployeeID");

            ComprehensiveDbContext.Set <S_HR_EmployeeWorkPost>().Delete(c => idArray.Contains(c.ID));
            ComprehensiveDbContext.SaveChanges();

            var employee = ComprehensiveDbContext.Set <S_HR_Employee>().Find(employeeID);

            if (employee != null)
            {
                employee.Post      = null;
                employee.PostLevel = null;
                ComprehensiveDbContext.SaveChanges();
            }
            return(Json(""));
            //return base.Delete();
        }
        public JsonResult SaveExcelData()
        {
            var    reader   = new System.IO.StreamReader(HttpContext.Request.InputStream);
            string data     = reader.ReadToEnd();
            var    tempdata = JsonConvert.DeserializeObject <Dictionary <string, string> >(data);
            var    list     = JsonConvert.DeserializeObject <List <Dictionary <string, string> > >(tempdata["data"]);

            foreach (var salaryDic in list)
            {
                var bonus = new T_HR_PersonalBonusInput();
                UpdateEntity <T_HR_PersonalBonusInput>(bonus, salaryDic);
                if (bonus.ID == null)
                {
                    bonus.ID = FormulaHelper.CreateGuid();
                }
                EntityCreateLogic <T_HR_PersonalBonusInput>(bonus);
                var code        = salaryDic["Code"];
                var currentInfo = ComprehensiveDbContext.Set <S_HR_Employee>().FirstOrDefault(d => d.Code == code && d.IsDeleted == "0");
                if (currentInfo != null)
                {
                    bonus.EmployeeName = currentInfo.Name;
                    bonus.Employee     = currentInfo.ID;
                    bonus.DeptName     = currentInfo.DeptName;
                    bonus.Dept         = currentInfo.Dept;
                    if (string.IsNullOrWhiteSpace(bonus.SendOutDate.ToString()))
                    {
                        DateTime dt = (DateTime)bonus.SendOutDate;
                        bonus.Year  = dt.Year.ToString();
                        bonus.Month = dt.Month.ToString();
                    }
                }
                this.ComprehensiveDbContext.Set <T_HR_PersonalBonusInput>().Add(bonus);
                ComprehensiveDbContext.SaveChanges();
            }
            return(Json("Success"));
        }
예제 #9
0
        public JsonResult SaveExcelData()
        {
            var    reader      = new System.IO.StreamReader(HttpContext.Request.InputStream);
            string data        = reader.ReadToEnd();
            var    tempdata    = JsonConvert.DeserializeObject <Dictionary <string, string> >(data);
            var    list        = JsonConvert.DeserializeObject <List <S_HR_Employee> >(tempdata["data"]);
            var    currentUser = FormulaHelper.GetUserInfo();
            var    orgService  = FormulaHelper.GetService <IOrgService>();
            var    orgs        = orgService.GetOrgs();

            foreach (var user in list)
            {
                if (string.IsNullOrWhiteSpace(user.Code))
                {
                    user.Code = user.Name;
                }
                var hrUser = this.ComprehensiveDbContext.Set <S_HR_Employee>().FirstOrDefault(d => d.Code == user.Code);
                if (hrUser != null)
                {
                    continue;
                }
                if (hrUser == null)
                {
                    hrUser               = this.ComprehensiveDbContext.Set <S_HR_Employee>().Create();
                    hrUser.ID            = FormulaHelper.CreateGuid();
                    hrUser.Code          = user.Code;
                    hrUser.IsHaveAccount = "1";
                    this.ComprehensiveDbContext.Set <S_HR_Employee>().Add(hrUser);
                }
                hrUser.Name             = user.Name;
                hrUser.MobilePhone      = user.MobilePhone;
                hrUser.OfficePhone      = user.OfficePhone;
                hrUser.NativePlace      = user.NativePlace;
                hrUser.Nation           = user.Nation;
                hrUser.Birthday         = user.Birthday;
                hrUser.Address          = user.Address;
                hrUser.CreateDate       = DateTime.Now;
                hrUser.CreateUser       = currentUser.UserName;
                hrUser.CreateUserID     = currentUser.UserID;
                hrUser.MaritalStatus    = user.MaritalStatus;
                hrUser.JoinWorkDate     = user.JoinWorkDate;
                hrUser.JoinCompanyDate  = user.JoinCompanyDate;
                hrUser.IsDeleted        = "0";
                hrUser.IdentityCardCode = user.IdentityCardCode;

                if (!String.IsNullOrEmpty(user.DeptName))
                {
                    var dept = orgs.FirstOrDefault(d => d.Name == user.DeptName);
                    if (dept != null)
                    {
                        hrUser.Dept     = dept.ID;
                        hrUser.DeptName = dept.Name;
                    }
                }
                hrUser.Sex           = user.Sex;
                hrUser.Educational   = user.Educational;
                hrUser.Political     = user.Political;
                hrUser.EmploymentWay = user.EmploymentWay;
                hrUser.Email         = user.Email;
                ComprehensiveDbContext.SaveChanges();
            }
            return(Json("Success"));
        }