public List <ComBoxStore> GetAllRolesData(StoreParams storeParams, ref int count) { var data = this.SqlQuery <ComBoxStore>("SELECT id AS Value,RoleName AS Text FROM RoleInfo", null).ToList(); count = data.Count(); return(data); }
public static IEnumerable <Dictionary <string, object> > Highlight( this IEnumerable <Dictionary <string, object> > enumerable, StoreParams storeParams) { if (storeParams == null || storeParams.FilterParams == null || !storeParams.FilterParams.Any()) { return(enumerable); } var highlightParams = storeParams.FilterParams.Where(x => x.PropertyName.Contains(Constants.HighLight)).ToList(); if (!highlightParams.Any()) { return(enumerable); } var list = enumerable.ToList(); var fieldNames = list.SelectMany(x => x.Keys).Distinct().ToList(); var highlightOptions = highlightParams.DetermineHighlightOptions(fieldNames); list.ForEach(x => { var style = GetHighlightStyle(highlightOptions, x); if (!string.IsNullOrWhiteSpace(style)) { x["p_grid_row_cls"] = style; } }); return(list); }
public INIDetails(StoreParams sp) { this.sp = sp; int i = 0; int height = 30; foreach (System.Reflection.PropertyInfo pi in sp.GetType().GetProperties()) { Label lbl = new Label(); lbl.Name = pi.Name + "lbl"; lbl.Text = pi.Name; lbl.Width = 160; lbl.Top = i*height + 10; this.Controls.Add(lbl); TextBox box = new TextBox(); box.Name = pi.Name; box.Text = pi.GetValue(sp, null).ToString(); box.Width = 60; box.Left = 170; box.Top = i * height + 10; this.Controls.Add(box); boxes.Add(box); ++i; } InitializeComponent(); this.Height = i * height + 100; this.Width = 170 + 60 + 20; ok.Top = cancel.Top = button1.Top = this.Height - 60; }
public static IQueryable <T> Filter <T>(this IQueryable <T> query, StoreParams storeParams) { if (storeParams == null /*|| (storeParams.FilterParams == null || !storeParams.FilterParams.Any() )*/) { return(query); } var properties = typeof(T).GetProperties(); storeParams .DetermineFilterOperators(properties) .Where(x => properties.Any(y => y.Name.ToLower() == x.PropertyName.ToLower())) .ForEach(x => { var field = properties.First(y => y.Name.ToLower() == x.PropertyName.ToLower()); var filterExpression = FilterExpressionBuilder.GetFilterExpression <T>(field, x.Value, x.Operator, x.SubProperties); if (filterExpression != null) { query = query.Where(filterExpression); } }); return(query); }
public ActionResult GetAllRolesData(StoreParams storeParams) { int count = 0; var data = bll.GetAllRolesData(storeParams, ref count); return(Json(new { data = data, total = count }, JsonRequestBehavior.AllowGet)); }
public void ProcessRequest(HttpContext context) { AjaxReceive receive = new AjaxReceive(); receive.Fill(context); NameValueCollection cc = context.Request.Form; StoreParams storeParams = new StoreParams(); if (!string.IsNullOrEmpty(cc["page"])) { storeParams.page = int.Parse(cc["page"]); } if (!string.IsNullOrEmpty(cc["start"])) { storeParams.start = int.Parse(cc["start"]); } if (!string.IsNullOrEmpty(cc["limit"])) { storeParams.limit = int.Parse(cc["limit"]); } if (!string.IsNullOrEmpty(cc["query"])) { storeParams.query = cc["query"]; } if (!string.IsNullOrEmpty(cc["group"])) { GroupParam grouper = JsonConvert.DeserializeObject <GroupParam>(cc["group"]); if (grouper != null) { storeParams.group = new List <GroupParam>(new GroupParam[] { grouper }); } } if (!string.IsNullOrEmpty(cc["sort"])) { storeParams.sort = JsonConvert.DeserializeObject <List <SortParam> >(cc["sort"]); } if (!string.IsNullOrEmpty(cc["filter"])) { storeParams.filter = JsonConvert.DeserializeObject <List <FilterParam> >(cc["filter"]); } if (string.IsNullOrEmpty(receive.Data)) { receive.Data = JsonConvert.SerializeObject(new { StoreParams = storeParams }); } else if (receive.Data.StartsWith("{") && receive.Data.EndsWith("}")) { string restJsonStr = receive.Data.Substring(1); if (restJsonStr != "}") { restJsonStr = "," + restJsonStr; } receive.Data = string.Format("{{\"StoreParams\":{0}{1}", JsonConvert.SerializeObject(storeParams), restJsonStr); } AjaxResult result = ContextFactory.AjaxProcess.DoProcess(receive); }
private void applySP() { foreach (TextBox box in boxes) { sp.reflectionSet(box.Name, box.Text); } appliedSP = sp; }
private void iniDetails_Click(object sender, EventArgs e) { INIDetails iniForm = new INIDetails(sp); DialogResult res = iniForm.ShowDialog(this); if (iniForm.appliedSP != null) sp = iniForm.appliedSP; }
public ActionResult GetTableData(StoreParams storeParams) { int count = 0; storeParams.obj = userInfo; var data = bll.GetTableData(storeParams, ref count); return(Json(new { data = data, total = count }, JsonRequestBehavior.AllowGet)); }
public static IQueryable <T> Paging <T>(this IQueryable <T> data, StoreParams storeParams) { IQueryable <T> result = data; if (storeParams != null) { result = data.Skip(storeParams.Offset).Take(storeParams.Limit); } return(result); }
public List <UserInfo> GetTableData(StoreParams store, ref int count) { string sqlWhere = AppendWhere(store.obj); string order = store.sort + " " + store.dir; order = string.IsNullOrEmpty(order.Trim()) ? " id asc " : order; count = this.SqlQueryOne <int>("SELECT COUNT(1) FROM UserInfo LEFT JOIN UserInfoWithRoles ON UserInfoWithRoles.userIdFK=UserInfo.id LEFT JOIN RoleInfo ON RoleInfo.id=UserInfoWithRoles.roleIdFK WHERE " + sqlWhere, null); string sql = string.Format("SELECT * FROM (SELECT UserInfo.Id,UserInfo.UserName,UserInfo.UserPassword,RoleInfo.RoleName,RoleInfo.Id AS RoleIdFK FROM UserInfo LEFT JOIN UserInfoWithRoles ON UserInfoWithRoles.userIdFK=UserInfo.id LEFT JOIN RoleInfo ON RoleInfo.id=UserInfoWithRoles.roleIdFK) AS a WHERE {0} ORDER BY {1} LIMIT {2},{3}", sqlWhere, order, store.start, store.limit); return(this.SqlQuery <UserInfo>(sql, null).ToList()); }
public List <RoleInfo> GetTableData(StoreParams store, ref int count) { List <RoleInfo> roles = new List <RoleInfo>(); string sqlWhere = AppendWhere(store.obj); string order = store.sort + " " + store.dir; order = string.IsNullOrEmpty(order.Trim()) ? " id asc " : order; count = this.SqlQueryOne <int>("SELECT * FROM RoleInfo WHERE " + sqlWhere, null); string sql = string.Format("SELECT * FROM RoleInfo WHERE {0} ORDER BY {1} LIMIT {2},{3}", sqlWhere, order, store.start, store.limit); var data = this.SqlQuery <RoleInfo>(sql, null).ToList(); return(data); }
public StoreResult QueryPersons(StoreParams storeParams) { IEnumerable <HrEmploy> item = new HrEmployeeDal().LoadEntity(H => H.UserID == storeParams.query); if (item != null && item.Count() == 1) { StoreResult result = new StoreResult(); result.root = item.First().ToAjaxResult(); result.total = item.Count(); return(result); } return(null); }
public ActionResult GetTableData(StoreParams storeParams) { int count = 0; storeParams.obj = obj; var data = bll.GetTableData(storeParams, ref count); return(Content(JsonConvert.SerializeObject(new { data = data, total = count }, Formatting.Indented, new IsoDateTimeConverter() { DateTimeFormat = "yyyy-MM-dd HH:mm:ss" }), "application/json")); }
public ActionResult GetTableData(StoreParams storeParams) { int count = 0; storeParams.obj = rfid_bound; var data = new List <Rfid_bound>(); data = bll.GetTableData(storeParams, 0, ref count); return(Content(JsonConvert.SerializeObject(new { data = data == null ? new List <Rfid_bound>() : data, total = count }, Formatting.Indented, new IsoDateTimeConverter() { DateTimeFormat = "yyyy-MM-dd HH:mm:ss" }), "application/json")); // return Json(new { data = data==null?new List<Rfid_bound>():data, total = count }, JsonRequestBehavior.AllowGet); }
public ActionResult TabStore(string currentSysNo) { var model = new StoreParams(); if (string.IsNullOrWhiteSpace(currentSysNo)) { model.CurrentSysNo = "1"; } else { model.CurrentSysNo = currentSysNo; } ViewBag.PageType = (int)ECommerce.Enums.PageType.SubStore; ViewBag.PageID = model.CurrentSysNo; return(View(model)); }
public ActionResult MidCategory(string subCategoryID) { var model = new StoreParams(); //string subCategoryID = Request.QueryString["subCategoryID"]; //if (string.IsNullOrWhiteSpace(subCategoryID)) //{ // model.CurrentSysNo = "100101"; //} //else //{ // model.CurrentSysNo = subCategoryID; //} //ViewBag.SubCategoryID = subCategoryID; model.CurrentSysNo = subCategoryID; ViewBag.PageType = (int)ECommerce.Enums.PageType.MidCategory; ViewBag.PageID = model.CurrentSysNo; return(View(model)); }
private void openINI_Click(object sender, EventArgs e) { openFileDialog.DefaultExt = "ini"; openFileDialog.Filter = "Simulation Settings|*.ini"; DialogResult result = openFileDialog.ShowDialog(); // Show the dialog. if (result == DialogResult.OK) // Test result. { System.IO.Stream fs = openFileDialog.OpenFile(); sp = Program.readSettings(fs); fs.Close(); iniDetails.Enabled = sp != null; if (sp != null) { simulate.Enabled = true; iniLabel.Text = "INI Loaded"; } else { MessageBox.Show(Program.lastException.Message); } } }
public List <UserInfo> GetTableData(StoreParams storeParams, ref int count) { return(dal.GetTableData(storeParams, ref count)); }
public static IOrderedQueryable <T> Order <T>(this IQueryable <T> query, StoreParams storeParams) { var result = (IOrderedQueryable <T>)query; // Были ли запрос уже сортирован var isOrdered = query.Expression.Type == typeof(IOrderedQueryable <T>); if (storeParams != null && storeParams.SortParams != null) { var properties = typeof(T).GetProperties(); foreach (var sortParam in storeParams.SortParams.DetermineSortFields(properties)) { // The order expressions var x = Expression.Parameter(typeof(T), "x"); if (sortParam.NullSort != SortOrder.Unspecified) { var propertyExpression = Expression.Property(x, sortParam.PropertyName); var eq = Expression.Equal(propertyExpression, Expression.Constant(null)); // Костыль, т.к. в оракле нет bool // Чтобы ORDER BY получился подобным: // cast(case when FIELD_NAME is null then 1 else 0 end as NUMBER(10,0)) var cond = Expression.Condition(eq, Expression.Constant(1), Expression.Constant(0)); var expr = Expression.Lambda <Func <T, int> >(cond, x); result = isOrdered ? sortParam.NullSort == SortOrder.Descending ? result.ThenByDescending(expr) : result.ThenBy(expr) : sortParam.NullSort == SortOrder.Descending ? query.OrderByDescending(expr) : query.OrderBy(expr); isOrdered = true; } var memberExpression = Expression.PropertyOrField(x, sortParam.PropertyName); if (sortParam.PropertyType != null && sortParam.PropertyType.IsSubclassOf(typeof(BaseEntity))) { if (string.IsNullOrWhiteSpace(sortParam.SubProperties)) { var prop = sortParam.PropertyType.GetProperty("Name"); if (prop != null) { memberExpression = Expression.PropertyOrField(memberExpression, prop.Name); } } else { var parts = sortParam.SubProperties.Split('.').ToList(); var type = sortParam.PropertyType; foreach (var part in parts) { var prop = type.GetProperty(part); if (prop != null) { memberExpression = Expression.PropertyOrField(memberExpression, prop.Name); type = prop.PropertyType; } } } } var expression = Expression.Lambda <Func <T, object> >(Expression.Convert(memberExpression, typeof(object)), x); result = isOrdered ? sortParam.Direction == SortOrder.Descending ? result.ThenByDescending(expression) : result.ThenBy(expression) : sortParam.Direction == SortOrder.Descending ? query.OrderByDescending(expression) : query.OrderBy(expression); isOrdered = true; } } return(isOrdered ? result.OrderById() : query.OrderById()); }
public List <ComBoxStore> GetAllRolesData(StoreParams storeParams, ref int count) { return(dal.GetAllRolesData(storeParams, ref count)); }
public static IEnumerable <Dictionary <string, object> > Highlight <T>(this IEnumerable <T> enumerable, StoreParams storeParams) { var properties = typeof(T).GetProperties(); var result = enumerable.Select(x => properties.ToDictionary(property => property.Name, property => property.GetValue(x))); return(result.Highlight(storeParams)); }
public List <Rfid_bound> GetTableData(StoreParams storeParams, ref int count) { throw new NotImplementedException(); }