Ejemplo n.º 1
0
        public ActionResult AddSecondOrg()
        {
            IOrgBLL bLL = new OrgBLL();

            //装载所有2级机构,用于下拉框
            //List<Models.SecondeOrg> secondOrgList = new List<Models.SecondeOrg>();
            //foreach (var so in bLL.GetAllSecondOrg())
            //{
            //    Models.SecondeOrg tempSecondOrg = new Models.SecondeOrg
            //    {
            //        Id = so.Id,
            //        OrgName = so.OrgName,
            //        OrgLevel = so.OrgLevel
            //    };
            //    FirstOrg tempFirstOrg = bLL.GetFirstOrgById(so.ParentOrgId);
            //    tempSecondOrg.ParentOrg = new Models.FirstOrg { Id = tempFirstOrg.Id, OrgName = tempFirstOrg.OrgName, OrgLevel = tempFirstOrg.OrgLevel };
            //    secondOrgList.Add(tempSecondOrg);
            //}
            //ViewData["secondOrgList"] = secondOrgList;

            //装载所有1级机构,用于所属机构选择下拉框
            List <Models.FirstOrg> firstOrgList = new List <Models.FirstOrg>();

            foreach (var fo in bLL.GetAllFirstOrg())
            {
                Models.FirstOrg tempFirstOrg = new Models.FirstOrg {
                    Id = fo.Id, OrgName = fo.OrgName, OrgLevel = fo.OrgLevel
                };
                firstOrgList.Add(tempFirstOrg);
            }

            ViewData["firstOrgList"] = firstOrgList;

            return(View());
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 查看已删除的员工档案
        /// </summary>
        /// <returns>返回列表视图</returns>
        public ActionResult StaffViewDeleted()
        {
            IStaffBLL bLL = new StaffBLL();

            IOrgBLL orgBLL = new OrgBLL();

            IOccupationBLL occupationBLL = new OccupationBLL();

            List <Staff> staffList = bLL.GetAllStaffDeleted();

            List <Models.Staff> staffListView = new List <Models.Staff>();

            if (staffList != null)
            {
                foreach (var staff in staffList)
                {
                    Models.Staff tempStaff = new Models.Staff
                    {
                        Id = staff.Id,
                        StaffFileNumber = staff.StaffFileNumber,
                        StaffName       = staff.StaffName,
                        FileState       = staff.FileState,
                        IsDel           = staff.IsDel
                    };
                    ThirdOrg  thirdOrg  = orgBLL.GetThirdOrgById(staff.ThirdOrgId);
                    SecondOrg secondOrg = orgBLL.GetSecondOrgById(thirdOrg.ParentOrgId);
                    FirstOrg  firstOrg  = orgBLL.GetFirstOrgById(secondOrg.ParentOrgId);

                    tempStaff.FirstOrg = new Models.FirstOrg {
                        Id = firstOrg.Id, OrgLevel = firstOrg.OrgLevel, OrgName = firstOrg.OrgName
                    };
                    tempStaff.SecondeOrg = new Models.SecondeOrg {
                        Id = secondOrg.Id, OrgName = secondOrg.OrgName, OrgLevel = secondOrg.OrgLevel, ParentOrg = tempStaff.FirstOrg
                    };
                    tempStaff.ThirdOrg = new Models.ThirdOrg {
                        Id = thirdOrg.Id, ParentOrg = tempStaff.SecondeOrg, OrgLevel = thirdOrg.OrgLevel, OrgName = thirdOrg.OrgName
                    };

                    OccupationName occupationName = occupationBLL.GetOccupationNameById(staff.OccId);

                    tempStaff.OccupationName = new Models.OccupationName {
                        Id = occupationName.Id, Name = occupationName.Name
                    };

                    staffListView.Add(tempStaff);
                }
            }

            ViewData["staffListView"] = staffListView;

            return(View());
        }
Ejemplo n.º 3
0
        public ActionResult EditFirstOrg(string id)
        {
            IOrgBLL bLL = new OrgBLL();

            FirstOrg firstOrg = bLL.GetFirstOrgById(Convert.ToInt32(id));

            Models.FirstOrg firstOrgView = new Models.FirstOrg {
                Id = firstOrg.Id, OrgName = firstOrg.OrgName, OrgLevel = firstOrg.OrgLevel
            };

            ViewData["firstOrgView"] = firstOrgView;

            return(View());
        }
Ejemplo n.º 4
0
        public ActionResult DeleteThirdOrg(string id)
        {
            IOrgBLL bLL = new OrgBLL();

            if (bLL.DeleteThirdOrgById(Convert.ToInt32(id)))
            {
                TempData["info"] = "已删除";
                return(Redirect("/Settings/OrgSettings"));
            }
            else
            {
                TempData["error"] = "删除失败";
                return(Redirect(Request.UrlReferrer.AbsoluteUri));
            }
        }
Ejemplo n.º 5
0
        /// <summary>
        /// 处理档案登记请求
        /// </summary>
        /// <returns>返回档案登记视图</returns>
        public ActionResult StaffRegist()
        {
            IOrgBLL orgBLL = new OrgBLL();

            IOccupationBLL occupationBLL = new OccupationBLL();

            //装载1级机构
            List <FirstOrg>        fList        = orgBLL.GetAllFirstOrg();
            List <Models.FirstOrg> firstOrgList = new List <Models.FirstOrg>();

            foreach (var fo in fList)
            {
                Models.FirstOrg tempFo = new Models.FirstOrg {
                    Id = fo.Id, OrgName = fo.OrgName, OrgLevel = fo.OrgLevel
                };
                firstOrgList.Add(tempFo);
            }
            ViewData["firstOrgList"] = firstOrgList;

            //装载职位类型
            List <OccupationClass>        ocList       = occupationBLL.GetAllOccupationClass();
            List <Models.OccupationClass> occClassList = new List <Models.OccupationClass>();

            foreach (var oc in ocList)
            {
                Models.OccupationClass tempClass = new Models.OccupationClass {
                    Id = oc.Id, Name = oc.Name
                };
                occClassList.Add(tempClass);
            }
            ViewData["occClassList"] = occClassList;

            //装载职称
            List <TechnicalTitle>        ttList     = occupationBLL.GetAllTechnicalTitle();
            List <Models.TechnicalTitle> tTitleList = new List <Models.TechnicalTitle>();

            foreach (var tt in ttList)
            {
                Models.TechnicalTitle tempTitle = new Models.TechnicalTitle {
                    Id = tt.Id, Name = tt.Name
                };
                tTitleList.Add(tempTitle);
            }
            ViewData["tTitleList"] = tTitleList;


            return(View());
        }
Ejemplo n.º 6
0
        public ActionResult SalaryPaymentView()
        {
            ISalaryGrantBLL bLL = new SalaryGrantBLL();

            IOrgBLL orgBLL = new OrgBLL();

            List <SalaryPayment> list = bLL.GetAllSalaryPaymentFromDB();

            List <Models.SalaryPayment> salaryPaymentList = new List <Models.SalaryPayment>();

            if (list != null)
            {
                foreach (var sp in list)
                {
                    Models.SalaryPayment salaryPayment = new Models.SalaryPayment
                    {
                        Id          = sp.Id,
                        FileNumber  = sp.FileNumber,
                        TotalPerson = sp.TotalPerson,
                        TotalAmout  = sp.TotalAmout,
                        RegistTime  = sp.RegistTime,
                        FileState   = sp.FileState
                    };
                    ThirdOrg  thirdOrg  = orgBLL.GetThirdOrgById(sp.TOrgId);
                    SecondOrg secondOrg = orgBLL.GetSecondOrgById(thirdOrg.ParentOrgId);
                    FirstOrg  firstOrg  = orgBLL.GetFirstOrgById(secondOrg.ParentOrgId);

                    Models.FirstOrg firstOrgView = new Models.FirstOrg {
                        Id = firstOrg.Id, OrgLevel = firstOrg.OrgLevel, OrgName = firstOrg.OrgName
                    };
                    Models.SecondeOrg secondeOrgView = new Models.SecondeOrg {
                        Id = secondOrg.Id, OrgName = secondOrg.OrgName, OrgLevel = secondOrg.OrgLevel, ParentOrg = firstOrgView
                    };
                    Models.ThirdOrg thirdOrgView = new Models.ThirdOrg {
                        Id = thirdOrg.Id, ParentOrg = secondeOrgView, OrgLevel = thirdOrg.OrgLevel, OrgName = thirdOrg.OrgName
                    };

                    salaryPayment.ThirdOrg = thirdOrgView;

                    salaryPaymentList.Add(salaryPayment);
                }
            }

            ViewData["salaryPaymentList"] = salaryPaymentList;

            return(View());
        }
Ejemplo n.º 7
0
        public ActionResult SaveSecondOrg(string SecondOrgId, string SecondOrgName, string SecondOrgLevel, string parentOrgId)
        {
            IOrgBLL bLL = new OrgBLL();

            SecondOrg secondOrg = new SecondOrg {
                Id = Convert.ToInt32(SecondOrgId), OrgName = SecondOrgName, OrgLevel = Convert.ToInt32(SecondOrgLevel), ParentOrgId = Convert.ToInt32(parentOrgId)
            };

            if (bLL.SaveSecondOrg(secondOrg))
            {
                TempData["info"] = "保存成功";
                return(Redirect("/Settings/OrgSettings"));
            }
            else
            {
                TempData["error"] = "保存失败";
                return(Redirect(Request.UrlReferrer.AbsoluteUri));
            }
        }
Ejemplo n.º 8
0
        public ActionResult SaveFirstOrg(string FirstOrgId, string FirstOrgName, string FirstOrgLevel)
        {
            IOrgBLL bLL = new OrgBLL();

            FirstOrg firstOrg = new FirstOrg {
                Id = Convert.ToInt32(FirstOrgId), OrgName = FirstOrgName, OrgLevel = Convert.ToInt32(FirstOrgLevel)
            };

            if (bLL.SaveFirstOrg(firstOrg))
            {
                TempData["info"] = "保存成功";
                return(Redirect("/Settings/OrgSettings"));
            }
            else
            {
                TempData["error"] = "保存失败";
                return(Redirect(Request.UrlReferrer.AbsoluteUri));
            }
        }
Ejemplo n.º 9
0
 public void SetOrgID(string value)
 {
     value = value.Trim();
     if (String.IsNullOrEmpty(value))
     {
         OrgID = null;
     }
     else
     {
         Org g = OrgBLL.GetByName(value);
         if (g == null)
         {
             throw new Exception("Nhập sai tên đơn vị.");
         }
         else
         {
             OrgID = g.ID;
         }
     }
 }
Ejemplo n.º 10
0
        public ActionResult DynamicThirdOrg(string id)
        {
            IOrgBLL bLL = new OrgBLL();

            List <Models.ThirdOrg> list = new List <Models.ThirdOrg>();

            List <ThirdOrg> tempList = bLL.GetThirdOrgBySecondOrgId(Convert.ToInt32(id));

            if (tempList != null)
            {
                foreach (var to in tempList)
                {
                    Models.ThirdOrg thirdOrg = new Models.ThirdOrg {
                        Id = to.Id, OrgName = to.OrgName, OrgLevel = to.OrgLevel
                    };
                    list.Add(thirdOrg);
                }
            }

            return(Json(list));
        }
Ejemplo n.º 11
0
        public ActionResult DynamicSecondOrg(string id)
        {
            IOrgBLL bLL = new OrgBLL();

            List <Models.SecondeOrg> list = new List <Models.SecondeOrg>();

            List <SecondOrg> tempList = bLL.GetSecondOrgByFirstOrgId(Convert.ToInt32(id));

            if (tempList != null)
            {
                foreach (var so in tempList)
                {
                    Models.SecondeOrg secondeOrg = new Models.SecondeOrg {
                        Id = so.Id, OrgName = so.OrgName, OrgLevel = so.OrgLevel
                    };
                    list.Add(secondeOrg);
                }
            }

            return(Json(list));
        }
Ejemplo n.º 12
0
        public ActionResult EditSecondOrg(string id)
        {
            IOrgBLL bLL = new OrgBLL();

            SecondOrg secondOrg = bLL.GetSecondOrgById(Convert.ToInt32(id));

            Models.SecondeOrg secondeOrgView = new Models.SecondeOrg {
                Id = secondOrg.Id, OrgName = secondOrg.OrgName, OrgLevel = secondOrg.OrgLevel
            };

            FirstOrg firstOrg = bLL.GetFirstOrgById(secondOrg.ParentOrgId);

            Models.FirstOrg firstOrgView = new Models.FirstOrg {
                Id = firstOrg.Id, OrgName = firstOrg.OrgName, OrgLevel = firstOrg.OrgLevel
            };

            secondeOrgView.ParentOrg = firstOrgView;

            ViewData["secondeOrgView"] = secondeOrgView;


            //装载所有1级机构,用于所属机构选择下拉框
            List <Models.FirstOrg> firstOrgList = new List <Models.FirstOrg>();

            foreach (var fo in bLL.GetAllFirstOrg())
            {
                Models.FirstOrg tempFirstOrg = new Models.FirstOrg {
                    Id = fo.Id, OrgName = fo.OrgName, OrgLevel = fo.OrgLevel
                };
                firstOrgList.Add(tempFirstOrg);
            }

            ViewData["firstOrgList"] = firstOrgList;

            return(View());
        }
Ejemplo n.º 13
0
        public ActionResult SalaryPaymentDetail(string id)
        {
            ISalaryGrantBLL salaryGrantBLL = new SalaryGrantBLL();

            IStaffBLL staffBLL = new StaffBLL();

            ISalaryBLL salaryBLL = new SalaryBLL();

            ISalaryItemBLL salaryItemBLL = new SalaryItemBLL();

            IOrgBLL orgBLL = new OrgBLL();

            List <StaffPayment> staffPaymentList = salaryGrantBLL.GetAllStaffPaymentByPaymentId(Convert.ToInt32(id));

            List <Models.StaffPayment> staffPaymentListView = new List <Models.StaffPayment>();

            foreach (var sp in staffPaymentList)
            {
                Models.StaffPayment staffPayment = new Models.StaffPayment
                {
                    Id         = sp.Id,
                    OddAmout   = sp.OddAmout,
                    MinusAmout = sp.MinusAmout
                };

                //获取Model.StaffSalary,为StaffPayment装载StaffSalary
                StaffSalary        staffSalary     = salaryGrantBLL.GetStaffSalaryById(sp.StaffSalaryId);
                Models.StaffSalary staffSalaryView = new Models.StaffSalary
                {
                    Id = staffSalary.Id,
                    StaffFileNumber = staffSalary.StaffFileNumber
                };

                Staff staff = staffBLL.GetStaffById(staffSalary.StaffId);
                staffSalaryView.Staff = new Models.Staff {
                    Id = staff.Id, StaffName = staff.StaffName
                };

                ThirdOrg  thirdOrg  = orgBLL.GetThirdOrgById(staff.ThirdOrgId);
                SecondOrg secondOrg = orgBLL.GetSecondOrgById(thirdOrg.ParentOrgId);
                FirstOrg  firstOrg  = orgBLL.GetFirstOrgById(secondOrg.ParentOrgId);

                Models.FirstOrg firstOrgView = new Models.FirstOrg {
                    Id = firstOrg.Id, OrgLevel = firstOrg.OrgLevel, OrgName = firstOrg.OrgName
                };
                Models.SecondeOrg secondeOrgView = new Models.SecondeOrg {
                    Id = secondOrg.Id, OrgName = secondOrg.OrgName, OrgLevel = secondOrg.OrgLevel, ParentOrg = firstOrgView
                };
                staffSalaryView.ThirdOrg = new Models.ThirdOrg {
                    Id = thirdOrg.Id, ParentOrg = secondeOrgView, OrgLevel = thirdOrg.OrgLevel, OrgName = thirdOrg.OrgName
                };

                SalaryStandard        salaryStandard     = salaryBLL.GetSalaryStandardById(staffSalary.StandardId);
                Models.SalaryStandard salaryStandardView = new Models.SalaryStandard
                {
                    Id           = salaryStandard.Id,
                    StandardName = salaryStandard.StandardName,
                };
                List <StandardMapItem> standardMapItemList = salaryBLL.GetAllStandardMapItemByStandardId(salaryStandard.Id);
                foreach (var item in standardMapItemList)
                {
                    SalaryItem salaryItem = salaryItemBLL.GetSalaryItemById(item.ItemId);

                    Models.SalaryItem salaryItemView = new Models.SalaryItem
                    {
                        Id   = salaryItem.Id,
                        Name = salaryItem.Name
                    };

                    salaryStandardView.ItemAmout.Add(salaryItemView, item.Amout);;
                }

                staffSalaryView.SalaryStandard = salaryStandardView;

                staffPayment.StaffSalary = staffSalaryView;



                SalaryPayment salaryPayment = salaryGrantBLL.GetSalaryPaymentById(sp.PaymentId);
                staffPayment.SalaryPayment = new Models.SalaryPayment
                {
                    Id          = salaryPayment.Id,
                    TotalPerson = salaryPayment.TotalPerson,
                    TotalAmout  = salaryPayment.TotalAmout,
                    FileState   = salaryPayment.FileState,
                    FileNumber  = salaryPayment.FileNumber,
                    Registrant  = salaryPayment.Registrant,
                    RegistTime  = salaryPayment.RegistTime,
                    TotalReal   = salaryPayment.TotalReal,
                    CheckBy     = salaryPayment.CheckBy,
                    CheckTime   = salaryPayment.CheckTime
                };


                staffPaymentListView.Add(staffPayment);
            }

            ViewData["staffPaymentListView"] = staffPaymentListView;

            return(View());
        }
Ejemplo n.º 14
0
        public ActionResult PaymentSearch(FormCollection formCollection)
        {
            ISalaryGrantBLL salaryGrantBLL = new SalaryGrantBLL();

            IOrgBLL orgBLL = new OrgBLL();

            List <SalaryPayment> list = salaryGrantBLL.GetAllSalaryPaymentFromDB();

            if (formCollection["State"] != "10")
            {
                var l = from p in list
                        where p.FileState == (EnumState.SalaryPaymentStateEnum)Convert.ToInt32(formCollection["State"])
                        select p;

                list = l.ToList();
            }

            if (formCollection["BeginDate"] != "")
            {
                var l = from p in list
                        where p.CheckTime.Date >= Convert.ToDateTime(formCollection["BeginDate"])
                        select p;

                list = l.ToList();

                if (formCollection["EndDate"] != "")
                {
                    var l2 = from p in list
                             where p.CheckTime.Date <= Convert.ToDateTime(formCollection["EndDate"])
                             select p;

                    list = l2.ToList();
                }
            }
            else
            {
                if (formCollection["EndDate"] != "")
                {
                    var l = from p in list
                            where p.CheckTime.Date <= Convert.ToDateTime(formCollection["EndDate"])
                            select p;

                    list = l.ToList();
                }
            }

            List <Models.SalaryPayment> salaryPaymentList = new List <Models.SalaryPayment>();

            if (list != null)
            {
                foreach (var sp in list)
                {
                    Models.SalaryPayment salaryPayment = new Models.SalaryPayment
                    {
                        Id          = sp.Id,
                        FileNumber  = sp.FileNumber,
                        TotalPerson = sp.TotalPerson,
                        TotalAmout  = sp.TotalAmout,
                        RegistTime  = sp.RegistTime,
                        FileState   = sp.FileState
                    };
                    ThirdOrg  thirdOrg  = orgBLL.GetThirdOrgById(sp.TOrgId);
                    SecondOrg secondOrg = orgBLL.GetSecondOrgById(thirdOrg.ParentOrgId);
                    FirstOrg  firstOrg  = orgBLL.GetFirstOrgById(secondOrg.ParentOrgId);

                    Models.FirstOrg firstOrgView = new Models.FirstOrg {
                        Id = firstOrg.Id, OrgLevel = firstOrg.OrgLevel, OrgName = firstOrg.OrgName
                    };
                    Models.SecondeOrg secondeOrgView = new Models.SecondeOrg {
                        Id = secondOrg.Id, OrgName = secondOrg.OrgName, OrgLevel = secondOrg.OrgLevel, ParentOrg = firstOrgView
                    };
                    Models.ThirdOrg thirdOrgView = new Models.ThirdOrg {
                        Id = thirdOrg.Id, ParentOrg = secondeOrgView, OrgLevel = thirdOrg.OrgLevel, OrgName = thirdOrg.OrgName
                    };

                    salaryPayment.ThirdOrg = thirdOrgView;

                    salaryPaymentList.Add(salaryPayment);
                }
            }

            ViewData["salaryPaymentList"] = salaryPaymentList;

            return(View("SalaryPaymentView"));
        }
Ejemplo n.º 15
0
        /// <summary>
        /// 根据条件查询档案
        /// </summary>
        /// <param name="formCollection">查询条件</param>
        /// <returns>返回符合条件的员工档案列表视图</returns>
        public ActionResult StaffSearch(FormCollection formCollection)
        {
            IStaffBLL staffBLL = new StaffBLL();

            IOrgBLL orgBLL = new OrgBLL();

            IOccupationBLL occupationBLL = new OccupationBLL();

            List <Staff> list = new List <Staff>();

            List <Staff> tempList = new List <Staff>();

            if (formCollection["ThirdOrgId"] != "0")
            {
                list = staffBLL.GetAllStaffByTOrgId(Convert.ToInt32(formCollection["ThirdOrgId"]));

                tempList = list;

                if (formCollection["BeginDate"] != "")
                {
                    var l = from s in list
                            where s.RegistTime > Convert.ToDateTime(formCollection["BeginDate"])
                            select s;
                    tempList = l.ToList();
                    if (formCollection["EndDate"] != "")
                    {
                        var l2 = from s in tempList
                                 where s.RegistTime < Convert.ToDateTime(formCollection["EndDate"])
                                 select s;
                        tempList = l2.ToList();
                    }
                }
                else
                {
                    if (formCollection["EndDate"] != "")
                    {
                        var l2 = from s in list
                                 where s.RegistTime < Convert.ToDateTime(formCollection["EndDate"])
                                 select s;
                        tempList = l2.ToList();
                    }
                }

                list = tempList;
            }
            else
            {
                if (formCollection["SecondOrgId"] != "0")
                {
                    list = staffBLL.GetAllStaffBySOrgId(Convert.ToInt32(formCollection["SecondOrgId"]));

                    tempList = list;

                    if (formCollection["BeginDate"] != "")
                    {
                        var l = from s in list
                                where s.RegistTime > Convert.ToDateTime(formCollection["BeginDate"])
                                select s;
                        tempList = l.ToList();
                        if (formCollection["EndDate"] != "")
                        {
                            var l2 = from s in tempList
                                     where s.RegistTime < Convert.ToDateTime(formCollection["EndDate"])
                                     select s;
                            tempList = l2.ToList();
                        }
                    }
                    else
                    {
                        if (formCollection["EndDate"] != "")
                        {
                            var l2 = from s in list
                                     where s.RegistTime < Convert.ToDateTime(formCollection["EndDate"])
                                     select s;
                            tempList = l2.ToList();
                        }
                    }

                    list = tempList;
                }
                else
                {
                    if (formCollection["FirstOrgId"] != "0")
                    {
                        list = staffBLL.GetAllStaffByFOrgId(Convert.ToInt32(formCollection["FirstOrgId"]));

                        tempList = list;

                        if (formCollection["BeginDate"] != "")
                        {
                            var l = from s in list
                                    where s.RegistTime > Convert.ToDateTime(formCollection["BeginDate"])
                                    select s;
                            tempList = l.ToList();
                            if (formCollection["EndDate"] != "")
                            {
                                var l2 = from s in tempList
                                         where s.RegistTime < Convert.ToDateTime(formCollection["EndDate"])
                                         select s;
                                tempList = l2.ToList();
                            }
                        }
                        else
                        {
                            if (formCollection["EndDate"] != "")
                            {
                                var l2 = from s in list
                                         where s.RegistTime < Convert.ToDateTime(formCollection["EndDate"])
                                         select s;
                                tempList = l2.ToList();
                            }
                        }

                        list = tempList;
                    }
                    else
                    {
                        list = staffBLL.GetAllStaffNormal();

                        tempList = list;

                        if (formCollection["BeginDate"] != "")
                        {
                            var l = from s in list
                                    where s.RegistTime > Convert.ToDateTime(formCollection["BeginDate"])
                                    select s;
                            tempList = l.ToList();
                            if (formCollection["EndDate"] != "")
                            {
                                var l2 = from s in tempList
                                         where s.RegistTime < Convert.ToDateTime(formCollection["EndDate"])
                                         select s;
                                tempList = l2.ToList();
                            }
                        }
                        else
                        {
                            if (formCollection["EndDate"] != "")
                            {
                                var l2 = from s in list
                                         where s.RegistTime < Convert.ToDateTime(formCollection["EndDate"])
                                         select s;
                                tempList = l2.ToList();
                            }
                        }

                        list = tempList;
                    }
                }
            }

            if (formCollection["OccNameId"] != "0")
            {
                int occNameId = Convert.ToInt32(formCollection["OccNameId"]);

                var l = from s in list
                        where s.OccId == occNameId
                        select s;

                list = l.ToList();
            }
            else
            {
                if (formCollection["OccClassId"] != "0")
                {
                    int occClassId = Convert.ToInt32(formCollection["OccClassId"]);

                    List <OccupationName> occNameList = occupationBLL.GetAllOccNameByClassId(occClassId);

                    List <int> ints = new List <int>();

                    foreach (var oc in occNameList)
                    {
                        ints.Add(oc.Id);
                    }

                    var l = from s in list
                            where ints.Contains(s.OccId)
                            select s;

                    list = l.ToList();
                }
            }



            List <Models.Staff> staffListView = new List <Models.Staff>();

            if (list != null)
            {
                foreach (var staff in list)
                {
                    Models.Staff tempStaff = new Models.Staff
                    {
                        Id = staff.Id,
                        StaffFileNumber = staff.StaffFileNumber,
                        StaffName       = staff.StaffName,
                        FileState       = staff.FileState,
                        IsDel           = staff.IsDel
                    };
                    ThirdOrg  thirdOrg  = orgBLL.GetThirdOrgById(staff.ThirdOrgId);
                    SecondOrg secondOrg = orgBLL.GetSecondOrgById(thirdOrg.ParentOrgId);
                    FirstOrg  firstOrg  = orgBLL.GetFirstOrgById(secondOrg.ParentOrgId);

                    tempStaff.FirstOrg = new Models.FirstOrg {
                        Id = firstOrg.Id, OrgLevel = firstOrg.OrgLevel, OrgName = firstOrg.OrgName
                    };
                    tempStaff.SecondeOrg = new Models.SecondeOrg {
                        Id = secondOrg.Id, OrgName = secondOrg.OrgName, OrgLevel = secondOrg.OrgLevel, ParentOrg = tempStaff.FirstOrg
                    };
                    tempStaff.ThirdOrg = new Models.ThirdOrg {
                        Id = thirdOrg.Id, ParentOrg = tempStaff.SecondeOrg, OrgLevel = thirdOrg.OrgLevel, OrgName = thirdOrg.OrgName
                    };

                    OccupationName occupationName = occupationBLL.GetOccupationNameById(staff.OccId);

                    tempStaff.OccupationName = new Models.OccupationName {
                        Id = occupationName.Id, Name = occupationName.Name
                    };

                    staffListView.Add(tempStaff);
                }
            }

            ViewData["staffListView"] = staffListView;


            //装载1级机构
            List <FirstOrg>        fList        = orgBLL.GetAllFirstOrg();
            List <Models.FirstOrg> firstOrgList = new List <Models.FirstOrg>();

            foreach (var fo in fList)
            {
                Models.FirstOrg tempFo = new Models.FirstOrg {
                    Id = fo.Id, OrgName = fo.OrgName, OrgLevel = fo.OrgLevel
                };
                firstOrgList.Add(tempFo);
            }
            ViewData["firstOrgList"] = firstOrgList;

            if (formCollection["FirstOrgId"] != "0")
            {
                //装载2级机构
                List <SecondOrg>         sList         = orgBLL.GetSecondOrgByFirstOrgId(Convert.ToInt32(formCollection["FirstOrgId"]));
                List <Models.SecondeOrg> secondOrgList = new List <Models.SecondeOrg>();
                foreach (var so in sList)
                {
                    Models.SecondeOrg tempSo = new Models.SecondeOrg {
                        Id = so.Id, OrgName = so.OrgName
                    };
                    secondOrgList.Add(tempSo);
                }
                ViewData["secondOrgList"] = secondOrgList;
            }

            if (formCollection["SecondOrgId"] != "0")
            {
                //装载3级机构
                List <ThirdOrg>        tList        = orgBLL.GetThirdOrgBySecondOrgId(Convert.ToInt32(formCollection["SecondOrgId"]));
                List <Models.ThirdOrg> thirdOrgList = new List <Models.ThirdOrg>();
                foreach (var to in tList)
                {
                    Models.ThirdOrg tempTo = new Models.ThirdOrg {
                        Id = to.Id, OrgName = to.OrgName
                    };
                    thirdOrgList.Add(tempTo);
                }
                ViewData["thirdOrgList"] = thirdOrgList;
            }

            //装载职位类型
            List <OccupationClass>        ocList       = occupationBLL.GetAllOccupationClass();
            List <Models.OccupationClass> occClassList = new List <Models.OccupationClass>();

            foreach (var oc in ocList)
            {
                Models.OccupationClass tempClass = new Models.OccupationClass {
                    Id = oc.Id, Name = oc.Name
                };
                occClassList.Add(tempClass);
            }
            ViewData["occClassList"] = occClassList;

            if (formCollection["OccClassId"] != "0")
            {
                //装载职位
                List <OccupationName>        onList       = occupationBLL.GetAllOccNameByClassId(Convert.ToInt32(formCollection["OccClassId"]));
                List <Models.OccupationName> occNameList2 = new List <Models.OccupationName>();
                foreach (var on in onList)
                {
                    Models.OccupationName tempName = new Models.OccupationName {
                        Id = on.Id, Name = on.Name
                    };
                    occNameList2.Add(tempName);
                }
                ViewData["occNameList"] = occNameList2;
            }



            return(View("StaffView"));
        }
Ejemplo n.º 16
0
        /// <summary>
        /// 处理机构管理请求
        /// </summary>
        /// <returns>返回视图,包含所有机构的信息</returns>
        public ActionResult OrgSettings()
        {
            IOrgBLL bLL = new OrgBLL();

            //装载所有1级机构
            List <Models.FirstOrg> firstOrgList = new List <Models.FirstOrg>();

            foreach (var fo in bLL.GetAllFirstOrg())
            {
                Models.FirstOrg firstOrg = new Models.FirstOrg
                {
                    Id       = fo.Id,
                    OrgName  = fo.OrgName,
                    OrgLevel = fo.OrgLevel
                };
                firstOrgList.Add(firstOrg);
            }

            ViewData["firstOrgList"] = firstOrgList;


            //装载所有2级机构
            List <Models.SecondeOrg> secondOrgList = new List <Models.SecondeOrg>();

            foreach (var so in bLL.GetAllSecondOrg())
            {
                Models.SecondeOrg secondeOrg = new Models.SecondeOrg
                {
                    Id       = so.Id,
                    OrgName  = so.OrgName,
                    OrgLevel = so.OrgLevel,
                };
                FirstOrg tempFirstOrg = bLL.GetFirstOrgById(so.ParentOrgId);
                secondeOrg.ParentOrg = new Models.FirstOrg
                {
                    Id       = tempFirstOrg.Id,
                    OrgName  = tempFirstOrg.OrgName,
                    OrgLevel = tempFirstOrg.OrgLevel
                };
                secondOrgList.Add(secondeOrg);
            }

            ViewData["secondOrgList"] = secondOrgList;


            //装载所有3级机构
            List <Models.ThirdOrg> thirdOrgList = new List <Models.ThirdOrg>();

            foreach (var to in bLL.GetAllThirdOrg())
            {
                Models.ThirdOrg thirdOrg = new Models.ThirdOrg
                {
                    Id       = to.Id,
                    OrgName  = to.OrgName,
                    OrgLevel = to.OrgLevel,
                };
                SecondOrg tempSecondeOrg = bLL.GetSecondOrgById(to.ParentOrgId);
                FirstOrg  tempFirstOrg   = bLL.GetFirstOrgById(tempSecondeOrg.ParentOrgId);
                thirdOrg.ParentOrg = new Models.SecondeOrg
                {
                    Id        = tempSecondeOrg.Id,
                    OrgName   = tempSecondeOrg.OrgName,
                    OrgLevel  = tempSecondeOrg.OrgLevel,
                    ParentOrg = new Models.FirstOrg {
                        Id = tempFirstOrg.Id, OrgLevel = tempFirstOrg.OrgLevel, OrgName = tempFirstOrg.OrgName
                    }
                };
                thirdOrgList.Add(thirdOrg);
            }

            ViewData["thirdOrgList"] = thirdOrgList;

            return(View());
        }
Ejemplo n.º 17
0
        void LoadData()
        {
            Org org = null;

            try
            {
                org = OrgBLL.GetByName(txtOrg.Text.Trim());
            }
            catch (Exception)
            {
                org = null;
            }



            DateTime?dtFrom = txtDateFrom.Text.ToDatetimeFromVNFormat();
            DateTime?dtTo   = txtDateTo.Text.ToDatetimeFromVNFormat();

            if (dtFrom.HasValue)
            {
                DateTime hourFrom;
                if (DateTime.TryParse(txtHourFrom.Text, out hourFrom))
                {
                    dtFrom = dtFrom.Value.AddHours(hourFrom.Hour).AddMinutes(hourFrom.Minute);
                }
            }

            if (dtTo.HasValue)
            {
                DateTime hourTo;
                if (DateTime.TryParse(txtHourTo.Text, out hourTo))
                {
                    dtTo = dtTo.Value.AddHours(hourTo.Hour).AddMinutes(hourTo.Minute);
                }
            }

            RedBloodDataContext db = new RedBloodDataContext();

            var v = db.Orders.Where(r => r.Date.Value >= dtFrom && r.Date.Value <= dtTo)
                    .ToList()
                    .Where(r =>
                           (org == null || (r.OrgID == org.ID))
                           )
                    //.OrderBy(r => r.Date)
                    //.ToList()
                    //.Select(r => new
                    //{
                    //    r.ID,
                    //    r.Name,
                    //    Date = r.Date.ToStringVN_Hour(),
                    //    r.Actor,
                    //    r.Type,
                    //    For = r.Type == Order.TypeX.ForCR ? r.Org.Name : r.People.Name,
                    //})
                    .SelectMany(r => r.PackOrders.Select(r1 => r1.Pack))
                    .ToList()
                    .GroupBy(r => new { r.ProductCode })
                    .Select(r => new
            {
                ProductCode      = r.Key.ProductCode,
                ProductDesc      = ProductBLL.GetDesc(r.Key.ProductCode),
                Total            = r.Count(),
                BloodGroupSumary = r.GroupBy(r1 => r1.Donation.BloodGroup).Select(r1 => new
                {
                    BloodGroupDesc = BloodGroupBLL.GetDescription(r1.Key),
                    Total          = r1.Count(),
                    VolumeSumary   = r1.GroupBy(r2 => r2.Volume).Select(r2 => new
                    {
                        Volume = r2.Key.HasValue ? r2.Key.Value.ToString() : "_",
                        Total  = r2.Count()
                    }).OrderBy(r2 => r2.Volume)
                }).OrderBy(r1 => r1.BloodGroupDesc),
                //VolumeSumary = sub.GroupBy(r1 => r1.Volume, (r1, VolSub) => new
                //{
                //    Volume = r1.HasValue ? r1.Value.ToString() : "_",
                //    Total = VolSub.Sum(r3 => r3.Count)
                //}).OrderBy(r1 => r1.Volume)
            })
                    .OrderBy(r => r.ProductDesc);

            GridView1.DataSource = v;
            GridView1.DataBind();
        }
Ejemplo n.º 18
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;
        }
