public ActionResult SaveOccupationName(string OccpationNameId, string OccpationName, string classId, string standardId)
        {
            IOccupationBLL bLL = new OccupationBLL();

            ISalaryBLL salaryBLL = new SalaryBLL();

            OccupationName occupationName = new OccupationName {
                Id = Convert.ToInt32(OccpationNameId), Name = OccpationName, ClassId = Convert.ToInt32(classId)
            };

            if (bLL.SaveOccupationName(occupationName))
            {
                occupationName = bLL.GetOccupationNameByNameAndClass(OccpationName, Convert.ToInt32(classId));

                StandardMapOccupationName mapOcc = new StandardMapOccupationName {
                    OccupationNameId = occupationName.Id, StandardId = Convert.ToInt32(standardId)
                };

                if (salaryBLL.SaveMapOcc(mapOcc))
                {
                    TempData["info"] = "保存成功";
                    return(Redirect("/Settings/OccupationSettings"));
                }
                else
                {
                    TempData["error"] = "保存失败";
                    return(Redirect(Request.UrlReferrer.AbsoluteUri));
                }
            }
            else
            {
                TempData["error"] = "保存失败";
                return(Redirect(Request.UrlReferrer.AbsoluteUri));
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Update Database Make data as Obsoluted
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void IsObsolete_CheckedChanged(Object sender, EventArgs e)
        {
            string message = string.Empty;

            try
            {
                CheckBox    chk = (CheckBox)sender;
                GridViewRow gr  = (GridViewRow)chk.Parent.Parent;
                ViewState["OCCUPATIONID"] = ((Literal)gr.FindControl("litOCCUPATIONID")).Text;
                OccupationBLL OccupationBLLOBJ = new OccupationBLL();
                message = OccupationBLLOBJ.ObsoleteOccupation(Convert.ToInt32(ViewState["OCCUPATIONID"]), Convert.ToString(chk.Checked));
                if (string.IsNullOrEmpty(message) || message == "" || message == "null")
                {
                    message = "Data updated successfully";
                }
                AllClear();
                BindGrid(true, true);
                SetUpdateMode(false);
                if (message != "")
                {
                    ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "Added", "alert('" + message + "');", true);
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Set Grid Data source
        /// </summary>
        /// <param name="addRow"></param>
        /// <param name="deleteRow"></param>e
        private void BindGrid(bool addRow, bool deleteRow)
        {
            OccupationBLL OccupationBLLobj = new OccupationBLL();

            grdOccupation.DataSource = OccupationBLLobj.GetALLOccupation();
            grdOccupation.DataBind();
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Set edit mode for edit comand
        /// Delete data from the database for delete comand
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void grdOccupation_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            string message = string.Empty;

            if (e.CommandName == "EditRow")
            {
                ViewState["OCCUPATIONID"] = e.CommandArgument;
                GetOCCUPATIONDetails();
                SetUpdateMode(true);
                ScriptManager.RegisterStartupScript(this, this.GetType(), "Added", "setDirty();", true);
            }
            else if (e.CommandName == "DeleteRow")
            {
                // ViewState["OCCUPATIONID"] = e.CommandArgument;
                OccupationBLL OccupationBLLobj = new OccupationBLL();
                message = OccupationBLLobj.DeleteOccupation(Convert.ToInt32(e.CommandArgument));
                if (string.IsNullOrEmpty(message) || message == "" || message == "null")
                {
                    message = "Data Deleted successfully";
                }
                AllClear();
                BindGrid(true, true);
                SetUpdateMode(false);
            }

            if (message != "")
            {
                ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "Added", "alert('" + message + "');", true);
            }
        }
        public ActionResult DynamicOccName(string id)
        {
            IOccupationBLL        bLL      = new OccupationBLL();
            List <OccupationName> list     = new List <OccupationName>();
            List <OccupationName> tempList = bLL.GetAllOccNameByClassId(Convert.ToInt32(id));

            if (tempList != null)
            {
                list = tempList;
            }
            return(Json(list));
        }
Ejemplo n.º 6
0
        /// <summary>
        /// 处理在编辑或添加薪酬标准时发出的添加适用职位请求
        /// </summary>
        /// <param name="formCollection">提交上来的表单容器</param>
        /// <returns>返回添加职位选项后的视图</returns>
        public ActionResult StandardAddOccName(FormCollection formCollection)
        {
            ViewData["formCollection"] = formCollection;

            ISalaryItemBLL salaryItemBLL = new SalaryItemBLL();

            IOccupationBLL occupationBLL = new OccupationBLL();

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

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

            //装载所有职位
            List <OccupationName>        occNameList     = occupationBLL.GetAllOccupationName();
            List <Models.OccupationName> occNameListView = new List <Models.OccupationName>();

            foreach (var on in occNameList)
            {
                Models.OccupationName tempName = new Models.OccupationName {
                    Id = on.Id, Name = on.Name
                };
                OccupationClass tempClass = occupationBLL.GetOccupationClassById(on.ClassId);
                tempName.OccupationClass = new Models.OccupationClass {
                    Id = tempClass.Id, Name = tempClass.Name
                };
                occNameListView.Add(tempName);
            }
            ViewData["occNameListView"] = occNameListView;

            //装载所有薪酬项目
            List <SalaryItem>        itemList     = salaryItemBLL.GetAllSalaryItem();
            List <Models.SalaryItem> itemListView = new List <Models.SalaryItem>();

            foreach (var item in itemList)
            {
                Models.SalaryItem tempItem = new Models.SalaryItem {
                    Id = item.Id, Name = item.Name
                };
                itemListView.Add(tempItem);
            }
            ViewData["itemListView"] = itemListView;

            return(View());
        }
Ejemplo n.º 7
0
        /// <summary>
        /// Delete the data in the Grid
        /// </summary>

        private void DeleteOCCUPATION()
        {
            OccupationBLL OccupationBLLobj = new OccupationBLL();
            int           OCCUPATIONID     = 0;

            if (ViewState["OCCUPATIONID"] != null)
            {
                OCCUPATIONID = Convert.ToInt32(ViewState["OCCUPATIONID"].ToString());
            }

            //Result = OccupationBLLobj.DeleteOccupation(OCCUPATIONID);
        }
Ejemplo n.º 8
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());
        }
        public ActionResult DeleteOccupationClass(string id)
        {
            IOccupationBLL bLL = new OccupationBLL();

            if (bLL.DeleteOccupationClassById(Convert.ToInt32(id)))
            {
                TempData["info"] = "已删除";
                return(Redirect("/Settings/OccupationSettings"));
            }
            else
            {
                TempData["error"] = "删除失败,该职位类型下有职位,无法直接删除";
                return(Redirect(Request.UrlReferrer.AbsoluteUri));
            }
        }
        public ActionResult DeleteTechnicalTitle(string id)
        {
            IOccupationBLL bLL = new OccupationBLL();

            if (bLL.DeleteTechnicalTitle(Convert.ToInt32(id)))
            {
                TempData["info"] = "已删除";
                return(Redirect("/Settings/TitleSettings"));
            }
            else
            {
                TempData["error"] = "删除失败";
                return(Redirect(Request.UrlReferrer.AbsoluteUri));
            }
        }
Ejemplo n.º 11
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());
        }
        public ActionResult EditOccupationClass(string id)
        {
            IOccupationBLL bLL = new OccupationBLL();

            OccupationClass occupationClass = bLL.GetOccupationClassById(Convert.ToInt32(id));

            Models.OccupationClass occupationClassView = new Models.OccupationClass
            {
                Id   = occupationClass.Id,
                Name = occupationClass.Name
            };

            ViewData["occupationClassView"] = occupationClassView;

            return(View());
        }
        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());
        }
