Beispiel #1
0
        public ActionResult List(LoginFilter filter)
        {
            var data = Login.Find(UserID, Employee.ID, Employee.BussinessID, "", filter, true);

            if (Request.IsAjaxRequest())
            {
                return(Json(new
                {
                    result = true,
                    html = RenderPartialViewToString(Views.ListPartial, data)
                }, JsonRequestBehavior.AllowGet));
            }
            return(View(Views.List, data));
        }
Beispiel #2
0
        public static LoginList Find(int userID, int employeeID, int bussinessID, string message = "", LoginFilter filter = null, bool log = false)
        {
            QueryOutput queryResult;
            var         conditions = new List <string>();

            if (filter != null)
            {
                if (filter.EmployeeID.HasValue)
                {
                    conditions.Add(String.Format("and e.ID = {0}", filter.EmployeeID.DbValue()));
                }
                if (!String.IsNullOrEmpty(filter.Username))
                {
                    conditions.Add(String.Format("and l.Username like N'%{0}%'", filter.Username));
                }
            }
            var result = new LoginList(message, filter);

            result.Data = Query <Login>(new DbQuery(userID, employeeID, DbAction.Login.View,
                                                    String.Format(@"select top 100 l.*, e.Name as [EmployeeName] 
                                from Login l left join Employee e on l.EmployeeID = e.ID 
                                where l.Status = 'active' and l.BussinessID = {0} {1}
                                order by l.Username", bussinessID, String.Join(" ", conditions)), log), out queryResult);
            return(result);
        }
Beispiel #3
0
 public LoginList(string message = "", LoginFilter filter = null)
 {
     Filter  = filter != null ? filter : new LoginFilter();
     Message = message;
 }