protected void btnAudit_Click(object sender, EventArgs e) { this.ChkAdminLevel("channel_" + this.channel_name + "_list", DTEnums.ActionEnum.Audit.ToString()); Rain.BLL.article article = new Rain.BLL.article(); Repeater repeater1 = new Repeater(); Repeater repeater2; switch (this.prolistview) { case "Txt": repeater2 = this.rptList1; break; default: repeater2 = this.rptList2; break; } for (int index = 0; index < repeater2.Items.Count; ++index) { int int32 = Convert.ToInt32(((HiddenField)repeater2.Items[index].FindControl("hidId")).Value); if (((CheckBox)repeater2.Items[index].FindControl("chkId")).Checked) { article.UpdateField(int32, "status=0"); } } this.AddAdminLog(DTEnums.ActionEnum.Audit.ToString(), "审核" + this.channel_name + "频道内容信息"); this.JscriptMsg("批量审核成功!", Utils.CombUrlTxt("article_list.aspx", "channel_id={0}&category_id={1}&keywords={2}&property={3}", this.channel_id.ToString(), this.category_id.ToString(), this.keywords, this.property)); }
private void RptBind(int _channel_id, int _category_id, string _strWhere, string _orderby) { this.page = DTRequest.GetQueryInt("page", 1); if (this.category_id > 0) { this.ddlCategoryId.SelectedValue = _category_id.ToString(); } this.ddlProperty.SelectedValue = this.property; this.txtKeywords.Text = this.keywords; Rain.BLL.article article = new Rain.BLL.article(); switch (this.prolistview) { case "Txt": this.rptList2.Visible = false; this.rptList1.DataSource = (object)article.GetList(_channel_id, _category_id, this.pageSize, this.page, _strWhere, _orderby, out this.totalCount); this.rptList1.DataBind(); break; default: this.rptList1.Visible = false; this.rptList2.DataSource = (object)article.GetList(_channel_id, _category_id, this.pageSize, this.page, _strWhere, _orderby, out this.totalCount); this.rptList2.DataBind(); break; } this.txtPageNum.Text = this.pageSize.ToString(); this.PageContent.InnerHtml = Utils.OutPageList(this.pageSize, this.page, this.totalCount, Utils.CombUrlTxt("article_list.aspx", "channel_id={0}&category_id={1}&keywords={2}&property={3}&page={4}", _channel_id.ToString(), _category_id.ToString(), this.keywords, this.property, "__id__"), 8); }
protected void btnSave_Click(object sender, EventArgs e) { this.ChkAdminLevel("channel_" + this.channel_name + "_list", DTEnums.ActionEnum.Edit.ToString()); Rain.BLL.article article = new Rain.BLL.article(); Repeater repeater1 = new Repeater(); Repeater repeater2; switch (this.prolistview) { case "Txt": repeater2 = this.rptList1; break; default: repeater2 = this.rptList2; break; } for (int index = 0; index < repeater2.Items.Count; ++index) { int int32 = Convert.ToInt32(((HiddenField)repeater2.Items[index].FindControl("hidId")).Value); int result; if (!int.TryParse(((TextBox)repeater2.Items[index].FindControl("txtSortId")).Text.Trim(), out result)) { result = 99; } article.UpdateField(int32, "sort_id=" + result.ToString()); } this.AddAdminLog(DTEnums.ActionEnum.Edit.ToString(), "保存" + this.channel_name + "频道内容排序"); this.JscriptMsg("保存排序成功!", Utils.CombUrlTxt("article_list.aspx", "channel_id={0}&category_id={1}&keywords={2}&property={3}", this.channel_id.ToString(), this.category_id.ToString(), this.keywords, this.property)); }
protected DataTable get_article_list( string channel_name, int category_id, int page_size, int page_index, string strwhere, string orderby, out int totalcount, out string pagelist, string _key, params object[] _params) { DataTable dataTable = new DataTable(); if (!string.IsNullOrEmpty(channel_name)) { dataTable = new Rain.BLL.article().GetList(channel_name, category_id, page_size, page_index, strwhere, orderby, out totalcount).Tables[0]; pagelist = Utils.OutPageList(page_size, page_index, totalcount, this.linkurl(_key, _params), 8); } else { totalcount = 0; pagelist = ""; } return(dataTable); }
protected DataTable get_search_list(int _pagesize, out int _totalcount) { DataTable dataTable = new DataTable(); dataTable.Columns.Add("id", Type.GetType("System.Int32")); dataTable.Columns.Add("title", Type.GetType("System.String")); dataTable.Columns.Add("remark", Type.GetType("System.String")); dataTable.Columns.Add("channel_id", Type.GetType("System.String")); dataTable.Columns.Add("link_url", Type.GetType("System.String")); dataTable.Columns.Add("add_time", Type.GetType("System.String")); dataTable.Columns.Add("img_url", Type.GetType("System.String")); DataSet search = new Rain.BLL.article().GetSearch(this.channel, _pagesize, this.page, "(title like '%" + this.keyword + "%' or zhaiyao like '%" + this.keyword + "%')", "add_time desc,id desc", out _totalcount); if (search.Tables[0].Rows.Count > 0) { for (int index = 0; index < search.Tables[0].Rows.Count; ++index) { DataRow row1 = search.Tables[0].Rows[index]; string urlRewrite = this.get_url_rewrite(Utils.StrToInt(row1["channel_id"].ToString(), 0), row1["call_index"].ToString(), Utils.StrToInt(row1["id"].ToString(), 0)); if (!string.IsNullOrEmpty(urlRewrite)) { DataRow row2 = dataTable.NewRow(); row2["id"] = row1["id"]; row2["title"] = row1["title"]; row2["remark"] = row1["zhaiyao"]; row2["link_url"] = (object)urlRewrite; row2["add_time"] = row1["add_time"]; row2["channel_id"] = row1["channel_id"]; row2["img_url"] = row1["img_url"]; dataTable.Rows.Add(row2); } } } return(dataTable); }
protected string get_article_img_url(int article_id) { Rain.Model.article model = new Rain.BLL.article().GetModel(article_id); if (model != null) { return(model.img_url); } return(""); }
protected string get_article_field(int article_id, string field_name) { Rain.Model.article model = new Rain.BLL.article().GetModel(article_id); if (model != null && model.fields.ContainsKey(field_name)) { return(model.fields[field_name]); } return(string.Empty); }
protected void rptList_ItemCommand(object source, RepeaterCommandEventArgs e) { this.ChkAdminLevel("channel_" + this.channel_name + "_list", DTEnums.ActionEnum.Edit.ToString()); int int32 = Convert.ToInt32(((HiddenField)e.Item.FindControl("hidId")).Value); Rain.BLL.article article = new Rain.BLL.article(); Rain.Model.article model = article.GetModel(int32); switch (e.CommandName) { case "lbtnIsMsg": if (model.is_msg == 1) { article.UpdateField(int32, "is_msg=0"); break; } article.UpdateField(int32, "is_msg=1"); break; case "lbtnIsTop": if (model.is_top == 1) { article.UpdateField(int32, "is_top=0"); break; } article.UpdateField(int32, "is_top=1"); break; case "lbtnIsRed": if (model.is_red == 1) { article.UpdateField(int32, "is_red=0"); break; } article.UpdateField(int32, "is_red=1"); break; case "lbtnIsHot": if (model.is_hot == 1) { article.UpdateField(int32, "is_hot=0"); break; } article.UpdateField(int32, "is_hot=1"); break; case "lbtnIsSlide": if (model.is_slide == 1) { article.UpdateField(int32, "is_slide=0"); break; } article.UpdateField(int32, "is_slide=1"); break; } this.RptBind(this.channel_id, this.category_id, "id>0" + this.CombSqlTxt(this.keywords, this.property), "sort_id asc,add_time desc,id desc"); }
protected DataTable get_article_list(string channel_name, int top, string strwhere) { DataTable dataTable = new DataTable(); if (!string.IsNullOrEmpty(channel_name)) { dataTable = new Rain.BLL.article().GetList(channel_name, top, strwhere, "sort_id asc,add_time desc").Tables[0]; } return(dataTable); }
public static List <cart_items> ToList(List <cart_keys> ls, int group_id) { if (ls == null) { return((List <cart_items>)null); } List <cart_items> cartItemsList = new List <cart_items>(); foreach (cart_keys l in ls) { Rain.Model.article model = new Rain.BLL.article().GetModel(l.article_id); if (model != null && model.fields.ContainsKey("sell_price")) { cart_items cartItems = new cart_items(); cartItems.article_id = model.id; if (model.fields.ContainsKey("goods_no")) { cartItems.goods_no = model.fields["goods_no"]; } cartItems.title = model.title; cartItems.img_url = model.img_url; cartItems.sell_price = Utils.StrToDecimal(model.fields["sell_price"], new Decimal(0)); cartItems.user_price = Utils.StrToDecimal(model.fields["sell_price"], new Decimal(0)); if (model.fields.ContainsKey("point")) { cartItems.point = Utils.StrToInt(model.fields["point"], 0); } if (model.fields.ContainsKey("stock_quantity")) { cartItems.stock_quantity = Utils.StrToInt(model.fields["stock_quantity"], 0); } bool flag = false; if (group_id > 0 && model.group_price != null) { user_group_price userGroupPrice = model.group_price.Find((Predicate <user_group_price>)(p => p.group_id == group_id)); if (userGroupPrice != null) { flag = true; cartItems.user_price = userGroupPrice.price; } } if (group_id > 0 && !flag) { int discount = new Rain.BLL.user_groups().GetDiscount(group_id); if (discount > 0) { cartItems.user_price = cartItems.sell_price * (Decimal)discount / new Decimal(100); } } cartItems.quantity = l.quantity; cartItemsList.Add(cartItems); } } return(cartItemsList); }
protected string get_article_content(string call_index) { if (string.IsNullOrEmpty(call_index)) { return(string.Empty); } Rain.BLL.article article = new Rain.BLL.article(); if (article.Exists(call_index)) { return(article.GetModel(call_index).content); } return(string.Empty); }
protected DataTable get_article_list( string channel_name, int category_id, int top, string strwhere, string orderby) { DataTable dataTable = new DataTable(); if (!string.IsNullOrEmpty(channel_name)) { dataTable = new Rain.BLL.article().GetList(channel_name, category_id, top, strwhere, orderby).Tables[0]; } return(dataTable); }
protected string get_article_field(string call_index, string field_name) { if (string.IsNullOrEmpty(call_index)) { return(string.Empty); } Rain.BLL.article article = new Rain.BLL.article(); if (!article.Exists(call_index)) { return(string.Empty); } Rain.Model.article model = article.GetModel(call_index); if (model != null && model.fields.ContainsKey(field_name)) { return(model.fields[field_name]); } return(string.Empty); }
protected DataTable get_article_list( string channel_name, int category_id, int page_size, int page_index, string strwhere, string orderby, out int totalcount) { DataTable dataTable = new DataTable(); if (!string.IsNullOrEmpty(channel_name)) { dataTable = new Rain.BLL.article().GetList(channel_name, category_id, page_size, page_index, strwhere, orderby, out totalcount).Tables[0]; } else { totalcount = 0; } return(dataTable); }
protected List <Rain.Model.article> get_order_goods_list(int order_id) { Rain.Model.orders model1 = new Rain.BLL.orders().GetModel(order_id); if (model1 == null) { return((List <Rain.Model.article>)null); } List <Rain.Model.article> articleList = new List <Rain.Model.article>(); if (model1.order_goods != null) { foreach (order_goods orderGood in model1.order_goods) { Rain.Model.article model2 = new Rain.BLL.article().GetModel(orderGood.article_id); if (model2 != null) { articleList.Add(model2); } } } return(articleList); }
protected void btnDelete_Click(object sender, EventArgs e) { this.ChkAdminLevel("channel_" + this.channel_name + "_list", DTEnums.ActionEnum.Delete.ToString()); int num1 = 0; int num2 = 0; Rain.BLL.article article = new Rain.BLL.article(); Repeater repeater1 = new Repeater(); Repeater repeater2; switch (this.prolistview) { case "Txt": repeater2 = this.rptList1; break; default: repeater2 = this.rptList2; break; } for (int index = 0; index < repeater2.Items.Count; ++index) { int int32 = Convert.ToInt32(((HiddenField)repeater2.Items[index].FindControl("hidId")).Value); if (((CheckBox)repeater2.Items[index].FindControl("chkId")).Checked) { if (article.Delete(int32)) { ++num1; } else { ++num2; } } } this.AddAdminLog(DTEnums.ActionEnum.Edit.ToString(), "删除" + this.channel_name + "频道内容成功" + (object)num1 + "条,失败" + (object)num2 + "条"); this.JscriptMsg("删除成功" + (object)num1 + "条,失败" + (object)num2 + "条!", Utils.CombUrlTxt("article_list.aspx", "channel_id={0}&category_id={1}&keywords={2}&property={3}", this.channel_id.ToString(), this.category_id.ToString(), this.keywords, this.property)); }
protected override void ShowPage() { this.id = DTRequest.GetQueryInt("id"); this.page = DTRequest.GetQueryString("page"); Rain.BLL.article article = new Rain.BLL.article(); if (this.id > 0) { if (!article.Exists(this.id)) { HttpContext.Current.Response.Redirect(this.linkurl("error", (object)("?msg=" + Utils.UrlEncode("出错啦,您要浏览的页面不存在或已删除!")))); return; } this.model = article.GetModel(this.id); } else { if (string.IsNullOrEmpty(this.page)) { return; } if (!article.Exists(this.page)) { HttpContext.Current.Response.Redirect(this.linkurl("error", (object)("?msg=" + Utils.UrlEncode("出错啦,您要浏览的页面不存在或已删除!")))); return; } this.model = article.GetModel(this.page); } if (this.model.link_url != null) { this.model.link_url = this.model.link_url.Trim(); } if (string.IsNullOrEmpty(this.model.link_url)) { return; } HttpContext.Current.Response.Redirect(this.model.link_url); }
protected string get_prevandnext_article( string urlkey, int type, string defaultvalue, int callIndex) { string str1 = type == -1 ? "<" : ">"; Rain.BLL.article article = new Rain.BLL.article(); string empty = string.Empty; string str2 = " and category_id=" + (object)this.model.category_id; string filedOrder = type == -1 ? "id desc" : "id asc"; DataSet list = article.GetList(1, "channel_id=" + (object)this.model.channel_id + " " + str2 + " and status=0 and Id" + str1 + (object)this.id, filedOrder); if (list == null || list.Tables[0].Rows.Count <= 0) { return(defaultvalue); } if (callIndex == 1 && !string.IsNullOrEmpty(list.Tables[0].Rows[0]["call_index"].ToString())) { return("<a href=\"" + this.linkurl(urlkey, (object)list.Tables[0].Rows[0]["call_index"].ToString()) + "\">" + list.Tables[0].Rows[0]["title"] + "</a>"); } return("<a href=\"" + this.linkurl(urlkey, (object)list.Tables[0].Rows[0]["id"].ToString()) + "\">" + list.Tables[0].Rows[0]["title"] + "</a>"); }
private bool DoEdit(int _id) { bool flag = false; Rain.BLL.article article = new Rain.BLL.article(); Rain.Model.article model = article.GetModel(_id); model.channel_id = this.channel_id; model.category_id = Utils.StrToInt(this.ddlCategoryId.SelectedValue, 0); model.call_index = this.txtCallIndex.Text.Trim(); model.title = this.txtTitle.Text.Trim(); model.link_url = this.txtLinkUrl.Text.Trim(); model.img_url = this.txtImgUrl.Text; model.seo_title = this.txtSeoTitle.Text.Trim(); model.seo_keywords = this.txtSeoKeywords.Text.Trim(); model.seo_description = this.txtSeoDescription.Text.Trim(); model.zhaiyao = !string.IsNullOrEmpty(this.txtZhaiyao.Text.Trim()) ? Utils.DropHTML(this.txtZhaiyao.Text, (int)byte.MaxValue) : Utils.DropHTML(this.txtContent.Value, (int)byte.MaxValue); model.content = this.txtContent.Value; model.sort_id = Utils.StrToInt(this.txtSortId.Text.Trim(), 99); model.click = int.Parse(this.txtClick.Text.Trim()); model.status = Utils.StrToInt(this.rblStatus.SelectedValue, 0); model.is_msg = 0; model.is_top = 0; model.is_red = 0; model.is_hot = 0; model.is_slide = 0; if (this.cblItem.Items[0].Selected) { model.is_msg = 1; } if (this.cblItem.Items[1].Selected) { model.is_top = 1; } if (this.cblItem.Items[2].Selected) { model.is_red = 1; } if (this.cblItem.Items[3].Selected) { model.is_hot = 1; } if (this.cblItem.Items[4].Selected) { model.is_slide = 1; } model.add_time = Utils.StrToDateTime(this.txtAddTime.Text.Trim()); model.update_time = new DateTime?(DateTime.Now); model.fields = this.SetFieldValues(this.channel_id); if (this.txtImgUrl.Text.Trim() == "") { model.img_url = this.hidFocusPhoto.Value; } if (model.albums != null) { model.albums.Clear(); } string[] values1 = this.Request.Form.GetValues("hid_photo_name"); string[] values2 = this.Request.Form.GetValues("hid_photo_remark"); if (values1 != null) { List <article_albums> articleAlbumsList = new List <article_albums>(); for (int index = 0; index < values1.Length; ++index) { string[] strArray = values1[index].Split('|'); int num = Utils.StrToInt(strArray[0], 0); if (strArray.Length == 3) { if (!string.IsNullOrEmpty(values2[index])) { articleAlbumsList.Add(new article_albums() { id = num, article_id = _id, original_path = strArray[1], thumb_path = strArray[2], remark = values2[index] }); } else { articleAlbumsList.Add(new article_albums() { id = num, article_id = _id, original_path = strArray[1], thumb_path = strArray[2] }); } } } model.albums = articleAlbumsList; } if (model.attach != null) { model.attach.Clear(); } string[] values3 = this.Request.Form.GetValues("hid_attach_id"); string[] values4 = this.Request.Form.GetValues("hid_attach_filename"); string[] values5 = this.Request.Form.GetValues("hid_attach_filepath"); string[] values6 = this.Request.Form.GetValues("hid_attach_filesize"); string[] values7 = this.Request.Form.GetValues("txt_attach_point"); if (values3 != null && values4 != null && (values5 != null && values6 != null) && (values7 != null && values3.Length > 0 && (values4.Length > 0 && values5.Length > 0)) && values6.Length > 0 && values7.Length > 0) { List <Rain.Model.article_attach> articleAttachList = new List <Rain.Model.article_attach>(); for (int index = 0; index < values4.Length; ++index) { int num1 = Utils.StrToInt(values3[index], 0); int num2 = Utils.StrToInt(values6[index], 0); string fileExt = Utils.GetFileExt(values5[index]); int num3 = Utils.StrToInt(values7[index], 0); articleAttachList.Add(new Rain.Model.article_attach() { id = num1, article_id = _id, file_name = values4[index], file_path = values5[index], file_size = num2, file_ext = fileExt, point = num3 }); } model.attach = articleAttachList; } List <user_group_price> userGroupPriceList = new List <user_group_price>(); for (int index = 0; index < this.rptPrice.Items.Count; ++index) { int num1 = 0; if (!string.IsNullOrEmpty(((HiddenField)this.rptPrice.Items[index].FindControl("hidePriceId")).Value)) { num1 = Convert.ToInt32(((HiddenField)this.rptPrice.Items[index].FindControl("hidePriceId")).Value); } int int32 = Convert.ToInt32(((HiddenField)this.rptPrice.Items[index].FindControl("hideGroupId")).Value); Decimal num2 = Convert.ToDecimal(((TextBox)this.rptPrice.Items[index].FindControl("txtGroupPrice")).Text.Trim()); userGroupPriceList.Add(new user_group_price() { id = num1, article_id = _id, group_id = int32, price = num2 }); } model.group_price = userGroupPriceList; if (article.Update(model)) { this.AddAdminLog(DTEnums.ActionEnum.Edit.ToString(), "修改" + this.channel_name + "频道内容:" + model.title); flag = true; } return(flag); }
private void ShowInfo(int _id) { Rain.Model.article model1 = new Rain.BLL.article().GetModel(_id); this.ddlCategoryId.SelectedValue = model1.category_id.ToString(); this.txtCallIndex.Text = model1.call_index; this.txtTitle.Text = model1.title; this.txtLinkUrl.Text = model1.link_url; string str1 = model1.img_url.Substring(model1.img_url.LastIndexOf("/") + 1); if (!str1.StartsWith("thumb_")) { this.txtImgUrl.Text = model1.img_url; } this.txtSeoTitle.Text = model1.seo_title; this.txtSeoKeywords.Text = model1.seo_keywords; this.txtSeoDescription.Text = model1.seo_description; this.txtZhaiyao.Text = model1.zhaiyao; this.txtContent.Value = model1.content; TextBox txtSortId = this.txtSortId; int num = model1.sort_id; string str2 = num.ToString(); txtSortId.Text = str2; TextBox txtClick = this.txtClick; num = model1.click; string str3 = num.ToString(); txtClick.Text = str3; this.rblStatus.SelectedValue = model1.status.ToString(); if (this.action == DTEnums.ActionEnum.Edit.ToString()) { this.txtAddTime.Text = model1.add_time.ToString("yyyy-MM-dd HH:mm:ss"); } if (model1.is_msg == 1) { this.cblItem.Items[0].Selected = true; } if (model1.is_top == 1) { this.cblItem.Items[1].Selected = true; } if (model1.is_red == 1) { this.cblItem.Items[2].Selected = true; } if (model1.is_hot == 1) { this.cblItem.Items[3].Selected = true; } if (model1.is_slide == 1) { this.cblItem.Items[4].Selected = true; } foreach (Rain.Model.article_attribute_field model2 in new Rain.BLL.article_attribute_field().GetModelList(this.channel_id, "")) { switch (model2.control_type) { case "single-text": case "multi-text": case "images": case "video": case "number": case "datetime": TextBox control1 = this.FindControl("field_control_" + model2.name) as TextBox; if (control1 != null && model1.fields.ContainsKey(model2.name)) { if (model2.is_password == 1) { control1.Attributes.Add("value", model1.fields[model2.name]); } else { control1.Text = model1.fields[model2.name]; } break; } break; case "editor": HtmlTextArea control2 = this.FindControl("field_control_" + model2.name) as HtmlTextArea; if (control2 != null && model1.fields.ContainsKey(model2.name)) { control2.Value = model1.fields[model2.name]; break; } break; case "checkbox": CheckBox control3 = this.FindControl("field_control_" + model2.name) as CheckBox; if (control3 != null && model1.fields.ContainsKey(model2.name)) { control3.Checked = model1.fields[model2.name] == "1"; break; } break; case "multi-radio": RadioButtonList control4 = this.FindControl("field_control_" + model2.name) as RadioButtonList; if (control4 != null && model1.fields.ContainsKey(model2.name)) { control4.SelectedValue = model1.fields[model2.name]; break; } break; case "multi-checkbox": CheckBoxList control5 = this.FindControl("field_control_" + model2.name) as CheckBoxList; if (control5 != null && model1.fields.ContainsKey(model2.name)) { string[] strArray = model1.fields[model2.name].Split(','); for (int index = 0; index < control5.Items.Count; ++index) { control5.Items[index].Selected = false; foreach (string str4 in strArray) { if (control5.Items[index].Value == str4) { control5.Items[index].Selected = true; } } } break; } break; } } if (str1.StartsWith("thumb_")) { this.hidFocusPhoto.Value = model1.img_url; } this.rptAlbumList.DataSource = (object)model1.albums; this.rptAlbumList.DataBind(); this.rptAttachList.DataSource = (object)model1.attach; this.rptAttachList.DataBind(); if (model1.group_price == null) { return; } for (int index = 0; index < this.rptPrice.Items.Count; ++index) { int int32 = Convert.ToInt32(((HiddenField)this.rptPrice.Items[index].FindControl("hideGroupId")).Value); foreach (user_group_price userGroupPrice in model1.group_price) { if (int32 == userGroupPrice.group_id) { ((HiddenField)this.rptPrice.Items[index].FindControl("hidePriceId")).Value = userGroupPrice.id.ToString(); ((TextBox)this.rptPrice.Items[index].FindControl("txtGroupPrice")).Text = userGroupPrice.price.ToString(); } } } }