Ejemplo n.º 14
0
        /// <summary>
        /// get the Grid value into textBox
        /// </summary>


        private void GetOCCUPATIONDetails()
        {
            OccupationBLL OccupationBLLobj = new OccupationBLL();
            int           OCCUPATIONID     = 0;

            if (ViewState["OCCUPATIONID"] != null)
            {
                OCCUPATIONID = Convert.ToInt32(ViewState["OCCUPATIONID"]);
            }

            OccupationBO OccupationObj = new OccupationBO();

            OccupationObj = OccupationBLLobj.GetOccupationId(OCCUPATIONID);

            MainOccupationTextBox.Text   = OccupationObj.OCCUPATIONNAME;
            MainOccupationIDTextBox.Text = OccupationObj.OCCUPATIONID.ToString();
            //int ConcernID_test = Convert.ToInt32(ConcernObj.ConcernID);
        }
Ejemplo n.º 15
0
        /// <summary>
        /// 处理职称管理请求
        /// </summary>
        /// <returns>返回视图,包含所有职称信息</returns>
        public ActionResult TitleSettings()
        {
            IOccupationBLL bLL = new OccupationBLL();

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

            foreach (var tt in bLL.GetAllTechnicalTitle())
            {
                Models.TechnicalTitle tempTitle = new Models.TechnicalTitle {
                    Id = tt.Id, Name = tt.Name
                };
                titleList.Add(tempTitle);
            }

            ViewData["titleList"] = titleList;

            return(View());
        }
