//
        // GET: /BaseData/BaseAttributeCategory/Detail
        public async Task <ActionResult> Detail(string name)
        {
            using (BaseAttributeCategoryServiceClient client = new BaseAttributeCategoryServiceClient())
            {
                MethodReturnResult <BaseAttributeCategory> result = await client.GetAsync(name);

                if (result.Code == 0)
                {
                    BaseAttributeCategoryViewModel viewModel = new BaseAttributeCategoryViewModel()
                    {
                        Name        = result.Data.Key,
                        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
        //
        // GET: /BaseData/BaseAttributeValue/
        public async Task <ActionResult> Index(string categoryName)
        {
            using (BaseAttributeCategoryServiceClient client = new BaseAttributeCategoryServiceClient())
            {
                MethodReturnResult <BaseAttributeCategory> result = await client.GetAsync(categoryName ?? string.Empty);

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

            using (BaseAttributeServiceClient client = new BaseAttributeServiceClient())
            {
                await Task.Run(() =>
                {
                    string where     = string.Format("Key.CategoryName='{0}'", categoryName);
                    PagingConfig cfg = new PagingConfig()
                    {
                        IsPaging = false,
                        OrderBy  = "Key.CategoryName,Order",
                        Where    = where
                    };
                    MethodReturnResult <IList <BaseAttribute> > result = client.Get(ref cfg);

                    if (result.Code == 0)
                    {
                        ViewBag.BaseAttributeList = result.Data;
                    }
                });
            }
            using (BaseAttributeValueServiceClient client = new BaseAttributeValueServiceClient())
            {
                await Task.Run(() =>
                {
                    string where     = string.Format("Key.CategoryName='{0}'", categoryName);
                    PagingConfig cfg = new PagingConfig()
                    {
                        IsPaging = false,
                        OrderBy  = "Key.CategoryName,Key.ItemOrder",
                        Where    = where
                    };
                    MethodReturnResult <IList <BaseAttributeValue> > result = client.Get(ref cfg);

                    if (result.Code == 0)
                    {
                        ViewBag.List = result.Data;
                    }
                });
            }
            if (Request.IsAjaxRequest())
            {
                return(PartialView("_ListPartial"));
            }
            return(View());
        }
        public async Task <ActionResult> SaveModify(BaseAttributeCategoryViewModel model)
        {
            using (BaseAttributeCategoryServiceClient client = new BaseAttributeCategoryServiceClient())
            {
                MethodReturnResult <BaseAttributeCategory> result = await client.GetAsync(model.Name);

                if (result.Code == 0)
                {
                    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(StringResource.BaseAttributeCategory_SaveModify_Success
                                                    , model.Name);
                    }
                    return(Json(rst));
                }
                return(Json(result));
            }
        }
예제 #4
0
        //
        // GET: /BaseData/BaseAttribute/
        public async Task <ActionResult> Index(string categoryName)
        {
            using (BaseAttributeCategoryServiceClient client = new BaseAttributeCategoryServiceClient())
            {
                MethodReturnResult <BaseAttributeCategory> result = await client.GetAsync(categoryName ?? string.Empty);

                if (result.Code > 0 || result.Data == null)
                {
                    return(RedirectToAction("Index", "BaseAttributeCategory"));
                }
                ViewBag.BaseAttributeCategory = result.Data;
            }
            using (BaseAttributeServiceClient client = new BaseAttributeServiceClient())
            {
                await Task.Run(() =>
                {
                    string where     = string.Format("Key.CategoryName='{0}'", categoryName);
                    PagingConfig cfg = new PagingConfig()
                    {
                        OrderBy = "Key.CategoryName,Order",
                        Where   = where
                    };
                    MethodReturnResult <IList <BaseAttribute> > result = client.Get(ref cfg);

                    if (result.Code == 0)
                    {
                        ViewBag.PagingConfig = cfg;
                        ViewBag.List         = result.Data;
                    }
                });
            }

            return(View(new BaseAttributeQueryViewModel()
            {
                CategoryName = categoryName
            }));
        }