Esempio n. 1
0
        public ActionResult Add(Base_Company model, string belong)
        {
            model.Type = belong;

            string            fileDataJson = Request.Form["fileDataJson"];                                     //获取上传文件json字符串
            List <Base_Files> fileList     = JsonConvert.DeserializeObject <List <Base_Files> >(fileDataJson); //将文件信息json字符串序列化为列表

            Result <int>          result        = new Result <int>();
            Result <Base_Company> companyResult = new Result <Base_Company>();

            using (AdminClientProxy proxy = new AdminClientProxy(ProxyEx(Request)))
            {
                //获取上级单位信息
                if (model.PId == 0)
                {
                    model.PreName = null;
                    model.PreCode = null;
                }
                else
                {
                    companyResult = proxy.GetCompanyModel(model.PId);
                    model.PreName = companyResult.Data.Name; //上级单位名称
                    model.PreCode = companyResult.Data.Code; //上级单位编号
                }

                result = proxy.AddCompany(model, fileList);
            }
            return(Json(result.ToResultView()));
        }
        public ActionResult Add(Base_Company model)
        {
            //权限检查
            Helper.IsCheck(HttpContext, AdminModule.AdminOrganization.ToString(), SystemRight.Add.ToString(), true);

            //model.Type = RoleType.Supplier.ToString();

            string            fileDataJson = Request.Form["fileDataJsonFile"];                                 //获取上传文件json字符串
            List <Base_Files> fileList     = JsonConvert.DeserializeObject <List <Base_Files> >(fileDataJson); //将文件信息json字符串序列化为列表

            Result <int>          result        = new Result <int>();
            Result <Base_Company> companyResult = new Result <Base_Company>();

            using (AdminClientProxy proxy = new AdminClientProxy(ProxyEx(Request)))
            {
                //获取上级单位信息
                if (model.PId == 0)
                {
                    model.PreName = null;
                    model.PreCode = null;
                }
                else
                {
                    companyResult = proxy.GetCompanyModel(model.PId);
                    model.PreName = companyResult.Data.Name; //上级单位名称
                    model.PreCode = companyResult.Data.Code; //上级单位编号
                }
                model.OrgState = "1";
                if (model.OrgType == "2")
                {
                    model.PreCode = "1133272570590793728";
                }
                result = proxy.AddCompany(model, fileList);
            }
            return(Json(result.ToResultView()));
        }