protected void Page_Load(object sender, System.EventArgs e) { System.Collections.Hashtable hashtable = new System.Collections.Hashtable(); base.Response.AddHeader("Content-Type", "application/json; charset=UTF-8"); IUser user = Users.GetUser(0, Users.GetLoggedOnUsername(), true, true); if (user.UserRole != UserRole.SiteManager) { base.Response.Write(JsonMapper.ToJson(hashtable)); base.Response.End(); return; } System.Collections.Generic.List <System.Collections.Hashtable> list = new System.Collections.Generic.List <System.Collections.Hashtable>(); hashtable["category_list"] = list; System.Data.DataTable photoCategories = GalleryHelper.GetPhotoCategories(); foreach (System.Data.DataRow dataRow in photoCategories.Rows) { System.Collections.Hashtable hashtable2 = new System.Collections.Hashtable(); hashtable2["cId"] = dataRow["CategoryId"]; hashtable2["cName"] = dataRow["CategoryName"]; list.Add(hashtable2); } base.Response.Write(JsonMapper.ToJson(hashtable)); base.Response.End(); }
protected void Page_Load(object sender, EventArgs e) { Hashtable hashtable = new Hashtable(); Response.AddHeader("Content-Type", "application/json; charset=UTF-8"); if (Users.GetUser(0, Users.GetLoggedOnUsername(), true, true).UserRole != UserRole.SiteManager) { Response.Write(JsonMapper.ToJson(hashtable)); Response.End(); } else { List <Hashtable> list = new List <Hashtable>(); hashtable["category_list"] = list; foreach (DataRow row in GalleryHelper.GetPhotoCategories().Rows) { Hashtable item = new Hashtable(); item["cId"] = row["CategoryId"]; item["cName"] = row["CategoryName"]; list.Add(item); } Response.Write(JsonMapper.ToJson(hashtable)); Response.End(); } }
private void GetImageType() { int type = Globals.RequestQueryNum("type"); this.ImageTypeList.DataSource = GalleryHelper.GetPhotoCategories(type); this.ImageTypeList.DataBind(); }
public string GetImgTypeJson(int type) { StringBuilder builder = new StringBuilder(); DataTable photoCategories = null; if (type == 3) { IList <CategoryInfo> mainCategories = CatalogHelper.GetMainCategories(); for (int i = 0; i < mainCategories.Count; i++) { builder.Append("{"); builder.Append("\"name\":\"" + mainCategories[i].Name + "\","); builder.Append("\"parent_id\":" + mainCategories[i].ParentCategoryId + ","); builder.Append("\"id\":" + mainCategories[i].CategoryId + ","); builder.Append("\"picNum\":" + ProductHelper.GetProductsImgList(this.GetProductQuery(mainCategories[i].CategoryId)).TotalRecords); builder.Append("},"); } } else { photoCategories = GalleryHelper.GetPhotoCategories(type); for (int j = 0; j < photoCategories.Rows.Count; j++) { builder.Append("{"); builder.Append("\"name\":\"" + photoCategories.Rows[j]["CategoryName"] + "\","); builder.Append("\"parent_id\":0,"); builder.Append("\"id\":" + photoCategories.Rows[j]["CategoryId"] + ","); builder.Append("\"picNum\":" + GalleryHelper.GetPhotoList("", new int?(Convert.ToInt32(photoCategories.Rows[j]["CategoryId"])), 10, PhotoListOrder.UploadTimeDesc, type, 20).TotalRecords); builder.Append("},"); } } return(builder.ToString().TrimEnd(new char[] { ',' })); }
protected void Page_Load(object sender, EventArgs e) { Hashtable hashtable = new Hashtable(); base.Response.AddHeader("Content-Type", "application/json; charset=UTF-8"); if (Globals.GetCurrentManagerUserId() == 0) { base.Response.Write(JsonMapper.ToJson(hashtable)); base.Response.End(); } else { List <Hashtable> list = new List <Hashtable>(); hashtable["category_list"] = list; foreach (DataRow row in GalleryHelper.GetPhotoCategories().Rows) { Hashtable item = new Hashtable(); item["cId"] = row["CategoryId"]; item["cName"] = row["CategoryName"]; list.Add(item); } base.Response.Write(JsonMapper.ToJson(hashtable)); base.Response.End(); } }
public override void DataBind() { this.Items.Clear(); base.Items.Add(new ListItem("默认分类", "0")); foreach (DataRow row in GalleryHelper.GetPhotoCategories().Rows) { base.Items.Add(new ListItem(row["CategoryName"].ToString(), row["CategoryId"].ToString())); } }
public override void DataBind() { this.Items.Clear(); base.Items.Add(new ListItem("默认分组", "0")); DataTable photoCategories = GalleryHelper.GetPhotoCategories(0); foreach (DataRow dataRow in photoCategories.Rows) { base.Items.Add(new ListItem(dataRow["CategoryName"].ToString(), dataRow["CategoryId"].ToString())); } }
public string GetImgTypeJson() { string str = ""; DataTable photoCategories = GalleryHelper.GetPhotoCategories(); for (int i = 0; i < photoCategories.Rows.Count; i++) { object obj2 = str + "{"; object obj3 = string.Concat(new object[] { obj2, "\"name\":\"", photoCategories.Rows[i]["CategoryName"], "\"," }) + "\"parent_id\":0,"; str = (string.Concat(new object[] { obj3, "\"id\":", photoCategories.Rows[i]["CategoryId"], "," }) + "\"picNum\":" + GalleryHelper.GetPhotoList("", new int?(Convert.ToInt32(photoCategories.Rows[i]["CategoryId"])), 10, PhotoListOrder.UploadTimeDesc).TotalRecords) + "},"; } return(str.TrimEnd(new char[] { ',' })); }
protected override void Render(HtmlTextWriter writer) { string text = "<ul>"; string str = string.Empty; DataTable photoCategories = GalleryHelper.GetPhotoCategories(this.typeId); int defaultPhotoCount = GalleryHelper.GetDefaultPhotoCount(); string text2 = this.Page.Request.QueryString["ImageTypeId"]; string empty = string.Empty; if (!string.IsNullOrEmpty(text2)) { text2 = this.Page.Request.QueryString["ImageTypeId"]; } if (text2 == "0") { object obj = text; text = string.Concat(new object[] { obj, "<li><a href=\"ImageData.aspx?ImageTypeId=0\"><s></s><strong>默认分类<span>(", defaultPhotoCount, ")</span></strong></a></li>" }); } else { object obj = text; text = string.Concat(new object[] { obj, "<li><a href=\"ImageData.aspx?ImageTypeId=0\"><s></s>默认分组<span>(", defaultPhotoCount, ")</span></a></li>" }); } foreach (DataRow dataRow in photoCategories.Rows) { if (dataRow["CategoryId"].ToString() == text2) { str = string.Format("<li><a href=\"ImageData.aspx?ImageTypeId={0}\"><s></s><strong>{1}</strong><span>({2})</span></a></li>", dataRow["CategoryId"], dataRow["CategoryName"], dataRow["PhotoCounts"].ToString()); } else { str = string.Format("<li><a href=\"ImageData.aspx?ImageTypeId={0}\"><s></s>{1}<span>({2})</span></a></li>", dataRow["CategoryId"], dataRow["CategoryName"], dataRow["PhotoCounts"].ToString()); } text += str; } text += "</ul>"; base.Text = text; base.Render(writer); }
public string GetImgTypeJson(int supplierId) { string text = ""; DataTable photoCategories = GalleryHelper.GetPhotoCategories(supplierId); for (int i = 0; i < photoCategories.Rows.Count; i++) { text += "{"; text = text + "\"name\":\"" + photoCategories.Rows[i]["CategoryName"] + "\","; text += "\"parent_id\":0,"; text = text + "\"id\":" + photoCategories.Rows[i]["CategoryId"] + ","; text += "\"picNum\":" + photoCategories.Rows[i]["PhotoCounts"]; text += "},"; } return(text.TrimEnd(',')); }
private DataGridViewModel <Dictionary <string, object> > GetDataList() { DataGridViewModel <Dictionary <string, object> > dataGridViewModel = new DataGridViewModel <Dictionary <string, object> >(); DataTable photoCategories = GalleryHelper.GetPhotoCategories(0); DataRow dataRow = photoCategories.NewRow(); dataRow["CategoryId"] = "0"; dataRow["CategoryName"] = "默认分类"; dataRow["DisplaySequence"] = "0"; dataRow["PhotoCounts"] = GalleryHelper.GetDefaultPhotoCount().ToString(); photoCategories.Rows.InsertAt(dataRow, 0); dataGridViewModel.rows = new List <Dictionary <string, object> >(); foreach (DataRow row in photoCategories.Rows) { Dictionary <string, object> item = DataHelper.DataRowToDictionary(row); dataGridViewModel.rows.Add(item); } dataGridViewModel.total = dataGridViewModel.rows.Count; return(dataGridViewModel); }
protected override void Render(HtmlTextWriter writer) { object obj2; string str = "<ul>"; string str2 = string.Empty; DataTable photoCategories = GalleryHelper.GetPhotoCategories(); int defaultPhotoCount = GalleryHelper.GetDefaultPhotoCount(); string str3 = this.Page.Request.QueryString["ImageTypeId"]; string str4 = string.Empty; if (!string.IsNullOrEmpty(str3)) { str3 = this.Page.Request.QueryString["ImageTypeId"]; } if (str3 == "0") { obj2 = str; str = string.Concat(new object[] { obj2, "<li><a href=\"", Globals.ApplicationPath, "/admin/store/ImageData.aspx?pageSize=20&ImageTypeId=0\" class='classLink'><s></s><strong>默认分类<span>(", defaultPhotoCount, ")</span></strong></a></li>" }); } else { obj2 = str; str = string.Concat(new object[] { obj2, "<li><a href=\"", Globals.ApplicationPath, "/admin/store/ImageData.aspx?pageSize=20&ImageTypeId=0\"><s></s><strong>默认分类<span>(", defaultPhotoCount, ")</span></strong></a></li>" }); } foreach (DataRow row in photoCategories.Rows) { if (row["CategoryId"].ToString() == str3) { str4 = "class='classLink'"; } else { str4 = ""; } str2 = string.Format("<li><a href=\"" + Globals.ApplicationPath + "/admin/store/ImageData.aspx?pageSize=20&ImageTypeId={0}\" " + str4 + "><s></s>{1}<span>({2})</span></a></li>", row["CategoryId"], row["CategoryName"], row["PhotoCounts"].ToString()); str = str + str2; } str = str + "</ul>"; base.Text = str; base.Render(writer); }
protected void Page_Load(object sender, System.EventArgs e) { System.Collections.Hashtable hashtable = new System.Collections.Hashtable(); base.Response.AddHeader("Content-Type", "application/json; charset=UTF-8"); if (Globals.GetCurrentManagerUserId() == 0) { base.Response.Write(JsonMapper.ToJson(hashtable)); base.Response.End(); return; } System.Collections.Generic.List <System.Collections.Hashtable> list = new System.Collections.Generic.List <System.Collections.Hashtable>(); hashtable["category_list"] = list; System.Data.DataTable photoCategories = GalleryHelper.GetPhotoCategories(0); foreach (System.Data.DataRow dataRow in photoCategories.Rows) { System.Collections.Hashtable hashtable2 = new System.Collections.Hashtable(); hashtable2["cId"] = dataRow["CategoryId"]; hashtable2["cName"] = dataRow["CategoryName"]; list.Add(hashtable2); } base.Response.Write(JsonMapper.ToJson(hashtable)); base.Response.End(); }
protected override void Render(HtmlTextWriter writer) { string text = "<ul>"; string empty = string.Empty; DataTable photoCategories = GalleryHelper.GetPhotoCategories(0); int defaultPhotoCount = GalleryHelper.GetDefaultPhotoCount(); string text2 = this.Page.Request.QueryString["ImageTypeId"]; string empty2 = string.Empty; if (!string.IsNullOrEmpty(text2)) { text2 = this.Page.Request.QueryString["ImageTypeId"]; } text = ((!(text2 == "0")) ? (text + "<li><a href=\"/admin/store/ImageData?pageSize=20&ImageTypeId=0\"><s></s><strong>默认分类<span>(" + defaultPhotoCount + ")</span></strong></a></li>") : (text + "<li><a href=\"/admin/store/ImageData?pageSize=20&ImageTypeId=0\" class='classLink'><s></s><strong>默认分类<span>(" + defaultPhotoCount + ")</span></strong></a></li>")); foreach (DataRow row in photoCategories.Rows) { empty2 = ((!(row["CategoryId"].ToString() == text2)) ? "" : "class='classLink'"); empty = string.Format("<li><a href=\"/admin/store/ImageData?pageSize=20&ImageTypeId={0}\" " + empty2 + "><s></s>{1}<span>({2})</span></a></li>", row["CategoryId"], row["CategoryName"], row["PhotoCounts"].ToString()); text += empty; } text = (base.Text = text + "</ul>"); base.Render(writer); }
private void GetImageType() { this.ImageTypeList.DataSource = GalleryHelper.GetPhotoCategories(); this.ImageTypeList.DataBind(); }