コード例 #1
0
        //
        // GET: /ZPVM/Powerset/Modify
        public async Task <ActionResult> Modify(string code, int itemNo)
        {
            PowersetViewModel viewModel = new PowersetViewModel();

            using (PowersetServiceClient client = new PowersetServiceClient())
            {
                MethodReturnResult <Powerset> result = await client.GetAsync(new PowersetKey()
                {
                    Code   = code,
                    ItemNo = itemNo
                });

                if (result.Code == 0)
                {
                    viewModel = new PowersetViewModel()
                    {
                        Code            = result.Data.Key.Code,
                        ArticleNo       = result.Data.ArticleNo,
                        ItemNo          = result.Data.Key.ItemNo,
                        PowerName       = result.Data.PowerName,
                        SubWay          = result.Data.SubWay,
                        StandardVPM     = result.Data.StandardVPM,
                        StandardVoc     = result.Data.StandardVoc,
                        StandardPower   = result.Data.StandardPower,
                        StandardIsc     = result.Data.StandardIsc,
                        StandardIPM     = result.Data.StandardIPM,
                        StandardFuse    = result.Data.StandardFuse,
                        PowerDifference = result.Data.PowerDifference,
                        MaxValue        = result.Data.MaxValue,
                        MinValue        = result.Data.MinValue,
                        Name            = result.Data.Name,
                        Description     = result.Data.Description,
                        MixColor        = result.Data.MixColor,
                        IsUsed          = result.Data.IsUsed,
                        CreateTime      = result.Data.CreateTime,
                        Creator         = result.Data.Creator,
                        Editor          = result.Data.Editor,
                        EditTime        = result.Data.EditTime
                    };
                    return(PartialView("_ModifyPartial", viewModel));
                }
                else
                {
                    ModelState.AddModelError("", result.Message);
                }
            }
            return(PartialView("_ModifyPartial"));
        }
コード例 #2
0
        public async Task <ActionResult> SaveModify(PowersetViewModel model)
        {
            using (PowersetServiceClient client = new PowersetServiceClient())
            {
                PowersetKey key = new PowersetKey()
                {
                    Code   = model.Code,
                    ItemNo = model.ItemNo ?? 0
                };
                MethodReturnResult <Powerset> result = await client.GetAsync(key);

                if (result.Code == 0)
                {
                    result.Data.ArticleNo       = model.ArticleNo;
                    result.Data.MaxValue        = model.MaxValue;
                    result.Data.MinValue        = model.MinValue;
                    result.Data.Name            = model.Name;
                    result.Data.PowerDifference = model.PowerDifference;
                    result.Data.PowerName       = model.PowerName;
                    result.Data.StandardFuse    = model.StandardFuse;
                    result.Data.StandardIPM     = model.StandardIPM;
                    result.Data.StandardIsc     = model.StandardIsc;
                    result.Data.StandardPower   = model.StandardPower;
                    result.Data.StandardVoc     = model.StandardVoc;
                    result.Data.StandardVPM     = model.StandardVPM;
                    result.Data.SubWay          = model.SubWay;
                    result.Data.Description     = model.Description;
                    result.Data.MixColor        = model.MixColor;
                    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.Powerset_SaveModify_Success
                                                    , model.Code);
                    }
                    return(Json(rst));
                }
                return(Json(result));
            }
        }
コード例 #3
0
        public async Task <ActionResult> Save(PowersetViewModel model)
        {
            using (PowersetServiceClient client = new PowersetServiceClient())
            {
                Powerset obj = new Powerset()
                {
                    Key = new PowersetKey()
                    {
                        Code   = model.Code.ToUpper(),
                        ItemNo = model.ItemNo ?? 0
                    },
                    ArticleNo       = model.ArticleNo,
                    MaxValue        = model.MaxValue,
                    MinValue        = model.MinValue,
                    Name            = model.Name.ToUpper(),
                    PowerDifference = model.PowerDifference,
                    PowerName       = model.PowerName.ToUpper(),
                    StandardFuse    = model.StandardFuse,
                    StandardIPM     = model.StandardIPM,
                    StandardIsc     = model.StandardIsc,
                    StandardPower   = model.StandardPower,
                    StandardVoc     = model.StandardVoc,
                    StandardVPM     = model.StandardVPM,
                    SubWay          = model.SubWay,
                    Description     = model.Description,
                    MixColor        = model.MixColor,
                    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.Powerset_Save_Success
                                                , obj.Key);
                }
                return(Json(rst));
            }
        }