Ejemplo n.º 16
0
        /// <summary>
        /// 处理职位管理请求
        /// </summary>
        /// <returns>返回视图,包含所有职位信息</returns>
        public ActionResult OccupationSettings()
        {
            IOccupationBLL bLL = new OccupationBLL();

            //装载所有职位类型
            List <Models.OccupationClass> occupationClassList = new List <Models.OccupationClass>();

            foreach (var oc in bLL.GetAllOccupationClass())
            {
                Models.OccupationClass occupationClass = new Models.OccupationClass
                {
                    Id   = oc.Id,
                    Name = oc.Name
                };
                occupationClassList.Add(occupationClass);
            }

            ViewData["occupationClassList"] = occupationClassList;


            //装载所有职位名称
            List <Models.OccupationName> occupationNameList = new List <Models.OccupationName>();

            foreach (var on in bLL.GetAllOccupationName())
            {
                Models.OccupationName occupationName = new Models.OccupationName
                {
                    Id   = on.Id,
                    Name = on.Name
                };
                OccupationClass tempClass = bLL.GetOccupationClassById(on.ClassId);
                occupationName.OccupationClass = new Models.OccupationClass
                {
                    Id   = tempClass.Id,
                    Name = tempClass.Name
                };
                occupationNameList.Add(occupationName);
            }

            ViewData["occupationNameList"] = occupationNameList;

            return(View());
        }
