Beispiel #1
0
        //[AuthCheck(Module = WebModule.Contract, Right = SystemRight.Add)]
        public ActionResult Add(Epm_Contract model)
        {
            ResultView <int> view = new ResultView <int>();

            string fileDataJson = Request.Form["fileDataJsonFile"];                                        //获取上传文件json字符串

            List <Base_Files> fileList = JsonConvert.DeserializeObject <List <Base_Files> >(fileDataJson); //将文件信息json字符

            string contractTypeName = Request.Form["ContractTypeName"];

            if (contractTypeName == ContractType.Contract.ToString())
            {
                model.ContractType = 1;
            }
            else if (contractTypeName == ContractType.FrameContract.ToString())
            {
                model.ContractType = 2;
            }
            //表单校验
            if (string.IsNullOrEmpty(model.Name))
            {
                view.Flag    = false;
                view.Message = "名称不能为空";
                return(Json(view));
            }
            if (string.IsNullOrEmpty(model.Code))
            {
                view.Flag    = false;
                view.Message = "编码不能为空";
                return(Json(view));
            }
            Result <int> result = new Result <int>();

            using (ClientSiteClientProxy proxy = new ClientSiteClientProxy(ProxyEx(Request)))
            {
                result = proxy.AddContract(model, fileList);
            }
            return(Json(result.ToResultView()));
        }