Example #1
0
        public async Task <ActionResult> SaveModify(DecayViewModel model)
        {
            using (DecayServiceClient client = new DecayServiceClient())
            {
                DecayKey key = new DecayKey()
                {
                    Code   = model.Code,
                    Object = model.Object
                };
                MethodReturnResult <Decay> result = await client.GetAsync(key);

                if (result.Code == 0)
                {
                    result.Data.Value       = model.Value ?? 0;
                    result.Data.Type        = model.Type;
                    result.Data.Description = model.Description;
                    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.Decay_SaveModify_Success
                                                    , model.Code);
                    }
                    return(Json(rst));
                }
                return(Json(result));
            }
        }
Example #2
0
        //
        // GET: /ZPVM/Decay/Detail
        public async Task <ActionResult> Detail(string code, EnumPVMTestDataType obj)
        {
            using (DecayServiceClient client = new DecayServiceClient())
            {
                DecayKey key = new DecayKey()
                {
                    Code   = code,
                    Object = obj
                };
                MethodReturnResult <Decay> result = await client.GetAsync(key);

                if (result.Code == 0)
                {
                    DecayViewModel viewModel = new DecayViewModel()
                    {
                        Description = result.Data.Description,
                        IsUsed      = result.Data.IsUsed,
                        Object      = result.Data.Key.Object,
                        Type        = result.Data.Type,
                        Value       = result.Data.Value,
                        Code        = result.Data.Key.Code,
                        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"));
        }
Example #3
0
        public async Task <ActionResult> Save(DecayViewModel model)
        {
            using (DecayServiceClient client = new DecayServiceClient())
            {
                Decay obj = new Decay()
                {
                    Key = new DecayKey()
                    {
                        Code   = model.Code.ToUpper(),
                        Object = model.Object
                    },
                    Type        = model.Type,
                    Value       = model.Value ?? 0,
                    Description = model.Description,
                    IsUsed      = model.IsUsed,
                    Editor      = User.Identity.Name,
                    EditTime    = DateTime.Now,
                    CreateTime  = DateTime.Now,
                    Creator     = User.Identity.Name
                };
                MethodReturnResult rst = await client.AddAsync(obj);

                if (rst.Code == 0)
                {
                    rst.Message = string.Format(ZPVMResources.StringResource.Decay_Save_Success
                                                , obj.Key);
                }
                return(Json(rst));
            }
        }