Esempio n. 1
0
        //
        // GET: /FMM/ProductionLine/Detail
        public async Task <ActionResult> Detail(string key)
        {
            using (ProductionLineServiceClient client = new ProductionLineServiceClient())
            {
                MethodReturnResult <ProductionLine> result = await client.GetAsync(key);

                if (result.Code == 0)
                {
                    ProductionLineViewModel viewModel = new ProductionLineViewModel()
                    {
                        Code         = result.Data.Key,
                        Name         = result.Data.Name,
                        LocationName = result.Data.LocationName,
                        Attr1        = result.Data.Attr1,
                        CreateTime   = result.Data.CreateTime,
                        Creator      = result.Data.Creator,
                        Description  = result.Data.Description,
                        Editor       = result.Data.Editor,
                        EditTime     = result.Data.EditTime
                    };
                    return(PartialView("_InfoPartial", viewModel));
                }
                else
                {
                    ModelState.AddModelError("", result.Message);
                }
            }
            return(PartialView("_InfoPartial"));
        }
Esempio n. 2
0
        public async Task <ActionResult> SaveModify(ProductionLineViewModel model)
        {
            using (ProductionLineServiceClient client = new ProductionLineServiceClient())
            {
                MethodReturnResult <ProductionLine> result = await client.GetAsync(model.Code);

                if (result.Code == 0)
                {
                    result.Data.Name         = model.Name;
                    result.Data.LocationName = model.LocationName;
                    result.Data.Description  = model.Description;
                    result.Data.Attr1        = model.Attr1;
                    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.ProductionLine_SaveModify_Success
                                                    , model.Code);
                    }
                    return(Json(rst));
                }
                return(Json(result));
            }
        }