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

                if (result.Code == 0)
                {
                    ClientConfigViewModel viewModel = new ClientConfigViewModel()
                    {
                        ClientType   = result.Data.ClientType,
                        Name         = result.Data.Key,
                        IPAddress    = result.Data.IPAddress,
                        LocationName = result.Data.LocationName,
                        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"));
        }
Exemple #2
0
        public async Task <ActionResult> SaveModify(ClientConfigViewModel model)
        {
            using (ClientConfigServiceClient client = new ClientConfigServiceClient())
            {
                MethodReturnResult <ClientConfig> result = await client.GetAsync(model.Name);

                if (result.Code == 0)
                {
                    result.Data.ClientType   = model.ClientType;
                    result.Data.IPAddress    = model.IPAddress;
                    result.Data.LocationName = model.LocationName;
                    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.ClientConfig_SaveModify_Success
                                                    , model.Name);
                    }
                    return(Json(rst));
                }
                return(Json(result));
            }
        }
Exemple #3
0
        //
        // GET: /FMM/ClientConfigAttribute/
        public async Task <ActionResult> Index(string clientName)
        {
            using (ClientConfigServiceClient client = new ClientConfigServiceClient())
            {
                MethodReturnResult <ClientConfig> result = await client.GetAsync(clientName ?? string.Empty);

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

            using (ClientConfigAttributeServiceClient client = new ClientConfigAttributeServiceClient())
            {
                await Task.Run(() =>
                {
                    PagingConfig cfg = new PagingConfig()
                    {
                        Where = string.Format(" Key.ClientName = '{0}'"
                                              , clientName),
                        OrderBy = "Key.ClientName,Key.AttributeName"
                    };
                    MethodReturnResult <IList <ClientConfigAttribute> > result = client.Get(ref cfg);

                    if (result.Code == 0)
                    {
                        ViewBag.PagingConfig = cfg;
                        ViewBag.List         = result.Data;
                    }
                });
            }
            return(View(new ClientConfigAttributeQueryViewModel()
            {
                ClientName = clientName
            }));
        }