Ejemplo n.º 17
0
        public ActionResult AddSalaryStandard()
        {
            ISalaryItemBLL bLL = new SalaryItemBLL();

            IOccupationBLL occupationBLL = new OccupationBLL();

            List <SalaryItem> tempList = bLL.GetAllSalaryItem();

            List <Models.SalaryItem> itemList = new List <Models.SalaryItem>();

            foreach (var item in tempList)
            {
                Models.SalaryItem tempItem = new Models.SalaryItem
                {
                    Id   = item.Id,
                    Name = item.Name
                };
                itemList.Add(tempItem);
            }

            ViewData["itemList"] = itemList;

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

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



            return(View());
        }
        public ActionResult SaveOccupationClass(string OccpationClassId, string OccpationClassName)
        {
            IOccupationBLL bLL = new OccupationBLL();

            OccupationClass occupationClass = new OccupationClass {
                Id = Convert.ToInt32(OccpationClassId), Name = OccpationClassName
            };

            if (bLL.SaveOccupationClass(occupationClass))
            {
                TempData["info"] = "保存成功";
                return(Redirect("/Settings/OccupationSettings"));
            }
            else
            {
                TempData["error"] = "保存失败";
                return(Redirect(Request.UrlReferrer.AbsoluteUri));
            }
        }
        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));
            }
        }
        public ActionResult EditOccupationName(string id)
        {
            IOccupationBLL bLL = new OccupationBLL();

            OccupationName occupationName = bLL.GetOccupationNameById(Convert.ToInt32(id));

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

            OccupationClass occupationClass = bLL.GetOccupationClassById(occupationName.ClassId);

            Models.OccupationClass occupationClassView = new Models.OccupationClass
            {
                Id   = occupationClass.Id,
                Name = occupationClass.Name
            };

            occupationNameView.OccupationClass = occupationClassView;

            ViewData["occupationNameView"] = occupationNameView;


            //装载所有的职位类型,用于职位类型选择的下拉框
            List <Models.OccupationClass> occupationClassList = new List <Models.OccupationClass>();

            foreach (var oc in bLL.GetAllOccupationClass())
            {
                Models.OccupationClass tempOccupationClass = new Models.OccupationClass
                {
                    Id   = oc.Id,
                    Name = oc.Name
                };
                occupationClassList.Add(tempOccupationClass);
            }

            ViewData["occupationClassList"] = occupationClassList;

            return(View());
        }
        public ActionResult AddOccupationName()
        {
            IOccupationBLL bLL = new OccupationBLL();

            ISalaryBLL salaryBLL = new SalaryBLL();

            //装载所有职位类型,作为下拉选择框
            List <Models.OccupationClass> occupationgClassList = new List <Models.OccupationClass>();

            foreach (var oc in bLL.GetAllOccupationClass())
            {
                Models.OccupationClass tempClass = new Models.OccupationClass
                {
                    Id   = oc.Id,
                    Name = oc.Name
                };
                occupationgClassList.Add(tempClass);
            }

            ViewData["occupationClassList"] = occupationgClassList;


            //装载所有薪酬标准
            List <Models.SalaryStandard> standardList = new List <Models.SalaryStandard>();

            foreach (var s in salaryBLL.GetAllSalaryStandard())
            {
                Models.SalaryStandard tempS = new Models.SalaryStandard
                {
                    Id           = s.Id,
                    StandardName = s.StandardName,
                    Total        = s.Total
                };
                standardList.Add(tempS);
            }
            ViewData["standardList"] = standardList;


            return(View());
        }
Ejemplo n.º 22
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.º 23
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.º 24
0
        /// <summary>
        /// 控制器内部方法,通过id获取薪酬标准的详细信息
        /// </summary>
        /// <param name="id">薪酬标准的id</param>
        private void GetStandardById(string id)
        {
            ISalaryBLL salaryBLL = new SalaryBLL();

            ISalaryItemBLL salaryItemBLL = new SalaryItemBLL();

            IOccupationBLL occupationBLL = new OccupationBLL();

            //通过id查找到薪酬标准
            SalaryStandard salaryStandard = salaryBLL.GetSalaryStandardById(Convert.ToInt32(id));

            //视图模型薪酬标准
            Models.SalaryStandard salaryStandardView = new Models.SalaryStandard
            {
                Id                 = salaryStandard.Id,
                StandardName       = salaryStandard.StandardName,
                StandardFileNumber = salaryStandard.StandardFileNumber,
                Registrant         = salaryStandard.Registrant,
                RegistTime         = salaryStandard.RegistTime,
                DesignBy           = salaryStandard.DesignBy,
                Total              = salaryStandard.Total,
                StandardState      = salaryStandard.StandardState,
                CheckDesc          = salaryStandard.CheckDesc,
                CheckBy            = salaryStandard.CheckBy
            };

            //通过薪酬标准的id找到所有的项目映射关系
            List <StandardMapItem> tempMapList = salaryBLL.GetAllStandardMapItemByStandardId(salaryStandard.Id);

            //遍历映射关系,并把薪酬项目和薪酬项目的金额装载到视图模型薪酬标准的字典中
            foreach (var m in tempMapList)
            {
                SalaryItem        tempSalaryItem = salaryItemBLL.GetSalaryItemById(m.ItemId);
                Models.SalaryItem salaryItemView = new Models.SalaryItem {
                    Id = tempSalaryItem.Id, Name = tempSalaryItem.Name
                };
                salaryStandardView.ItemAmout.Add(salaryItemView, m.Amout);
            }

            //通过薪酬标准的id找到所有的职位映射关系
            List <StandardMapOccupationName> occList = salaryBLL.GetAllStandardMapOccByStandardId(salaryStandard.Id);

            if (occList != null)
            {
                foreach (var o in occList)
                {
                    OccupationName        tempOccName        = occupationBLL.GetOccupationNameById(o.OccupationNameId);
                    Models.OccupationName occupationNameView = new Models.OccupationName {
                        Id = tempOccName.Id, Name = tempOccName.Name
                    };
                    OccupationClass tempOccClass = occupationBLL.GetOccupationClassById(tempOccName.ClassId);
                    occupationNameView.OccupationClass = new Models.OccupationClass {
                        Id = tempOccClass.Id, Name = tempOccClass.Name
                    };
                    salaryStandardView.OccList.Add(occupationNameView);
                }
            }

            ViewData["salaryStandardView"] = salaryStandardView;


            //装载所有薪酬项目
            List <SalaryItem> salaryList = salaryItemBLL.GetAllSalaryItem();

            List <Models.SalaryItem> itemList = new List <Models.SalaryItem>();

            foreach (var item in salaryList)
            {
                Models.SalaryItem tempItem = new Models.SalaryItem
                {
                    Id   = item.Id,
                    Name = item.Name
                };
                itemList.Add(tempItem);
            }

            ViewData["itemList"] = itemList;

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

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


            //装载所有该薪酬标准的职位类型下的所有职位
            List <Models.OccupationName> occNameList = new List <Models.OccupationName>();

            for (int i = 0; i < salaryStandardView.OccList.Count; i++)
            {
                List <OccupationName> tempList = occupationBLL.GetAllOccNameByClassId(salaryStandardView.OccList[i].OccupationClass.Id);
                foreach (var on in tempList)
                {
                    Models.OccupationName tempOccupationName = new Models.OccupationName {
                        Id = on.Id, Name = on.Name, OccupationClass = salaryStandardView.OccList[i].OccupationClass
                    };
                    occNameList.Add(tempOccupationName);
                }
            }
            ViewData["occNameList"] = occNameList;
        }