Ejemplo n.º 19
0
        private bool LoadFromGUI(Campaign p)
        {
            bool isDone = true;

            try
            {
                p.Name = txtName.Text.Trim();
                divErrName.Attributes["class"] = "hidden";
            }
            catch (Exception ex)
            {
                divErrName.InnerText           = ex.Message;
                divErrName.Attributes["class"] = "err";
                isDone = false;
            }

            p.Est = txtEst.Text.ToIntNullable();


            try
            {
                p.Date = txtDate.Text.ToDatetimeFromVNFormat();
                divErrDate.Attributes["class"] = "hidden";
            }
            catch (Exception ex)
            {
                divErrDate.Attributes["class"] = "err";
                divErrDate.InnerText           = ex.Message;
                isDone = false;
            }

            //if (ddlSource.SelectedValue.ToInt() == 0)
            //    p.SourceID = null;
            //else
            //    p.SourceID = ddlSource.SelectedValue.ToInt();

            try
            {
                p.SourceID = ddlSource.SelectedValue.ToInt();
                divErrSrc.Attributes["class"] = "hidden";
            }
            catch (Exception ex)
            {
                divErrSrc.Attributes["class"] = "err";
                divErrSrc.InnerText           = ex.Message;
                isDone = false;
            }

            if (chkInfiCam.Checked)
            {
                p.Type = Campaign.TypeX.Long_run;
            }
            else
            {
                p.Type = Campaign.TypeX.Short_run;
            }

            try
            {
                //p.CoopOrg = OrgBLL.GetByName(txtCoopOrgName.Text.Trim());
                p.CoopOrgID = OrgBLL.GetByName(txtCoopOrgName.Text.Trim()).ID;
                divErrCoopOrgName.Attributes["class"] = "hidden";
            }
            catch (Exception ex)
            {
                divErrCoopOrgName.Attributes["class"] = "err";
                divErrCoopOrgName.InnerText           = ex.Message;
                isDone = false;
            }

            try
            {
                //p.HostOrg = OrgBLL.GetByName(txtHostOrgName.Text.Trim());
                p.HostOrgID = OrgBLL.GetByName(txtHostOrgName.Text.Trim()).ID;
                divErrHostOrgName.Attributes["class"] = "hidden";
            }
            catch (Exception ex)
            {
                divErrHostOrgName.Attributes["class"] = "err";
                divErrHostOrgName.InnerText           = ex.Message;
                isDone = false;
            }

            p.ContactName  = txtContactName.Text;
            p.ContactPhone = txtContactPhone.Text;
            p.ContactTitle = txtContactTitle.Text;

            p.Note = txtNote.Text;

            return(isDone);
        }
