Exemplo n.º 1
0
        //
        // GET: /QAM/CheckSetting/
        public async Task <ActionResult> Index()
        {
            using (CheckSettingServiceClient client = new CheckSettingServiceClient())
            {
                await Task.Run(() =>
                {
                    PagingConfig cfg = new PagingConfig()
                    {
                        OrderBy = "GroupName"
                    };
                    MethodReturnResult <IList <CheckSetting> > result = client.Get(ref cfg);

                    if (result.Code == 0)
                    {
                        ViewBag.PagingConfig = cfg;
                        ViewBag.List         = result.Data;
                    }
                });
            }
            return(View(new CheckSettingQueryViewModel()));
        }
Exemplo n.º 2
0
 public ActionResult GetCheckSetting(string groupName)
 {
     using (CheckSettingServiceClient client = new CheckSettingServiceClient())
     {
         PagingConfig cfg = new PagingConfig()
         {
             PageNo   = 0,
             PageSize = 1,
             Where    = string.Format("GroupName='{0}'", groupName)
         };
         MethodReturnResult <IList <CheckSetting> > result = client.Get(ref cfg);
         if (result.Code <= 0 && result.Data != null && result.Data.Count > 0)
         {
             return(Json(new
             {
                 ActionName = result.Data[0].ActionName.ToString()
             }, JsonRequestBehavior.AllowGet));
         }
     }
     return(Json(null, JsonRequestBehavior.AllowGet));
 }
Exemplo n.º 3
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 (CheckSettingServiceClient client = new CheckSettingServiceClient())
                {
                    await Task.Run(() =>
                    {
                        PagingConfig cfg = new PagingConfig()
                        {
                            PageNo   = pageNo,
                            PageSize = pageSize,
                            Where    = where ?? string.Empty,
                            OrderBy  = orderBy ?? string.Empty
                        };
                        MethodReturnResult <IList <CheckSetting> > result = client.Get(ref cfg);
                        if (result.Code == 0)
                        {
                            ViewBag.PagingConfig = cfg;
                            ViewBag.List         = result.Data;
                        }
                    });
                }
            }
            return(PartialView("_ListPartial"));
        }
Exemplo n.º 4
0
        public async Task <ActionResult> Query(CheckSettingQueryViewModel model)
        {
            if (ModelState.IsValid)
            {
                using (CheckSettingServiceClient client = new CheckSettingServiceClient())
                {
                    await Task.Run(() =>
                    {
                        StringBuilder where = new StringBuilder();
                        if (model != null)
                        {
                            if (!string.IsNullOrEmpty(model.GroupName))
                            {
                                where.AppendFormat(" {0} GroupName LIKE '{1}%'"
                                                   , where.Length > 0 ? "AND" : string.Empty
                                                   , model.GroupName);
                            }
                            if (!string.IsNullOrEmpty(model.MaterialType))
                            {
                                where.AppendFormat(" {0} MaterialType LIKE '{1}%'"
                                                   , where.Length > 0 ? "AND" : string.Empty
                                                   , model.MaterialType);
                            }
                            if (!string.IsNullOrEmpty(model.MaterialCode))
                            {
                                where.AppendFormat(" {0} MaterialCode LIKE '{1}%'"
                                                   , where.Length > 0 ? "AND" : string.Empty
                                                   , model.MaterialCode);
                            }
                            if (!string.IsNullOrEmpty(model.RouteEnterpriseName))
                            {
                                where.AppendFormat(" {0} RouteEnterpriseName LIKE '{1}%'"
                                                   , where.Length > 0 ? "AND" : string.Empty
                                                   , model.RouteEnterpriseName);
                            }
                            if (!string.IsNullOrEmpty(model.RouteName))
                            {
                                where.AppendFormat(" {0} RouteName LIKE '{1}%'"
                                                   , where.Length > 0 ? "AND" : string.Empty
                                                   , model.RouteName);
                            }
                            if (!string.IsNullOrEmpty(model.RouteStepName))
                            {
                                where.AppendFormat(" {0} RouteStepName LIKE '{1}%'"
                                                   , where.Length > 0 ? "AND" : string.Empty
                                                   , model.RouteStepName);
                            }
                            if (!string.IsNullOrEmpty(model.RouteOperationName))
                            {
                                where.AppendFormat(" {0} RouteOperationName LIKE '{1}%'"
                                                   , where.Length > 0 ? "AND" : string.Empty
                                                   , model.RouteOperationName);
                            }
                            if (!string.IsNullOrEmpty(model.ProductionLineCode))
                            {
                                where.AppendFormat(" {0} ProductionLineCode LIKE '{1}%'"
                                                   , where.Length > 0 ? "AND" : string.Empty
                                                   , model.ProductionLineCode);
                            }
                            if (!string.IsNullOrEmpty(model.EquipmentCode))
                            {
                                where.AppendFormat(" {0} EquipmentCode LIKE '{1}%'"
                                                   , where.Length > 0 ? "AND" : string.Empty
                                                   , model.EquipmentCode);
                            }
                        }
                        PagingConfig cfg = new PagingConfig()
                        {
                            OrderBy = "GroupName",
                            Where   = where.ToString()
                        };
                        MethodReturnResult <IList <CheckSetting> > result = client.Get(ref cfg);

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