Пример #1
0
        public IEnumerable <SelectListItem> GetReasonCodeCategoryNameList()
        {
            IList <ReasonCodeCategory> lst = new List <ReasonCodeCategory>();

            //获取原因代码分组信息。
            using (ReasonCodeCategoryServiceClient client = new ReasonCodeCategoryServiceClient())
            {
                PagingConfig cfg = new PagingConfig()
                {
                    IsPaging = false,
                    Where    = string.Format("Type='{0}'", Convert.ToInt32(EnumReasonCodeType.Hold))
                };
                MethodReturnResult <IList <ReasonCodeCategory> > result = client.Get(ref cfg);
                if (result.Code <= 0 && result.Data != null && result.Data.Count > 0)
                {
                    lst = result.Data;
                }
            }
            return(from item in lst
                   select new SelectListItem
            {
                Text = item.Key,
                Value = item.Key
            });
        }
Пример #2
0
        public 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 (ReasonCodeCategoryServiceClient client = new ReasonCodeCategoryServiceClient())
                {
                    PagingConfig cfg = new PagingConfig()
                    {
                        PageNo   = pageNo,
                        PageSize = pageSize,
                        Where    = where ?? string.Empty,
                        OrderBy  = orderBy ?? string.Empty
                    };
                    MethodReturnResult <IList <ReasonCodeCategory> > result = client.Get(ref cfg);
                    if (result.Code == 0)
                    {
                        ViewBag.PagingConfig = cfg;
                        ViewBag.List         = result.Data;
                    }
                }
            }
            return(PartialView("_ListPartial"));
        }
Пример #3
0
        public IEnumerable <SelectListItem> GetReasonCodeCategoryName(EnumReasonCodeType type)
        {
            using (ReasonCodeCategoryServiceClient client = new ReasonCodeCategoryServiceClient())
            {
                PagingConfig cfg = new PagingConfig()
                {
                    IsPaging = false,
                    Where    = string.Format("Type='{0}'", Convert.ToInt32(type))
                };

                MethodReturnResult <IList <ReasonCodeCategory> > result = client.Get(ref cfg);
                if (result.Code <= 0)
                {
                    IEnumerable <SelectListItem> lst = from item in result.Data
                                                       select new SelectListItem()
                    {
                        Text  = item.Key,
                        Value = item.Key
                    };
                    return(lst);
                }
            }

            return(new List <SelectListItem>());
        }
Пример #4
0
        //
        // GET: /FMM/ReasonCodeCategory/
        public ActionResult Index()
        {
            using (ReasonCodeCategoryServiceClient client = new ReasonCodeCategoryServiceClient())
            {
                PagingConfig cfg = new PagingConfig()
                {
                    OrderBy = "Key"
                };
                MethodReturnResult <IList <ReasonCodeCategory> > result = client.Get(ref cfg);

                if (result.Code == 0)
                {
                    ViewBag.PagingConfig = cfg;
                    ViewBag.List         = result.Data;
                }
            }
            return(View(new ReasonCodeCategoryQueryViewModel()));
        }
Пример #5
0
        public ActionResult Query(ReasonCodeCategoryQueryViewModel model)
        {
            if (ModelState.IsValid)
            {
                using (ReasonCodeCategoryServiceClient client = new ReasonCodeCategoryServiceClient())
                {
                    StringBuilder where = new StringBuilder();
                    if (model != null)
                    {
                        if (!string.IsNullOrEmpty(model.Name))
                        {
                            where.AppendFormat(" {0} Key LIKE '{1}%'"
                                               , where.Length > 0 ? "AND" : string.Empty
                                               , model.Name);
                        }
                        if (model.Type != null)
                        {
                            where.AppendFormat(" {0} Type = '{1}'"
                                               , where.Length > 0 ? "AND" : string.Empty
                                               , Convert.ToInt32(model.Type));
                        }
                    }
                    PagingConfig cfg = new PagingConfig()
                    {
                        OrderBy = "Key",
                        Where   = where.ToString()
                    };
                    MethodReturnResult <IList <ReasonCodeCategory> > result = client.Get(ref cfg);

                    if (result.Code == 0)
                    {
                        ViewBag.PagingConfig = cfg;
                        ViewBag.List         = result.Data;
                    }
                }
            }
            return(PartialView("_ListPartial"));
        }
Пример #6
0
        public IEnumerable <SelectListItem> GetReasonCodeCategoryName()
        {
            IList <ReasonCodeCategory> lst = null;

            using (ReasonCodeCategoryServiceClient client = new ReasonCodeCategoryServiceClient())
            {
                PagingConfig cfg = new PagingConfig()
                {
                    IsPaging = false,
                    Where    = "Key.Type='0'"
                };
                MethodReturnResult <IList <ReasonCodeCategory> > result = client.Get(ref cfg);
                if (result.Code <= 0 && result.Data != null)
                {
                    lst = result.Data;
                }
            }
            return(from item in lst
                   select new SelectListItem
            {
                Text = item.Key,
                Value = item.Key
            });
        }