Exemplo n.º 1
0
        public ActionResult Store(StoreFilter filter)
        {
            var stores = StoreInfo.Find(UserID, Employee.ID, Employee.BussinessID, "", filter, true);

            if (Request.IsAjaxRequest())
            {
                return(Json(new
                {
                    result = true,
                    html = RenderPartialViewToString(Views.StorePartial, stores)
                }, JsonRequestBehavior.AllowGet));
            }
            return(View(Views.Store, stores));
        }
Exemplo n.º 2
0
        public static StoreList Find(int userID, int employeeID, int bussinessID, string message = "", StoreFilter filter = null, bool log = false)
        {
            QueryOutput queryResult;
            var         conditions = new List <string>();

            if (filter != null)
            {
                if (!String.IsNullOrEmpty(filter.Address))
                {
                    conditions.Add(String.Format("and s.Address like N'%{0}%'", filter.Address));
                }
                if (!String.IsNullOrEmpty(filter.Name))
                {
                    conditions.Add(String.Format("and s.Name like N'%{0}%'", filter.Name));
                }
                if (!String.IsNullOrEmpty(filter.Phone))
                {
                    conditions.Add(String.Format("and s.Phone like N'%{0}%'", filter.Phone));
                }
            }
            var result = new StoreList(message, filter);

            result.Data = Query <StoreInfo>(new DbQuery(userID, employeeID, DbAction.Store.View,
                                                        String.Format("select s.* from Store s join Bussiness b on s.BussinessID = b.ID where s.Status = 'active' and b.ID = {0} {1} order by s.Name", bussinessID, String.Join(" ", conditions)), log), out queryResult);
            return(result);
        }
Exemplo n.º 3
0
 public StoreList(string message = "", StoreFilter filter = null)
 {
     Data    = new List <StoreInfo>();
     Filter  = filter != null ? filter : new StoreFilter();
     Message = message;
 }