Esempio n. 1
0
        //
        // GET: /QAM/CheckCategory/Detail
        public async Task <ActionResult> Detail(string key)
        {
            using (CheckCategoryServiceClient client = new CheckCategoryServiceClient())
            {
                MethodReturnResult <CheckCategory> result = await client.GetAsync(key);

                if (result.Code == 0)
                {
                    CheckCategoryViewModel viewModel = new CheckCategoryViewModel()
                    {
                        Name        = result.Data.Key,
                        Status      = result.Data.Status,
                        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"));
        }
Esempio n. 2
0
        //
        // GET: /QAM/CheckCategoryDetail/
        public async Task <ActionResult> Index(string categoryName)
        {
            using (CheckCategoryServiceClient client = new CheckCategoryServiceClient())
            {
                MethodReturnResult <CheckCategory> result = await client.GetAsync(categoryName ?? string.Empty);

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

            using (CheckCategoryDetailServiceClient client = new CheckCategoryDetailServiceClient())
            {
                await Task.Run(() =>
                {
                    PagingConfig cfg = new PagingConfig()
                    {
                        OrderBy = "ItemNo",
                        Where   = string.Format(" Key.CategoryName = '{0}'"
                                                , categoryName)
                    };
                    MethodReturnResult <IList <CheckCategoryDetail> > result = client.Get(ref cfg);

                    if (result.Code == 0)
                    {
                        ViewBag.PagingConfig = cfg;
                        ViewBag.List         = result.Data;
                    }
                });
            }
            return(View(new CheckCategoryDetailQueryViewModel()
            {
                CategoryName = categoryName
            }));
        }
Esempio n. 3
0
        public async Task <ActionResult> SaveModify(CheckCategoryViewModel model)
        {
            using (CheckCategoryServiceClient client = new CheckCategoryServiceClient())
            {
                MethodReturnResult <CheckCategory> result = await client.GetAsync(model.Name);

                if (result.Code == 0)
                {
                    result.Data.Status      = model.Status;
                    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(QAMResources.StringResource.CheckCategory_SaveModify_Success
                                                    , model.Name);
                    }
                    return(Json(rst));
                }
                return(Json(result));
            }
        }