Example #1
0
        public bool SaveTechnicalTitle(TechnicalTitle technicalTitle)
        {
            //throw new System.NotImplementedException();

            ITechnicalTitleDAL dAL = new TechnicalTitleDAL();

            if (dAL.QueryById(technicalTitle.Id) != null)
            {
                if (dAL.Update(technicalTitle) > 0)
                {
                    return(true);
                }
                else
                {
                    return(false);
                }
            }
            else
            {
                if (dAL.Add(technicalTitle) > 0)
                {
                    return(true);
                }
                else
                {
                    return(false);
                }
            }
        }
        public ActionResult EditTechnicalTitle(string id)
        {
            IOccupationBLL bLL = new OccupationBLL();

            TechnicalTitle technicalTitle = bLL.GetTechnicalTitleById(Convert.ToInt32(id));

            Models.TechnicalTitle technicalTitleView = new Models.TechnicalTitle
            {
                Id   = technicalTitle.Id,
                Name = technicalTitle.Name
            };

            ViewData["technicalTitleView"] = technicalTitleView;

            return(View());
        }
        public ActionResult SaveTechnicalTitle(string TitleId, string TitleName)
        {
            IOccupationBLL bLL = new OccupationBLL();

            TechnicalTitle technicalTitle = new TechnicalTitle {
                Id = Convert.ToInt32(TitleId), Name = TitleName
            };

            if (bLL.SaveTechnicalTitle(technicalTitle))
            {
                TempData["info"] = "保存成功";
                return(Redirect("/Settings/TitleSettings"));
            }
            else
            {
                TempData["error"] = "保存失败";
                return(Redirect(Request.UrlReferrer.AbsoluteUri));
            }
        }
Example #4
0
 /// <summary>
 /// 初始化所有的属性,包括引用类型的属性自己的属性
 /// </summary>
 public override void ReInitializeAllProperties()
 {
     ReInitializeProperties();
     if (Sex != null)
     {
         Sex.ReInitializeAllProperties();
     }
     if (MaritalState != null)
     {
         MaritalState.ReInitializeAllProperties();
     }
     if (CurrentDept != null)
     {
         CurrentDept.ReInitializeAllProperties();
     }
     if (CurrentWard != null)
     {
         CurrentWard.ReInitializeAllProperties();
     }
     if (TechnicalTitle != null)
     {
         TechnicalTitle.ReInitializeAllProperties();
     }
 }
Example #5
0
        /// <summary>
        /// 控制器内部方法
        /// </summary>
        /// <param name="id">通过id装载视图模型Staff</param>
        private void GetStaffById(string id)
        {
            IStaffBLL staffBLL = new StaffBLL();

            IOrgBLL orgBLL = new OrgBLL();

            IOccupationBLL occupationBLL = new OccupationBLL();

            ISalaryBLL salaryBLL = new SalaryBLL();

            Staff staff = staffBLL.GetStaffById(Convert.ToInt32(id));

            Models.Staff staffView = new Models.Staff();

            Type type = typeof(Models.Staff);

            Type modelType = typeof(Staff);

            var props = type.GetProperties();

            foreach (var p in props)
            {
                if (modelType.GetProperty(p.Name) != null)
                {
                    p.SetValue(staffView, modelType.GetProperty(p.Name).GetValue(staff));
                }
            }

            ThirdOrg        thirdOrg        = orgBLL.GetThirdOrgById(staff.ThirdOrgId);
            SecondOrg       secondOrg       = orgBLL.GetSecondOrgById(thirdOrg.ParentOrgId);
            FirstOrg        firstOrg        = orgBLL.GetFirstOrgById(secondOrg.ParentOrgId);
            OccupationName  occupationName  = occupationBLL.GetOccupationNameById(staff.OccId);
            OccupationClass occupationClass = occupationBLL.GetOccupationClassById(occupationName.ClassId);
            SalaryStandard  salaryStandard  = salaryBLL.GetSalaryStandardById(staff.StandardId);
            TechnicalTitle  technicalTitle  = occupationBLL.GetTechnicalTitleById(staff.TechnicalTitleId);

            staffView.FirstOrg = new Models.FirstOrg {
                Id = firstOrg.Id, OrgLevel = firstOrg.OrgLevel, OrgName = firstOrg.OrgName
            };
            staffView.SecondeOrg = new Models.SecondeOrg {
                Id = secondOrg.Id, OrgName = secondOrg.OrgName, OrgLevel = secondOrg.OrgLevel, ParentOrg = staffView.FirstOrg
            };
            staffView.ThirdOrg = new Models.ThirdOrg {
                Id = thirdOrg.Id, ParentOrg = staffView.SecondeOrg, OrgLevel = thirdOrg.OrgLevel, OrgName = thirdOrg.OrgName
            };
            staffView.OccupationClass = new Models.OccupationClass {
                Id = occupationClass.Id, Name = occupationClass.Name
            };
            staffView.OccupationName = new Models.OccupationName {
                Id = occupationName.Id, Name = occupationName.Name, OccupationClass = staffView.OccupationClass
            };
            staffView.SalaryStandard = new Models.SalaryStandard {
                Id = salaryStandard.Id, StandardName = salaryStandard.StandardName, Total = salaryStandard.Total
            };
            staffView.TechnicalTitle = new Models.TechnicalTitle {
                Id = technicalTitle.Id, Name = technicalTitle.Name
            };

            ViewData["staffView"] = staffView;

            //装载所有职称
            List <Models.TechnicalTitle> list = new List <Models.TechnicalTitle>();

            List <TechnicalTitle> tempList = occupationBLL.GetAllTechnicalTitle();

            foreach (var tt in tempList)
            {
                Models.TechnicalTitle tempTechnicalTitle = new Models.TechnicalTitle
                {
                    Id   = tt.Id,
                    Name = tt.Name
                };
                list.Add(tempTechnicalTitle);
            }

            ViewData["tTitleList"] = list;

            //装载该职位的所有薪酬标准
            List <SalaryStandard> standardList = salaryBLL.GetAllStandardByOccId(staff.OccId);

            List <Models.SalaryStandard> standardListView = new List <Models.SalaryStandard>();

            foreach (var s in standardList)
            {
                Models.SalaryStandard tempStandard = new Models.SalaryStandard
                {
                    Id           = s.Id,
                    StandardName = s.StandardName,
                    Total        = s.Total
                };
                standardListView.Add(tempStandard);
            }

            ViewData["standardListView"] = standardListView;
        }