コード例 #1
0
        //
        // GET: /ZPVM/RulePrintSet/Detail
        public async Task <ActionResult> Detail(string code, string labelCode)
        {
            using (RulePrintSetServiceClient client = new RulePrintSetServiceClient())
            {
                RulePrintSetKey key = new RulePrintSetKey()
                {
                    Code      = code,
                    LabelCode = labelCode
                };
                MethodReturnResult <RulePrintSet> result = await client.GetAsync(key);

                if (result.Code == 0)
                {
                    RulePrintSetViewModel viewModel = new RulePrintSetViewModel()
                    {
                        Code       = result.Data.Key.Code,
                        LabelCode  = result.Data.Key.LabelCode,
                        Qty        = result.Data.Qty,
                        ItemNo     = result.Data.ItemNo,
                        IsUsed     = result.Data.IsUsed,
                        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"));
        }
コード例 #2
0
        public async Task <ActionResult> SaveModify(RulePrintSetViewModel model)
        {
            using (RulePrintSetServiceClient client = new RulePrintSetServiceClient())
            {
                RulePrintSetKey key = new RulePrintSetKey()
                {
                    Code      = model.Code,
                    LabelCode = model.LabelCode
                };
                MethodReturnResult <RulePrintSet> result = await client.GetAsync(key);

                if (result.Code == 0)
                {
                    result.Data.ItemNo   = model.ItemNo ?? 0;
                    result.Data.Qty      = model.Qty ?? 1;
                    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(ZPVMResources.StringResource.RulePrintSet_SaveModify_Success
                                                    , model.Code);
                    }
                    return(Json(rst));
                }
                return(Json(result));
            }
        }
コード例 #3
0
        public async Task <ActionResult> Delete(string code, string labelCode)
        {
            MethodReturnResult result = new MethodReturnResult();
            RulePrintSetKey    key    = new RulePrintSetKey()
            {
                Code      = code,
                LabelCode = labelCode
            };

            using (RulePrintSetServiceClient client = new RulePrintSetServiceClient())
            {
                result = await client.DeleteAsync(key);

                if (result.Code == 0)
                {
                    result.Message = string.Format(ZPVMResources.StringResource.RulePrintSet_Delete_Success
                                                   , key);
                }
                return(Json(result));
            }
        }