Ejemplo n.º 25
0
        /// <summary>
        /// 薪酬标准详情
        /// </summary>
        /// <param name="id">薪酬标准的id</param>
        /// <returns>薪酬标准详情页</returns>
        public ActionResult DetailSalaryStandard(string id)
        {
            ISalaryBLL salaryBLL = new SalaryBLL();

            ISalaryItemBLL salaryItemBLL = new SalaryItemBLL();

            IOccupationBLL occupationBLL = new OccupationBLL();

            //通过id查找到薪酬标准
            SalaryStandard salaryStandard = salaryBLL.GetSalaryStandardById(Convert.ToInt32(id));

            //视图模型薪酬标准
            Models.SalaryStandard salaryStandardView = new Models.SalaryStandard
            {
                Id                 = salaryStandard.Id,
                StandardName       = salaryStandard.StandardName,
                StandardFileNumber = salaryStandard.StandardFileNumber,
                Registrant         = salaryStandard.Registrant,
                RegistTime         = salaryStandard.RegistTime,
                DesignBy           = salaryStandard.DesignBy,
                Total              = salaryStandard.Total,
                StandardState      = salaryStandard.StandardState,
                CheckDesc          = salaryStandard.CheckDesc,
                CheckBy            = salaryStandard.CheckBy
            };

            //通过薪酬标准的id找到所有的项目映射关系
            List <StandardMapItem> tempMapList = salaryBLL.GetAllStandardMapItemByStandardId(salaryStandard.Id);

            //遍历映射关系,并把薪酬项目和薪酬项目的金额装载到视图模型薪酬标准的字典中
            foreach (var m in tempMapList)
            {
                SalaryItem        tempSalaryItem = salaryItemBLL.GetSalaryItemById(m.ItemId);
                Models.SalaryItem salaryItemView = new Models.SalaryItem {
                    Id = tempSalaryItem.Id, Name = tempSalaryItem.Name
                };
                salaryStandardView.ItemAmout.Add(salaryItemView, m.Amout);
            }

            //通过薪酬标准的id找到所有的职位映射关系
            List <StandardMapOccupationName> occList = salaryBLL.GetAllStandardMapOccByStandardId(salaryStandard.Id);

            if (occList != null)
            {
                foreach (var o in occList)
                {
                    OccupationName        tempOccName        = occupationBLL.GetOccupationNameById(o.OccupationNameId);
                    Models.OccupationName occupationNameView = new Models.OccupationName {
                        Id = tempOccName.Id, Name = tempOccName.Name
                    };
                    OccupationClass tempOccClass = occupationBLL.GetOccupationClassById(tempOccName.ClassId);
                    occupationNameView.OccupationClass = new Models.OccupationClass {
                        Id = tempOccClass.Id, Name = tempOccClass.Name
                    };
                    salaryStandardView.OccList.Add(occupationNameView);
                }
            }

            ViewData["salaryStandardView"] = salaryStandardView;

            return(View());
        }
