Exemple #1
0
        public async Task <ActionResult> SaveModify(LocationViewModel model)
        {
            using (LocationServiceClient client = new LocationServiceClient())
            {
                MethodReturnResult <Location> result = await client.GetAsync(model.Name);

                if (result.Code == 0)
                {
                    result.Data.Level = model.Level;
                    result.Data.ParentLocationName = model.ParentLocationName;
                    result.Data.ERPDeptCode        = model.ERPDeptCode;                 //ERP部门代码
                    result.Data.Description        = model.Description;
                    result.Data.Editor             = User.Identity.Name;
                    result.Data.EditTime           = DateTime.Now;
                    MethodReturnResult rst = await client.ModifyAsync(result.Data);

                    if (rst.Code == 0)
                    {
                        rst.Message = string.Format(FMMResources.StringResource.Location_SaveModify_Success
                                                    , model.Name);
                    }
                    return(Json(rst));
                }
                return(Json(result));
            }
        }
Exemple #2
0
        //
        // GET: /FMM/Location/Detail
        public async Task <ActionResult> Detail(string name)
        {
            using (LocationServiceClient client = new LocationServiceClient())
            {
                MethodReturnResult <Location> result = await client.GetAsync(name);

                if (result.Code == 0)
                {
                    LocationViewModel viewModel = new LocationViewModel()
                    {
                        Name = result.Data.Key,
                        ParentLocationName = result.Data.ParentLocationName,
                        Level       = result.Data.Level,
                        ERPDeptCode = result.Data.ERPDeptCode,                  //ERP部门代码
                        Description = result.Data.Description,
                        CreateTime  = result.Data.CreateTime,
                        Creator     = result.Data.Creator,
                        Editor      = result.Data.Editor,
                        EditTime    = result.Data.EditTime
                    };
                    return(PartialView("_InfoPartial", viewModel));
                }
                else
                {
                    ModelState.AddModelError("", result.Message);
                }
            }
            return(PartialView("_InfoPartial"));
        }
Exemple #3
0
        //
        // GET: /FMM/Location/Modify
        public async Task <ActionResult> Modify(string name)
        {
            LocationViewModel viewModel = new LocationViewModel();

            using (LocationServiceClient client = new LocationServiceClient())
            {
                MethodReturnResult <Location> result = await client.GetAsync(name);

                if (result.Code == 0)
                {
                    viewModel = new LocationViewModel()
                    {
                        Name = result.Data.Key,
                        ParentLocationName = result.Data.ParentLocationName,
                        Level       = result.Data.Level,
                        CreateTime  = result.Data.CreateTime,
                        Creator     = result.Data.Creator,
                        Description = result.Data.Description,
                        Editor      = result.Data.Editor,
                        EditTime    = result.Data.EditTime
                    };
                    SetParentLocationNameViewData("ParentLocationName", viewModel.Level);

                    return(PartialView("_ModifyPartial", viewModel));
                }
                else
                {
                    ModelState.AddModelError("", result.Message);
                }
            }
            return(PartialView("_ModifyPartial"));
        }