Ejemplo n.º 20
0
        /// <summary>
        /// 列表展示所有员工档案
        /// </summary>
        /// <returns>返回列表展示视图</returns>
        public ActionResult StaffView()
        {
            IStaffBLL bLL = new StaffBLL();

            IOrgBLL orgBLL = new OrgBLL();

            IOccupationBLL occupationBLL = new OccupationBLL();

            List <Staff> staffList = bLL.GetAllStaffNormal();

            List <Models.Staff> staffListView = new List <Models.Staff>();

            foreach (var staff in staffList)
            {
                Models.Staff tempStaff = new Models.Staff
                {
                    Id = staff.Id,
                    StaffFileNumber = staff.StaffFileNumber,
                    StaffName       = staff.StaffName,
                    FileState       = staff.FileState,
                    IsDel           = staff.IsDel
                };
                ThirdOrg  thirdOrg  = orgBLL.GetThirdOrgById(staff.ThirdOrgId);
                SecondOrg secondOrg = orgBLL.GetSecondOrgById(thirdOrg.ParentOrgId);
                FirstOrg  firstOrg  = orgBLL.GetFirstOrgById(secondOrg.ParentOrgId);

                tempStaff.FirstOrg = new Models.FirstOrg {
                    Id = firstOrg.Id, OrgLevel = firstOrg.OrgLevel, OrgName = firstOrg.OrgName
                };
                tempStaff.SecondeOrg = new Models.SecondeOrg {
                    Id = secondOrg.Id, OrgName = secondOrg.OrgName, OrgLevel = secondOrg.OrgLevel, ParentOrg = tempStaff.FirstOrg
                };
                tempStaff.ThirdOrg = new Models.ThirdOrg {
                    Id = thirdOrg.Id, ParentOrg = tempStaff.SecondeOrg, OrgLevel = thirdOrg.OrgLevel, OrgName = thirdOrg.OrgName
                };

                OccupationName occupationName = occupationBLL.GetOccupationNameById(staff.OccId);

                tempStaff.OccupationName = new Models.OccupationName {
                    Id = occupationName.Id, Name = occupationName.Name
                };

                staffListView.Add(tempStaff);
            }

            ViewData["staffListView"] = staffListView;

            //装载1级机构
            List <FirstOrg>        fList        = orgBLL.GetAllFirstOrg();
            List <Models.FirstOrg> firstOrgList = new List <Models.FirstOrg>();

            foreach (var fo in fList)
            {
                Models.FirstOrg tempFo = new Models.FirstOrg {
                    Id = fo.Id, OrgName = fo.OrgName, OrgLevel = fo.OrgLevel
                };
                firstOrgList.Add(tempFo);
            }
            ViewData["firstOrgList"] = firstOrgList;

            //装载职位类型
            List <OccupationClass>        ocList       = occupationBLL.GetAllOccupationClass();
            List <Models.OccupationClass> occClassList = new List <Models.OccupationClass>();

            foreach (var oc in ocList)
            {
                Models.OccupationClass tempClass = new Models.OccupationClass {
                    Id = oc.Id, Name = oc.Name
                };
                occClassList.Add(tempClass);
            }
            ViewData["occClassList"] = occClassList;


            return(View());
        }