예제 #1
0
 public ActionResult GetMaxItemNo(string categoryName)
 {
     using (CheckCategoryDetailServiceClient client = new CheckCategoryDetailServiceClient())
     {
         PagingConfig cfg = new PagingConfig()
         {
             PageNo   = 0,
             PageSize = 1,
             Where    = string.Format("Key.CategoryName='{0}'", categoryName),
             OrderBy  = "ItemNo Desc"
         };
         MethodReturnResult <IList <CheckCategoryDetail> > result = client.Get(ref cfg);
         if (result.Code <= 0 && result.Data != null && result.Data.Count > 0)
         {
             return(Json(result.Data[0].ItemNo + 1, JsonRequestBehavior.AllowGet));
         }
     }
     return(Json(1, JsonRequestBehavior.AllowGet));
 }
예제 #2
0
        public async Task <ActionResult> Query(CheckCategoryDetailQueryViewModel model)
        {
            if (ModelState.IsValid)
            {
                using (CheckCategoryDetailServiceClient client = new CheckCategoryDetailServiceClient())
                {
                    await Task.Run(() =>
                    {
                        StringBuilder where = new StringBuilder();
                        if (model != null)
                        {
                            where.AppendFormat(" {0} Key.CategoryName = '{1}'"
                                               , where.Length > 0 ? "AND" : string.Empty
                                               , model.CategoryName);

                            if (!string.IsNullOrEmpty(model.ParameterName))
                            {
                                where.AppendFormat(" {0} Key.ParameterName LIKE '{1}%'"
                                                   , where.Length > 0 ? "AND" : string.Empty
                                                   , model.ParameterName);
                            }
                        }
                        PagingConfig cfg = new PagingConfig()
                        {
                            OrderBy = "ItemNo",
                            Where   = where.ToString()
                        };
                        MethodReturnResult <IList <CheckCategoryDetail> > result = client.Get(ref cfg);

                        if (result.Code == 0)
                        {
                            ViewBag.PagingConfig = cfg;
                            ViewBag.List         = result.Data;
                        }
                    });
                }
            }
            return(PartialView("_ListPartial"));
        }
예제 #3
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
            }));
        }
예제 #4
0
        public async Task <ActionResult> PagingQuery(string where, string orderBy, int?currentPageNo, int?currentPageSize)
        {
            if (ModelState.IsValid)
            {
                int pageNo   = currentPageNo ?? 0;
                int pageSize = currentPageSize ?? 20;
                if (Request["PageNo"] != null)
                {
                    pageNo = Convert.ToInt32(Request["PageNo"]);
                }
                if (Request["PageSize"] != null)
                {
                    pageSize = Convert.ToInt32(Request["PageSize"]);
                }

                using (CheckCategoryDetailServiceClient client = new CheckCategoryDetailServiceClient())
                {
                    await Task.Run(() =>
                    {
                        PagingConfig cfg = new PagingConfig()
                        {
                            PageNo   = pageNo,
                            PageSize = pageSize,
                            Where    = where ?? string.Empty,
                            OrderBy  = orderBy ?? string.Empty
                        };
                        MethodReturnResult <IList <CheckCategoryDetail> > result = client.Get(ref cfg);
                        if (result.Code == 0)
                        {
                            ViewBag.PagingConfig = cfg;
                            ViewBag.List         = result.Data;
                        }
                    });
                }
            }
            return(PartialView("_ListPartial"));
        }