Beispiel #1
0
        //
        // GET: /FMM/PrintLabel/Detail
        public async Task <ActionResult> Detail(string key)
        {
            using (PrintLabelServiceClient client = new PrintLabelServiceClient())
            {
                MethodReturnResult <PrintLabel> result = await client.GetAsync(key);

                if (result.Code == 0)
                {
                    PrintLabelViewModel viewModel = new PrintLabelViewModel()
                    {
                        Name       = result.Data.Name,
                        IsUsed     = result.Data.IsUsed,
                        Content    = result.Data.Content,
                        Code       = result.Data.Key,
                        Type       = result.Data.Type,
                        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", new PrintLabelViewModel()));
        }
Beispiel #2
0
        public async Task <ActionResult> SaveModify(PrintLabelViewModel model)
        {
            using (PrintLabelServiceClient client = new PrintLabelServiceClient())
            {
                MethodReturnResult <PrintLabel> result = await client.GetAsync(model.Code);

                if (result.Code == 0)
                {
                    result.Data.Name     = model.Name.ToUpper();
                    result.Data.Content  = model.Content;
                    result.Data.Type     = model.Type;
                    result.Data.IsUsed   = model.IsUsed;
                    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.PrintLabel_SaveModify_Success
                                                    , model.Code);
                    }
                    return(Json(rst));
                }
                return(Json(result));
            }
        }