Exemplo n.º 1
0
        /// <summary>
        /// 查询员工信息
        /// </summary>
        /// <param name="request"></param>
        /// <param name="response"></param>
        public void QueryStaffInfo(StaffConfig request, StaffConfigResponse response)
        {
            var list = _privilegeRepository.QueryStaffInfo(request.DepartNo, request.StaffNo);

            response.QueryData = new Report {
                total = list.Count, rows = list
            };
            response.ResponseStatus.ErrorCode = "OK";
        }
Exemplo n.º 2
0
        public ActionResult DeletePrStaffConfig(IEnumerable <string> ids)
        {
            StaffConfig request = new StaffConfig
            {
                RequestType = 3,
                StaffNo     = ids.First()
            };
            StaffConfigResponse response = WeChatHelper.PostService <StaffConfig, StaffConfigResponse>("StaffConfig", request);

            return(Json(response, JsonRequestBehavior.DenyGet));
        }
Exemplo n.º 3
0
        public ActionResult QueryPrStaffConfig(string searchDeptId, string searchStaffNo)
        {
            StaffConfig request = new StaffConfig
            {
                RequestType = 0,
                DepartNo    = searchDeptId,
                StaffNo     = searchStaffNo
            };
            string response = WeChatHelper.PostService("StaffConfig", request);

            return(JavaScript(response));
        }
Exemplo n.º 4
0
        public void DeleteStaffInfo(StaffConfig request, StaffConfigResponse response)
        {
            ValidRequest(request, new StaffConfigVaildator(), ruleSet: "Delete");
            //验证员工编号是否存在
            var staffConfigs = _privilegeRepository.QueryStaffInfo();

            if (!(staffConfigs.Any(i => i.STAFFNO == request.StaffNo)))
            {
                throw new Utility.WeChatException("STAFF_DELETE_ERROR", "当前员工编号在库中不存在,无法删除");
            }
            _privilegeRepository.DeleteStaffInfo(request.StaffNo);

            response.ResponseStatus.ErrorCode = "OK";
        }
Exemplo n.º 5
0
        public ActionResult AddPrStaffConfig(string staffNo, string staffName, string departNo, string dimissionTag)
        {
            StaffConfig request = new StaffConfig
            {
                RequestType  = 1,
                StaffNo      = staffNo,
                StaffName    = staffName,
                DepartNo     = departNo,
                DimissionTag = dimissionTag,
                CurrOper     = Session["StaffNo"].CastTo(""),
            };
            StaffConfigResponse response = WeChatHelper.PostService <StaffConfig, StaffConfigResponse>("StaffConfig", request);

            return(Json(response, JsonRequestBehavior.DenyGet));
        }
Exemplo n.º 6
0
        public void ModifyStaffInfo(StaffConfig request, StaffConfigResponse response)
        {
            ValidRequest(request, new StaffConfigVaildator(), ruleSet: "Edit");
            //验证员工编号是否存在
            var staffConfigs = _privilegeRepository.QueryStaffInfo();

            if (!(staffConfigs.Any(i => i.STAFFNO == request.StaffNo)))
            {
                throw new Utility.WeChatException("STAFF_EDIT_ERROR", "当前员工编号在库中不存在,无法编辑");
            }
            DateTime updateTime = DateTime.Now;

            _privilegeRepository.UpdateStaffInfo(request.StaffNo, request.StaffName,
                                                 request.DepartNo, request.DimissionTag, request.CurrOper, updateTime);

            response.ResponseStatus.ErrorCode = "OK";
        }
Exemplo n.º 7
0
        public void AddStaffInfo(StaffConfig request, StaffConfigResponse response)
        {
            ValidRequest(request, new StaffConfigVaildator(), ruleSet: "Add");
            //验证员工编号是否重复
            var staffConfigs = _privilegeRepository.QueryStaffInfo();

            if (staffConfigs.Any(i => i.STAFFNO == request.StaffNo))
            {
                throw new Utility.WeChatException("STAFF_ADD_ERROR", "员工号在库中存在重复记录");
            }

            DateTime updateTime = DateTime.Now;

            _privilegeRepository.InsertStaffInfo(request.StaffNo, request.StaffName,
                                                 DecryptPwdHelper.EncodePwd("123456"),
                                                 request.DepartNo, request.DimissionTag, request.CurrOper, updateTime);

            response.ResponseStatus.ErrorCode = "OK";
        }
Exemplo n.º 8
0
        /// <summary>
        /// 员工维护
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        public object Post(StaffConfig request)
        {
            StaffConfigResponse rsp = new StaffConfigResponse();

            if (request.RequestType == (short)StaffConfigRequestType.QueryStaffInfo)
            {
                _privilegeService.QueryStaffInfo(request, rsp);
            }
            if (request.RequestType == (short)StaffConfigRequestType.AddStaffInfo)
            {
                _privilegeService.AddStaffInfo(request, rsp);
            }
            if (request.RequestType == (short)StaffConfigRequestType.ModifyStaffInfo)
            {
                _privilegeService.ModifyStaffInfo(request, rsp);
            }
            if (request.RequestType == (short)StaffConfigRequestType.DeleteStaffInfo)
            {
                _privilegeService.DeleteStaffInfo(request, rsp);
            }
            return(rsp);
        }