Ejemplo n.º 26
0
        /// <summary>
        /// To save details to database
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>

        protected void SaveButton_Click(object sender, EventArgs e)
        {
            //int count = 0;
            string AlertMessage = string.Empty;
            string message      = string.Empty;

            if (MainOccupationTextBox.Text.ToString().Trim() == string.Empty)
            {
                //errMsgMainOccupationLabel.Text = "Enter the Concern";
            }
            else if (MainOccupationIDTextBox.Text.ToString().Trim() == string.Empty)
            {
                OccupationBLL OccupationBLLOBJ = new OccupationBLL();
                try
                {
                    string       uID           = Session["USER_ID"].ToString();
                    OccupationBO objOccupation = new OccupationBO();
                    objOccupation.OCCUPATIONNAME = MainOccupationTextBox.Text.ToString().Trim();
                    objOccupation.UserID         = Convert.ToInt32(uID);

                    OccupationBLL OccupationBLLobj = new OccupationBLL();
                    message = OccupationBLLobj.Insert(objOccupation);

                    //if (count == -1)
                    //{
                    //    msgSaveLabel.Text = "Data saved successfully"; //messageSaveLable
                    //    BindGrid(true, true);
                    //}
                    //else
                    //{
                    //    msgSaveLabel.Text = "Data not saved successfully";
                    //}

                    if (string.IsNullOrEmpty(message) || message == "" || message == "null")
                    {
                        message = "Data saved successfully";
                        AllClear();
                        // ClearDetails();
                        BindGrid(true, true);
                    }
                }
                catch (Exception ex)
                {
                    throw ex;
                }

                finally
                {
                    OccupationBLLOBJ = null;
                }
            }
            //edit the data in the textbox exiting in the Grid
            else if (MainOccupationIDTextBox.Text.ToString().Trim() != string.Empty)
            {
                ConcernBLL concernBLLOBJ = new ConcernBLL();

                try
                {
                    string       uID           = Session["USER_ID"].ToString();
                    OccupationBO objOccupation = new OccupationBO();
                    objOccupation.OCCUPATIONNAME = MainOccupationTextBox.Text.ToString().Trim();
                    objOccupation.OCCUPATIONID   = Convert.ToInt32(MainOccupationIDTextBox.Text.ToString().Trim());
                    objOccupation.UserID         = Convert.ToInt32(uID);

                    OccupationBLL OccupationBLLobj = new OccupationBLL();
                    message = OccupationBLLobj.EDITOccupation(objOccupation);

                    //if (count == -1)
                    //{
                    //    msgSaveLabel.Text = "Data saved successfully"; //messageSaveLable
                    //    BindGrid(true, true);
                    //}
                    //else
                    //{
                    //    msgSaveLabel.Text = "Data not saved successfully";
                    //}

                    if (string.IsNullOrEmpty(message) || message == "" || message == "null")
                    {
                        message = "Data updated successfully";
                        // ClearDetails();
                        AllClear();
                        BindGrid(true, true);
                        SetUpdateMode(false);
                    }
                }
                catch (Exception ex)
                {
                    throw ex;
                }

                finally
                {
                    concernBLLOBJ = null;
                }
            }
            AlertMessage = "alert('" + message + "');";
            ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "Added", AlertMessage, true);
        }
Ejemplo n.º 27
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());
        }