コード例 #1
0
        public ActionResult EmployeeReg(EMPLOYEE_COND Cond, int?id = -1)
        {
            int?          member_code = id;
            EMPLOYEE_INFO data        = new EMPLOYEE_INFO();

            if (SessionHelper.LoginInfo.EMPLOYEE.STORE_CODE != 1)
            {
                Cond.STORE_CODE = SessionHelper.LoginInfo.EMPLOYEE.STORE_CODE;
            }
            if (id >= 0)
            {
                data = Service.employeeService.GetEmployeeList(new EMPLOYEE_COND {
                    MEMBER_CODE = id
                }).FirstOrDefault();
            }

            if (data == null || data.MEMBER_CODE == null)
            {
                data = new EMPLOYEE_INFO()
                {
                    COMPANY_CODE = Cond.COMPANY_CODE, STORE_CODE = Cond.STORE_CODE, DEPT_CODE = Cond.DEPT_CODE
                };
                var storelist = new BasicService().GetStoreList(new T_STORE_COND {
                    STORE_CODE = data.STORE_CODE
                });
                if (storelist.Count() == 1)
                {
                    data.COMPANY_CODE = storelist[0].COMPANY_CODE;
                    data.COMPANY_NAME = storelist[0].COMPANY_NAME;
                    data.STORE_CODE   = storelist[0].STORE_CODE;
                    data.STORE_NAME   = storelist[0].STORE_NAME;
                }
            }

            if (SessionHelper.LoginInfo.STORE.STORE_CODE != 1)
            {
                Cond.COMPANY_CODE = SessionHelper.LoginInfo.STORE.COMPANY_CODE;
            }

            if (SessionHelper.LoginInfo.EMPLOYEE.STORE_CODE != 1 && !(SessionHelper.LoginInfo.STORE.STORE_TYPE == 1 || SessionHelper.LoginInfo.STORE.STORE_TYPE == 4))
            {
                Cond.STORE_CODE = SessionHelper.LoginInfo.STORE.STORE_CODE;
            }

            ViewBag.data    = data;
            data.STORE_CODE = (data.STORE_CODE == null ? 1 : data.STORE_CODE);
            List <SelectListItem> deptCombo = Service.employeeService.GetStoreDept(new T_STORE_DEPT()
            {
                STORE_CODE = data.STORE_CODE
            }).Select(x => new SelectListItem()
            {
                Text = x.DEPT_NAME, Value = x.DEPT_CODE.ToString()
            }).ToList();

            ViewBag.deptCombo = (deptCombo == null) ? new List <SelectListItem>() : deptCombo;

            IList <T_STORE_POSITION> positionList = Service.employeeService.GetStorePosition(new T_STORE_POSITION()
            {
                STORE_CODE = data.STORE_CODE, HIDE = false
            });

            if (positionList != null)
            {
                int positionSeq = positionList.Where(x => x.POSITION_TYPE == 1 && x.POSITION_CODE == SessionHelper.LoginInfo.EMPLOYEE.COMP_POSITION).First().SEQ;
                int titleSeq    = positionList.Where(x => x.POSITION_TYPE == 2 && x.POSITION_CODE == SessionHelper.LoginInfo.EMPLOYEE.COMP_TITLE).First().SEQ;
                ViewBag.positionCombo1 = positionList.Where(x => x.POSITION_TYPE == 1 && x.SEQ >= positionSeq).Select(x => new SelectListItem()
                {
                    Text = x.NAME, Value = x.POSITION_CODE.ToString()
                }).ToList();                                                                                                                                                                                       //직급
                ViewBag.positionCombo2 = positionList.Where(x => x.POSITION_TYPE == 2 && x.SEQ >= titleSeq).Select(x => new SelectListItem()
                {
                    Text = x.NAME, Value = x.POSITION_CODE.ToString()
                }).ToList();                                                                                                                                                                                   //직책
            }


            IList <T_STORE_WEBMENU_GROUP> menuGroupList = Service.employeeService.GetMenuGroupList(new T_STORE_WEBMENU_GROUP()
            {
                STORE_CODE = data.STORE_CODE, HIDE = false
            });

            var menuGroup    = menuGroupList.Where(w => w.GROUP_CODE == SessionHelper.LoginInfo.EMPLOYEE.MENU_GROUP).FirstOrDefault();
            var chkGroupCode = (menuGroup == null) ? 1 : menuGroup.ORDER_SEQ;

            ViewBag.menuGroupList = (menuGroupList == null) ? new List <SelectListItem>() : menuGroupList.Where(w => w.ORDER_SEQ >= chkGroupCode).Select(x => new SelectListItem()
            {
                Text = x.GROUP_NAME, Value = x.GROUP_CODE.ToString()
            }).ToList();

            return(View());
        }