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

                if (result.Code == 0)
                {
                    ParameterViewModel viewModel = new ParameterViewModel()
                    {
                        Name           = result.Data.Key,
                        DeviceType     = result.Data.DeviceType,
                        Mandatory      = result.Data.Mandatory,
                        IsDerived      = result.Data.IsDerived,
                        DerivedFormula = result.Data.DerivedFormula,
                        DataType       = result.Data.DataType,
                        Type           = result.Data.Type,
                        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"));
        }
예제 #2
0
        public async Task <ActionResult> SaveModify(ParameterViewModel model)
        {
            using (ParameterServiceClient client = new ParameterServiceClient())
            {
                MethodReturnResult <Parameter> result = await client.GetAsync(model.Name);

                if (result.Code == 0)
                {
                    result.Data.Type           = model.Type;
                    result.Data.DataType       = model.DataType;
                    result.Data.DerivedFormula = model.IsDerived?model.DerivedFormula:string.Empty;
                    result.Data.DeviceType     = model.DeviceType;
                    result.Data.IsDerived      = model.IsDerived;
                    result.Data.Mandatory      = model.Mandatory;
                    result.Data.Description    = model.Description;
                    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.Parameter_SaveModify_Success
                                                    , model.Name);
                    }
                    return(Json(rst));
                }
                return(Json(result));
            }
        }
예제 #3
0
        //
        // GET: /FMM/ParameterDerivation/
        public async Task <ActionResult> Index(string derivedParameterName)
        {
            using (ParameterServiceClient client = new ParameterServiceClient())
            {
                MethodReturnResult <Parameter> result = await client.GetAsync(derivedParameterName ?? string.Empty);

                if (result.Code > 0 || result.Data == null || result.Data.IsDerived == false)
                {
                    return(RedirectToAction("Index", "Parameter"));
                }
                ViewBag.DerivedParamter = result.Data;
            }

            using (ParameterDerivationServiceClient client = new ParameterDerivationServiceClient())
            {
                await Task.Run(() =>
                {
                    PagingConfig cfg = new PagingConfig()
                    {
                        IsPaging = false,
                        OrderBy  = "ItemNo",
                        Where    = string.Format(" Key.DerivedParameterName = '{0}'"
                                                 , derivedParameterName)
                    };
                    MethodReturnResult <IList <ParameterDerivation> > result = client.Get(ref cfg);

                    if (result.Code == 0)
                    {
                        ViewBag.List = result.Data;
                    }
                });
            }
            return(View(new ParameterDerivationQueryViewModel()
            {
                DerivedParameterName = derivedParameterName
            }));
        }