//批量删除 protected void btnDelete_Click(object sender, EventArgs e) { ChkAdminLevel("channel_" + this.channel_name + "_list", MXEnums.ActionEnum.Delete.ToString()); //检查权限 int sucCount = 0; //成功数量 int errorCount = 0; //失败数量 BLL.article bll = new BLL.article(); Repeater rptList = new Repeater(); rptList = this.rptList1; for (int i = 0; i < rptList.Items.Count; i++) { int id = Convert.ToInt32(((HiddenField)rptList.Items[i].FindControl("hidId")).Value); CheckBox cb = (CheckBox)rptList.Items[i].FindControl("chkId"); if (cb.Checked) { if (bll.Delete(id)) { sucCount++; } else { errorCount++; } } } AddAdminLog(MXEnums.ActionEnum.Edit.ToString(), "删除" + this.channel_name + "单页内容成功" + sucCount + "条,失败" + errorCount + "条"); //记录日志 JscriptMsg("删除成功" + sucCount + "条,失败" + errorCount + "条!", Utils.CombUrlTxt("article_page_list.aspx", "channel_id={0}&category_id={1}&keywords={2}&property={3}", this.channel_id.ToString(), this.category_id.ToString(), this.keywords, this.property), "Success"); }
private void ShowInfo(int _id) { BLL.article bll = new BLL.article(); Model.article_content model = bll.GetContentModel(_id); ddlCategoryId.SelectedValue = model.category_id.ToString(); txtCallIndex.Text = model.call_index; txtTitle.Text = model.title; txtImgUrl.Text = model.img_url; txtLinkUrl.Text = model.link_url; if (model.is_msg == 1) { cblItem.Items[0].Selected = true; } if (model.is_red == 1) { cblItem.Items[1].Selected = true; } if (model.is_lock == 1) { cblItem.Items[2].Selected = true; } txtSortId.Text = model.sort_id.ToString(); txtClick.Text = model.click.ToString(); txtDiggGood.Text = model.digg_good.ToString(); txtDiggBad.Text = model.digg_bad.ToString(); txtContent.Value = model.content; txtSeoTitle.Text = model.seo_title; txtSeoKeywords.Text = model.seo_keywords; txtSeoDescription.Text = model.seo_description; }
private void RptBind(int _channel_id, int _category_id, string _strWhere, string _orderby) { Model.wx_userweixin weixin = GetWeiXinCode(); this.page = MXRequest.GetQueryInt("page", 1); this.txtKeywords.Text = this.keywords; //图表或列表显示 BLL.article bll = new BLL.article(); DataSet ds = bll.GetWCodeList(weixin.id, _channel_id, _category_id, this.pageSize, this.page, _strWhere, _orderby, out this.totalCount); if (ds != null && ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0) { DataRow dr; int cout=ds.Tables[0].Rows.Count; for (int i = 0; i < cout; i++) { dr = ds.Tables[0].Rows[i]; dr["link_url"] = MyCommFun.getWebSite() + "/content.aspx?wid=" +MyCommFun.ObjToStr(dr["wid"]) + "&aid=" + dr["id"].ToString(); } ds.AcceptChanges(); } this.rptList1.DataSource = ds; this.rptList1.DataBind(); //绑定页码 txtPageNum.Text = this.pageSize.ToString(); string pageUrl = Utils.CombUrlTxt("article_page_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__"); PageContent.InnerHtml = Utils.OutPageList(this.pageSize, this.page, this.totalCount, pageUrl, 8); }
//批量删除 protected void btnDelete_Click(object sender, EventArgs e) { ChkAdminLevel(channel_id, DTEnums.ActionEnum.Delete.ToString()); //检查权限 BLL.article bll = new BLL.article(); Repeater rptList = new Repeater(); switch (this.prolistview) { case "Txt": rptList = this.rptList1; break; default: rptList = this.rptList2; break; } for (int i = 0; i < rptList.Items.Count; i++) { int id = Convert.ToInt32(((HiddenField)rptList.Items[i].FindControl("hidId")).Value); CheckBox cb = (CheckBox)rptList.Items[i].FindControl("chkId"); if (cb.Checked) { bll.Delete(id); } } JscriptMsg("批量删除成功啦!", Utils.CombUrlTxt("list.aspx", "channel_id={0}&category_id={1}&keywords={2}&property={3}", this.channel_id.ToString(), this.category_id.ToString(), this.keywords, this.property), "Success"); }
//批量审核 protected void btnAudit_Click(object sender, EventArgs e) { ChkAdminLevel("channel_" + this.channel_name + "_list", DTEnums.ActionEnum.Audit.ToString()); //检查权限 BLL.article bll = new BLL.article(); Repeater rptList = new Repeater(); switch (this.prolistview) { case "Txt": rptList = this.rptList1; break; default: rptList = this.rptList2; break; } for (int i = 0; i < rptList.Items.Count; i++) { int id = Convert.ToInt32(((HiddenField)rptList.Items[i].FindControl("hidId")).Value); CheckBox cb = (CheckBox)rptList.Items[i].FindControl("chkId"); if (cb.Checked) { bll.UpdateField(id, "status=0"); } } AddAdminLog(DTEnums.ActionEnum.Audit.ToString(), "审核" + this.channel_name + "频道内容信息"); //记录日志 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 ShowInfo(int _id) { BLL.article bll = new BLL.article(); Model.article_download model = bll.GetDownloadModel(_id); ddlCategoryId.SelectedValue = model.category_id.ToString(); txtTitle.Text = model.title; txtImgUrl.Text = model.img_url; txtLinkUrl.Text = model.link_url; if (model.is_msg == 1) { cblItem.Items[0].Selected = true; } if (model.is_red == 1) { cblItem.Items[1].Selected = true; } if (model.is_lock == 1) { cblItem.Items[2].Selected = true; } txtSortId.Text = model.sort_id.ToString(); txtClick.Text = model.click.ToString(); txtDiggGood.Text = model.digg_good.ToString(); txtDiggBad.Text = model.digg_bad.ToString(); txtContent.Value = model.content; txtSeoTitle.Text = model.seo_title; txtSeoKeywords.Text = model.seo_keywords; txtSeoDescription.Text = model.seo_description; //绑定附件 rptAttach.DataSource = model.download_attachs; rptAttach.DataBind(); }
protected int totalcount; //OUT数据总数 #endregion Fields #region Methods /// <summary> /// 查询数据 /// </summary> protected DataTable get_search_list(int _pagesize, out int _totalcount) { //创建一个DataTable DataTable dt = new DataTable(); dt.Columns.Add("id", Type.GetType("System.Int32")); dt.Columns.Add("title", Type.GetType("System.String")); dt.Columns.Add("remark", Type.GetType("System.String")); dt.Columns.Add("channel_id", Type.GetType("System.String")); dt.Columns.Add("link_url", Type.GetType("System.String")); dt.Columns.Add("add_time", Type.GetType("System.String")); dt.Columns.Add("img_url", Type.GetType("System.String")); //创建一个DataSet,判断是使用Tags还是关健字查询 DataSet ds = new BLL.article().GetSearch(channel, _pagesize, page, "(title like '%" + keyword + "%' or zhaiyao like '%" + keyword + "%')", "add_time desc,id desc", out _totalcount); if (ds.Tables[0].Rows.Count > 0) { for (int i = 0; i < ds.Tables[0].Rows.Count; i++) { DataRow dr1 = ds.Tables[0].Rows[i]; string link_url = get_url_rewrite(Utils.StrToInt(dr1["channel_id"].ToString(), 0), dr1["call_index"].ToString(), Utils.StrToInt(dr1["id"].ToString(), 0)); if (!string.IsNullOrEmpty(link_url)) { DataRow dr = dt.NewRow(); dr["id"] = dr1["id"]; //自增ID dr["title"] = dr1["title"]; //标题 dr["remark"] = dr1["zhaiyao"]; //摘要 dr["link_url"] = link_url; //链接地址 dr["add_time"] = dr1["add_time"]; //发布时间 dr["channel_id"] = dr1["channel_id"]; //频道ID dr["img_url"] = dr1["img_url"]; //发布时间 dt.Rows.Add(dr); } } } return dt; }
//保存排序 protected void btnSave_Click(object sender, EventArgs e) { BLL.article bll = new BLL.article(); Repeater rptList = new Repeater(); switch (this.prolistview) { case "Txt": rptList = this.rptList1; break; default: rptList = this.rptList2; break; } for (int i = 0; i < rptList.Items.Count; i++) { int id = Convert.ToInt32(((HiddenField)rptList.Items[i].FindControl("hidId")).Value); int sortId; if (!int.TryParse(((TextBox)rptList.Items[i].FindControl("txtSortId")).Text.Trim(), out sortId)) { sortId = 99; } bll.UpdateField(id, "sort_id=" + sortId.ToString()); } JscriptMsg("保存排序成功啦!", Utils.CombUrlTxt("list.aspx", "channel_id={0}&category_id={1}&keywords={2}&property={3}", this.channel_id.ToString(), this.category_id.ToString(), this.keywords, this.property), "Success"); }
private void RptBind(string _strWhere, string _orderby) { this.page = DTRequest.GetQueryInt("page", 1); if (this.category_id > 0) { this.ddlCategoryId.SelectedValue = this.category_id.ToString(); } this.ddlProperty.SelectedValue = this.property; this.txtKeywords.Text = this.keywords; //图表或列表显示 BLL.article bll = new BLL.article(); switch (this.prolistview) { case "Txt": this.rptList2.Visible = false; this.rptList1.DataSource = bll.GetGoodsList(this.pageSize, this.page, _strWhere, _orderby, out this.totalCount); this.rptList1.DataBind(); break; default: this.rptList1.Visible = false; this.rptList2.DataSource = bll.GetGoodsList(this.pageSize, this.page, _strWhere, _orderby, out this.totalCount); this.rptList2.DataBind(); break; } //绑定页码 txtPageNum.Text = this.pageSize.ToString(); string pageUrl = Utils.CombUrlTxt("list.aspx", "channel_id={0}&category_id={1}&keywords={2}&property={3}&page={4}", this.channel_id.ToString(), this.category_id.ToString(), this.keywords, this.property, "__id__"); PageContent.InnerHtml = Utils.OutPageList(this.pageSize, this.page, this.totalCount, pageUrl, 8); }
/// <summary> /// 重写虚方法,此方法将在Init事件前执行 /// </summary> protected override void ShowPage() { id = DTRequest.GetQueryInt("id", 0); BLL.article abll = new BLL.article(); if (id > 0) { model = abll.GetModel(id); if (model == null) { HttpContext.Current.Response.Redirect(linkurl("error", "?msg=" + Utils.UrlEncode("出错啦,您要浏览的页面不存在或已删除啦!"))); return; } else { abll.UpdateField(model.id, "click=click+1"); } } DataTable pre_dt = get_article_list("bangongfuwu", model.category_id, 1, "id<" + model.id, "sort_id asc"); if (pre_dt.Rows.Count > 0) { preid = int.Parse(pre_dt.Rows[0]["id"].ToString()); } DataTable next_dt = get_article_list("bangongfuwu", model.category_id, 1, "id>" + model.id, "sort_id asc"); if (next_dt.Rows.Count > 0) { nextid = int.Parse(next_dt.Rows[0]["id"].ToString()); } }
/// <summary> /// 获取扩展字段的值 /// </summary> /// <param name="article_id">内容ID</param> /// <param name="field_name">扩展字段名</param> /// <returns>String</returns> protected string get_article_field(int article_id, string field_name) { Model.article model = new BLL.article().GetModel(article_id); if (model != null && model.fields.ContainsKey(field_name)) { return model.fields[field_name]; } return string.Empty; }
/// <summary> /// 返回相应的图片 /// </summary> /// <param name="article_id">信息ID</param> /// <returns>String</returns> protected string get_article_img_url(int article_id) { Model.article model = new BLL.article().GetModel(article_id); if (model != null) { return model.img_url; } return ""; }
/// <summary> /// 文章列表 /// </summary> /// <param name="channel_name">频道名称</param> /// <param name="category_id">分类ID</param> /// <param name="top">显示条数</param> /// <param name="strwhere">查询条件</param> /// <returns>DataTable</returns> protected DataTable get_article_list(string channel_name, int category_id, int top, string strwhere) { DataTable dt = new DataTable(); if (!string.IsNullOrEmpty(channel_name)) { dt = new BLL.article().GetList(channel_name, category_id, top, strwhere, "sort_id asc,add_time desc").Tables[0]; } return dt; }
/// <summary> /// 文章列表 /// </summary> /// <param name="channel_name">频道名称</param> /// <param name="category_id">分类ID</param> /// <param name="top">显示条数</param> /// <param name="strwhere">查询条件</param> /// <param name="orderby">排序</param> /// <returns>DataTable</returns> protected DataTable get_article_list(string channel_name, int category_id, int top, string strwhere, string orderby) { DataTable dt = new DataTable(); if (!string.IsNullOrEmpty(channel_name)) { dt = new BLL.article().GetList(channel_name, category_id, top, strwhere, orderby).Tables[0]; } return dt; }
/// <summary> /// 返回相应的商品图片 /// </summary> /// <param name="goods_id">商品ID</param> /// <returns>String</returns> protected string get_goods_img_url(int goods_id) { Model.article_goods model = new BLL.article().GetGoodsModel(goods_id); if (model != null) { return model.img_url; } return ""; }
/// <summary> /// 重写虚方法,此方法将在Init事件前执行 /// </summary> protected override void ShowPage() { BLL.article bll = new BLL.article(); model = bll.GetModel("about"); if (model == null) { HttpContext.Current.Response.Redirect(linkurl("error", "?msg=" + Utils.UrlEncode("出错啦,您要浏览的页面不存在或已删除啦!"))); return; } }
private void ShowInfo(int _id) { BLL.article bll = new BLL.article(); Model.article_news model = bll.GetNewsModel(_id); ddlCategoryId.SelectedValue = model.category_id.ToString(); txtTitle.Text = model.title; txtAuthor.Text = model.author; txtFrom.Text = model.from; txtZhaiyao.Text = model.zhaiyao; txtLinkUrl.Text = model.link_url; if (model.is_msg == 1) { cblItem.Items[0].Selected = true; } if (model.is_top == 1) { cblItem.Items[1].Selected = true; } if (model.is_red == 1) { cblItem.Items[2].Selected = true; } if (model.is_hot == 1) { cblItem.Items[3].Selected = true; } if (model.is_slide == 1) { cblItem.Items[4].Selected = true; } if (model.is_lock == 1) { cblItem.Items[5].Selected = true; } txtSortId.Text = model.sort_id.ToString(); txtClick.Text = model.click.ToString(); //自定义图片才绑定 string filename = model.img_url.Substring(model.img_url.LastIndexOf("/") + 1); if (!filename.StartsWith("small_")) { txtImgUrl.Text = model.img_url; } txtDiggGood.Text = model.digg_good.ToString(); txtDiggBad.Text = model.digg_bad.ToString(); txtContent.Value = model.content; txtSeoTitle.Text = model.seo_title; txtSeoKeywords.Text = model.seo_keywords; txtSeoDescription.Text = model.seo_description; //赋值上传的相册 focus_photo.Value = model.img_url; //封面图片 LitAlbumList.Text = GetAlbumHtml(model.albums, model.img_url); //赋值属性列表 LitAttributeList.Text = GetAttributeHtml(model.attribute_values, this.channel_id, _id); }
/// <summary> /// 根据调用标识取得内容 /// </summary> /// <param name="call_index">调用别名</param> /// <returns>String</returns> protected string get_article_content(string call_index) { if (string.IsNullOrEmpty(call_index)) return string.Empty; BLL.article bll = new BLL.article(); if (bll.Exists(call_index)) { return bll.GetModel(call_index).content; } return string.Empty; }
/// <summary> /// 文章分页列表(自定义页面大小) /// </summary> /// <param name="channel_name">频道名称</param> /// <param name="category_id">分类ID</param> /// <param name="page_size">页面大小</param> /// <param name="page_index">当前页码</param> /// <param name="strwhere">查询条件</param> /// <param name="orderby">排序</param> /// <param name="totalcount">总记录数</param> /// <returns>DateTable</returns> 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 dt = new DataTable(); if (!string.IsNullOrEmpty(channel_name)) { dt = new BLL.article().GetList(channel_name, category_id, page_size, page_index, strwhere, orderby, out totalcount).Tables[0]; } else { totalcount = 0; } return dt; }
/// <summary> /// 获取扩展字段的值 /// </summary> /// <param name="call_index">调用别名</param> /// <param name="field_name">扩展字段名</param> /// <returns>String</returns> protected string get_article_field(string call_index, string field_name) { if (string.IsNullOrEmpty(call_index)) return string.Empty; BLL.article bll = new BLL.article(); if (!bll.Exists(call_index)) { return string.Empty; } Model.article model = bll.GetModel(call_index); if (model != null && model.fields.ContainsKey(field_name)) { return model.fields[field_name]; } return string.Empty; }
/// <summary> /// 文章分页列表 /// </summary> /// <param name="channel_name">频道名称</param> /// <param name="category_id">分类ID</param> /// <param name="page_index">当前页码</param> /// <param name="strwhere">查询条件</param> /// <param name="totalcount">总记录数</param> /// <param name="_key">URL配置名称</param> /// <param name="_params">传输参数</param> /// <returns>DataTable</returns> protected DataTable get_article_list(string channel_name, int category_id, int page_index, string strwhere, out int totalcount, out string pagelist, string _key, params object[] _params) { DataTable dt = new DataTable(); int pagesize; if (!string.IsNullOrEmpty(channel_name)) { dt = new BLL.article().GetList(channel_name, category_id, page_index, strwhere, "sort_id asc,add_time desc", out totalcount, out pagesize).Tables[0]; pagelist = Utils.OutPageList(pagesize, page_index, totalcount, linkurl(_key, _params), 8); } else { totalcount = 0; pagelist = ""; } return dt; }
/// <summary> /// 获取上一条下一条的链接 /// </summary> /// <param name="urlkey">urlkey</param> /// <param name="type">-1代表上一条,1代表下一条</param> /// <param name="defaultvalue">默认文本</param> /// <param name="callIndex">是否使用别名,0使用ID,1使用别名</param> /// <returns>A链接</returns> protected string get_prevandnext_article(string urlkey, int type, string defaultvalue, int callIndex) { string symbol = (type == -1 ? "<" : ">"); BLL.article bll = new BLL.article(); string str = string.Empty; str = " and category_id=" + model.category_id; DataSet ds = bll.GetList(1, "channel_id=" + model.channel_id + " " + str + " and status=0 and Id" + symbol + id, "id desc"); if (ds == null || ds.Tables[0].Rows.Count <= 0) { return defaultvalue; } if (callIndex == 1 && !string.IsNullOrEmpty(ds.Tables[0].Rows[0]["call_index"].ToString())) { return "<a href=\"" + linkurl(urlkey, ds.Tables[0].Rows[0]["call_index"].ToString()) + "\">" + ds.Tables[0].Rows[0]["title"] + "</a>"; } return "<a href=\"" + linkurl(urlkey, ds.Tables[0].Rows[0]["id"].ToString()) + "\">" + ds.Tables[0].Rows[0]["title"] + "</a>"; }
/// <summary> /// 获得购物车列表 /// </summary> public static IList<Model.cart_items> GetList(int group_id) { IDictionary<string, int> dic = GetCart(); if (dic != null) { IList<Model.cart_items> iList = new List<Model.cart_items>(); foreach (var item in dic) { BLL.article bll = new BLL.article(); Model.article model = bll.GetModel(Convert.ToInt32(item.Key)); if (model == null || !model.fields.ContainsKey("sell_price")) { continue; } Model.cart_items modelt = new Model.cart_items(); modelt.id = model.id; modelt.title = model.title; modelt.img_url = model.img_url; if (model.fields.ContainsKey("point")) { modelt.point = Utils.StrToInt(model.fields["point"], 0); } modelt.price = Utils.StrToDecimal(model.fields["sell_price"], 0); modelt.user_price = Utils.StrToDecimal(model.fields["sell_price"], 0); if (model.fields.ContainsKey("stock_quantity")) { modelt.stock_quantity = Utils.StrToInt(model.fields["stock_quantity"], 0); } //会员价格 if (model.group_price != null) { Model.user_group_price gmodel = model.group_price.Find(p => p.group_id == group_id); if (gmodel != null) { modelt.user_price = gmodel.price; } } modelt.quantity = item.Value; iList.Add(modelt); } return iList; } return null; }
/// <summary> /// 内容列表 /// </summary> /// <param name="channel_id">频道ID</param> /// <param name="top">显示条数</param> /// <param name="strwhere">查询条件</param> /// <returns>DataTable</returns> protected DataTable get_content_list(int channel_id, int category_id, int top, string strwhere) { DataTable dt = new DataTable(); if (channel_id > 0) { string _where = "channel_id=" + channel_id; if (category_id > 0) { _where += " and category_id in(select id from dt_category where channel_id=" + channel_id + " and class_list like '%," + category_id + ",%')"; } if (!string.IsNullOrEmpty(strwhere)) { _where += " and " + strwhere; } dt = new BLL.article().GetContentList(top, _where, "sort_id asc,add_time desc").Tables[0]; } return dt; }
/// <summary> /// 商品列表 /// </summary> /// <param name="channel_id">频道ID</param> /// <param name="top">显示条数</param> /// <param name="strwhere">查询条件</param> /// <returns>DataTable</returns> protected DataTable get_goods_list(int channel_id, int category_id, int top, string strwhere, string orderby) { DataTable dt = new DataTable(); if (channel_id > 0) { string _where = "channel_id=" + channel_id; if (category_id > 0) { _where += " and category_id in(select id from dt_category where channel_id=" + channel_id + " and class_list like '%," + category_id + ",%')"; } if (!string.IsNullOrEmpty(strwhere)) { _where += " and " + strwhere; } dt = new BLL.article().GetGoodsList(top, _where, orderby).Tables[0]; } return dt; }
private void RptBind(string _strWhere, string _orderby) { this.page = DTRequest.GetQueryInt("page", 1); if (this.category_id > 0) { this.ddlCategoryId.SelectedValue = this.category_id.ToString(); } this.ddlProperty.SelectedValue = this.property; this.txtKeywords.Text = this.keywords; BLL.article bll = new BLL.article(); this.rptList.DataSource = bll.GetDownloadList(this.pageSize, this.page, _strWhere, _orderby, out this.totalCount); this.rptList.DataBind(); //绑定页码 txtPageNum.Text = this.pageSize.ToString(); string pageUrl = Utils.CombUrlTxt("list.aspx", "channel_id={0}&category_id={1}&keywords={2}&property={3}&page={4}", this.channel_id.ToString(), this.category_id.ToString(), this.keywords, this.property, "__id__"); PageContent.InnerHtml = Utils.OutPageList(this.pageSize, this.page, this.totalCount, pageUrl, 8); }
/// <summary> /// 重写虚方法,此方法将在Init事件前执行 /// </summary> protected override void ShowPage() { id = DTRequest.GetQueryInt("id"); BLL.article bll = new BLL.article(); if (!bll.Exists(id)) { HttpContext.Current.Response.Redirect(config.webpath + "error.aspx?msg=" + Utils.UrlEncode("出错啦,您要浏览的页面不存在或已删除啦!")); return; } model = bll.GetGoodsModel(id); //浏览数+1 bll.UpdateField(id, "click=click+1"); //跳转URL if (model.link_url != null) model.link_url = model.link_url.Trim(); if (!string.IsNullOrEmpty(model.link_url)) { HttpContext.Current.Response.Redirect(model.link_url); } }
/// <summary> /// 返回订单商品列表 /// </summary> /// <param name="order_id">订单</param> /// <returns>List</returns> protected List<Model.article> get_order_goods_list(int order_id) { Model.orders model = new BLL.orders().GetModel(order_id); if (model == null) { return null; } List<Model.article> ls = new List<Model.article>(); if (model.order_goods != null) { foreach (Model.order_goods modelt in model.order_goods) { Model.article goodsModel = new BLL.article().GetModel(modelt.goods_id); if (goodsModel != null) { ls.Add(goodsModel); } } } return ls; }
/// <summary> /// 重写虚方法,此方法将在Init事件前执行 /// </summary> protected override void ShowPage() { help_id = DTRequest.GetQueryInt("help_id"); BLL.article bll = new BLL.article(); model = bll.GetModel("about"); if (model == null) { HttpContext.Current.Response.Redirect(linkurl("error", "?msg=" + Utils.UrlEncode("出错啦,您要浏览的页面不存在或已删除啦!"))); return; } if (help_id > 0) { model_bk = bll.GetModel(help_id); if (model_bk == null) { HttpContext.Current.Response.Redirect(linkurl("error", "?msg=" + Utils.UrlEncode("出错啦,您要浏览的页面不存在或已删除啦!"))); return; } } }
//保存排序 protected void btnSave_Click(object sender, EventArgs e) { ChkAdminLevel("channel_" + this.channel_name + "_list", MXEnums.ActionEnum.Edit.ToString()); //检查权限 BLL.article bll = new BLL.article(); Repeater rptList = new Repeater(); rptList = this.rptList1; for (int i = 0; i < rptList.Items.Count; i++) { int id = Convert.ToInt32(((HiddenField)rptList.Items[i].FindControl("hidId")).Value); int sortId; if (!int.TryParse(((TextBox)rptList.Items[i].FindControl("txtSortId")).Text.Trim(), out sortId)) { sortId = 99; } bll.UpdateField(id, "sort_id=" + sortId.ToString()); } AddAdminLog(MXEnums.ActionEnum.Edit.ToString(), "保存" + this.channel_name + "频道内容排序"); //记录日志 JscriptMsg("保存排序成功啦!", Utils.CombUrlTxt("article_page_list.aspx", "channel_id={0}&category_id={1}&keywords={2}&property={3}", this.channel_id.ToString(), this.category_id.ToString(), this.keywords, this.property), "Success"); }
private void RepNewsRed(int category_id) { BLL.article bll = new BLL.article(); //RepListRed.DataSource = bll.GetList("news", category_id, 5, "status=0", "sort_id asc,id desc"); //RepListRed.DataBind(); }
private void ShowInfo(int _id) { BLL.article bll = new BLL.article(); Model.article model = bll.GetModel(_id); ddlCategoryId.SelectedValue = model.category_id.ToString(); txtCallIndex.Text = model.call_index; txtTitle.Text = model.title; txtLinkUrl.Text = model.link_url; //不是相册图片就绑定 string filename = model.img_url.Substring(model.img_url.LastIndexOf("/") + 1); if (!filename.StartsWith("thumb_")) { txtImgUrl.Text = model.img_url; } txtSeoTitle.Text = model.seo_title; txtSeoKeywords.Text = model.seo_keywords; txtSeoDescription.Text = model.seo_description; txtZhaiyao.Text = model.zhaiyao; txtContent.Value = model.content; txtSortId.Text = model.sort_id.ToString(); txtClick.Text = model.click.ToString(); rblStatus.SelectedValue = model.status.ToString(); if (action == DTEnums.ActionEnum.Edit.ToString()) { txtAddTime.Text = model.add_time.ToString("yyyy-MM-dd HH:mm:ss"); } if (model.is_msg == 1) { cblItem.Items[0].Selected = true; } if (model.is_top == 1) { cblItem.Items[1].Selected = true; } if (model.is_red == 1) { cblItem.Items[2].Selected = true; } if (model.is_hot == 1) { cblItem.Items[3].Selected = true; } if (model.is_slide == 1) { cblItem.Items[4].Selected = true; } //扩展字段赋值 List <Model.article_attribute_field> ls1 = new BLL.article_attribute_field().GetModelList(this.channel_id, ""); foreach (Model.article_attribute_field modelt1 in ls1) { switch (modelt1.control_type) { case "single-text": //单行文本 TextBox txtControl = FindControl("field_control_" + modelt1.name) as TextBox; if (txtControl != null && model.fields.ContainsKey(modelt1.name)) { if (modelt1.is_password == 1) { txtControl.Attributes.Add("value", model.fields[modelt1.name]); } else { txtControl.Text = model.fields[modelt1.name]; } } break; case "multi-text": //多行文本 goto case "single-text"; case "editor": //编辑器 HtmlTextArea txtAreaControl = FindControl("field_control_" + modelt1.name) as HtmlTextArea; if (txtAreaControl != null && model.fields.ContainsKey(modelt1.name)) { txtAreaControl.Value = model.fields[modelt1.name]; } break; case "images": //图片上传 goto case "single-text"; case "video": //视频上传 goto case "single-text"; case "number": //数字 goto case "single-text"; case "datetime": //时间日期 goto case "single-text"; case "checkbox": //复选框 CheckBox cbControl = FindControl("field_control_" + modelt1.name) as CheckBox; if (cbControl != null && model.fields.ContainsKey(modelt1.name)) { if (model.fields[modelt1.name] == "1") { cbControl.Checked = true; } else { cbControl.Checked = false; } } break; case "multi-radio": //多项单选 RadioButtonList rblControl = FindControl("field_control_" + modelt1.name) as RadioButtonList; if (rblControl != null && model.fields.ContainsKey(modelt1.name)) { rblControl.SelectedValue = model.fields[modelt1.name]; } break; case "multi-checkbox": //多项多选 CheckBoxList cblControl = FindControl("field_control_" + modelt1.name) as CheckBoxList; if (cblControl != null && model.fields.ContainsKey(modelt1.name)) { string[] valArr = model.fields[modelt1.name].Split(','); for (int i = 0; i < cblControl.Items.Count; i++) { cblControl.Items[i].Selected = false; //先取消默认的选中 foreach (string str in valArr) { if (cblControl.Items[i].Value == str) { cblControl.Items[i].Selected = true; } } } } break; } } //绑定图片相册 if (filename.StartsWith("thumb_")) { hidFocusPhoto.Value = model.img_url; //封面图片 } rptAlbumList.DataSource = model.albums; rptAlbumList.DataBind(); //绑定内容附件 rptAttachList.DataSource = model.attach; rptAttachList.DataBind(); //赋值用户组价格 if (model.group_price != null) { for (int i = 0; i < this.rptPrice.Items.Count; i++) { int hideId = Convert.ToInt32(((HiddenField)this.rptPrice.Items[i].FindControl("hideGroupId")).Value); foreach (Model.user_group_price modelt in model.group_price) { if (hideId == modelt.group_id) { ((HiddenField)this.rptPrice.Items[i].FindControl("hidePriceId")).Value = modelt.id.ToString(); ((TextBox)this.rptPrice.Items[i].FindControl("txtGroupPrice")).Text = modelt.price.ToString(); } } } } }
private bool DoEdit(int _id) { bool result = true; BLL.article bll = new BLL.article(); Model.article_goods model = bll.GetGoodsModel(_id); model.channel_id = this.channel_id; model.title = txtTitle.Text.Trim(); model.category_id = Utils.StringToNum(ddlCategoryId.SelectedValue); //model.goods_no = txtGoodsNo.Text; //model.stock_quantity = Utils.StringToNum(txtStockQuantity.Text); //model.market_price = decimal.Parse(txtMarketPrice.Text); //model.sell_price = decimal.Parse(txtSellPrice.Text); //model.point = Utils.StringToNum(txtPoint.Text); //model.link_url = txtLinkUrl.Text.Trim(); model.img_url = focus_photo.Value; model.content = txtContent.Value; model.seo_title = txtSeoTitle.Text.Trim(); model.seo_keywords = txtSeoKeywords.Text.Trim(); model.seo_description = txtSeoDescription.Text.Trim(); //model.sort_id = Utils.StringToNum(txtSortId.Text.Trim()); //model.click = Utils.StringToNum(txtClick.Text.Trim()); //model.digg_good = Utils.StringToNum(txtDiggGood.Text.Trim()); //model.digg_bad = Utils.StringToNum(txtDiggBad.Text.Trim()); model.add_time = DateTime.Parse(txtTime.Text.ToString()); model.is_msg = 0; model.is_top = 0; model.is_red = 0; model.is_hot = 0; model.is_slide = 0; model.is_lock = 0; model.lianxiren = txtuser.Text; //model.shangpinType = txtshangpintype.Text; //if (cblItem.Items[0].Selected == true) //{ // model.is_msg = 1; //} //if (cblItem.Items[1].Selected == true) //{ // model.is_top = 1; //} //if (cblItem.Items[2].Selected == true) //{ // model.is_red = 1; //} //if (cblItem.Items[3].Selected == true) //{ // model.is_hot = 1; //} //if (cblItem.Items[4].Selected == true) //{ // model.is_slide = 1; //} //if (cblItem.Items[5].Selected == true) //{ // model.is_lock = 1; //} //用戶組價格 List <Model.goods_group_price> priceList = new List <Model.goods_group_price>(); //for (int i = 0; i < rptPrice.Items.Count; i++) //{ // int hidPriceId = 0; // if (!string.IsNullOrEmpty(((HiddenField)rptPrice.Items[i].FindControl("hidePriceId")).Value)) // { // hidPriceId = Convert.ToInt32(((HiddenField)rptPrice.Items[i].FindControl("hidePriceId")).Value); // } // int hidGroupId = Convert.ToInt32(((HiddenField)rptPrice.Items[i].FindControl("hideGroupId")).Value); // decimal _price = Convert.ToDecimal(((TextBox)rptPrice.Items[i].FindControl("txtGroupPrice")).Text.Trim()); // priceList.Add(new Model.goods_group_price { id = hidPriceId, article_id = _id, group_id = hidGroupId, price = _price }); //} model.goods_group_prices = priceList; //儲存相冊 if (model.albums != null) { model.albums.Clear(); } string[] albumArr = Request.Form.GetValues("hide_photo_name"); string[] remarkArr = Request.Form.GetValues("hide_photo_remark"); if (albumArr != null) { List <Model.article_albums> ls = new List <Model.article_albums>(); for (int i = 0; i < albumArr.Length; i++) { string[] imgArr = albumArr[i].Split('|'); int img_id = Utils.StringToNum(imgArr[0]); if (imgArr.Length == 3) { if (!string.IsNullOrEmpty(remarkArr[i])) { ls.Add(new Model.article_albums { id = img_id, article_id = _id, big_img = imgArr[1], small_img = imgArr[2], remark = remarkArr[i] }); } else { ls.Add(new Model.article_albums { id = img_id, article_id = _id, big_img = imgArr[1], small_img = imgArr[2] }); } } } model.albums = ls; } //擴展屬性 BLL.attributes bll2 = new BLL.attributes(); DataSet ds2 = bll2.GetList("channel_id=" + this.channel_id); List <Model.attribute_value> attrls = new List <Model.attribute_value>(); foreach (DataRow dr in ds2.Tables[0].Rows) { int attr_id = Utils.StringToNum(dr["id"].ToString()); string attr_title = dr["title"].ToString(); string attr_value_id = Request.Form["value_" + attr_id]; string attr_value_content = Request.Form["content_" + attr_id]; if (!string.IsNullOrEmpty(attr_value_id) && !string.IsNullOrEmpty(attr_value_content)) { attrls.Add(new Model.attribute_value { id = Convert.ToInt32(attr_value_id), article_id = _id, attribute_id = attr_id, title = attr_title, content = attr_value_content }); } } model.attribute_values = attrls; //model.Postid = CheckBoxList1.SelectedValue; model.Type = Utils.StringToNum(cblItem.SelectedValue); //if (!string.IsNullOrEmpty(ddlquyu.SelectedValue)) //{ // model.quyu = Convert.ToInt32(ddlquyu.SelectedValue); //} //if (!string.IsNullOrEmpty(ddljiaqian.SelectedValue)) //{ // model.jiaqianQJ = Convert.ToInt32(ddljiaqian.SelectedValue); //} //if (!string.IsNullOrEmpty(ddlmianji.SelectedValue)) //{ // model.mianji = Convert.ToInt32(ddlmianji.SelectedValue); //} //if (!string.IsNullOrEmpty(ddlhuxing.SelectedValue)) //{ // model.huxing = Convert.ToInt32(ddlhuxing.SelectedValue); //} //if (!string.IsNullOrEmpty(ddlfangshi.SelectedValue)) //{ // model.fangshi = Convert.ToInt32(ddlfangshi.SelectedValue); //} //if (!string.IsNullOrEmpty(ddlditie.SelectedValue)) //{ // model.xianlu = Convert.ToInt32(ddlditie.SelectedValue); //} //model.yajin = string.IsNullOrEmpty(txtyajin.Text) ? 0 : Convert.ToInt32(txtyajin.Text); //model.zuoxiang = txtzuoxiang.Text; //model.louceng = txtlouceng.Text; //model.xingneng = txtxingneng.Text; //model.yongtu = txtyongtu.Text; //model.chewei = txtchewei.Text; model.shequ = txtTeChang.Text; model.dizhi = txtdizhi.Text; model.gongsi = txtgongsi.Text; model.fuwuxiangju = txtfuwxiangmu.Text; model.dianhua = txtdianhua.Text; model.Areaid = Convert.ToInt32(ddlAreaid.SelectedValue); model.Status = xiajiacheck.Checked == true ? 0 : 1; model.xiajialiyou = xiajiatext.Value; if (!bll.Update(model)) { result = false; } return(result); }
protected Model.article get_article(int id) { Model.article model = new BLL.article().GetModel(id); return(model); }
/// <summary> /// 獲得購物車列表 /// </summary> public static IList <Model.cart_items> GetList(int group_id) { BLL.goods bllgoods = new BLL.goods(); BLL.article bll = new BLL.article(); BLL.user_group_price bll_group = new BLL.user_group_price(); Tea.Model.users _users = new Tea.Web.UI.UserPage().GetUserInfo(); IDictionary <string, int> dic = GetCart(); if (dic != null) { int hong = 0, lv = 0; IList <Model.cart_items> i_List = new List <Model.cart_items>(); string[] CartKey = new string[2]; foreach (var item in dic) { CartKey = item.Key.Split('_'); Model.cart_items modelt = new Model.cart_items(); if (CartKey.Length > 1) { Model.article model = bll.GetModel(Convert.ToInt32(CartKey[0])); Model.goods modelgoods = bllgoods.GetModel(Convert.ToInt32(CartKey[1])); if (model == null || modelgoods == null) { continue; } if (model.status != 0) { continue; } if (model.add_time > System.DateTime.Now || modelgoods.stock_quantity < 1) { continue; } if (model.xia_date != null && model.xia_date.Value.AddDays(1) < System.DateTime.Now) { continue; } modelt.ps = model.call_index; modelt.id = model.id; modelt.key = item.Key; modelt.title = model.title; modelt.sub_title = model.sub_title; modelt.img_url = model.img_url; modelt.goods_color = modelgoods.color; modelt.goods_size = modelgoods.size; modelt.zhong = modelgoods.zhong; modelt.chang = modelgoods.chang; modelt.kuan = modelgoods.kuan; modelt.gao = modelgoods.gao; modelt.point = model.point; modelt.price = modelgoods.market_price; modelt.user_price = modelgoods.sell_price; if (modelgoods.yu_lock > 0) { Tea.Model.sales models = new Tea.BLL.sales().GetModel(modelgoods.yu_lock); if (models != null && models.type == "2" && models.status == 1 && models.start_time < System.DateTime.Now && (models.end_time == null || models.end_time > System.DateTime.Now)) { modelt.user_price = modelgoods.yu_num; } } modelt.goodsid = modelgoods.id; modelt.goods_code = modelgoods.goods_no; modelt.stock_quantity = modelgoods.stock_quantity; modelt.quantity = item.Value; modelt.sales_id = modelgoods.yu_lock; modelt.by = model.wheresql; modelt.hdcode = model.guige; if (model.is_msg == 0) { modelt.sales_name = "no"; } modelt.psmoney = model.brand_id.ToString(); if (group_id > 0) { if (model.brand_id == 1) { if (_users != null && _users.group_id == 2) { Model.user_group_price userPriceModel = bll_group.GetModel(modelt.goodsid, _users.id); if (userPriceModel != null) { modelt.user_price = userPriceModel.price; } } } i_List.Add(modelt); } else { if (model.brand_id == 1 && group_id == -3) { if (_users != null && _users.group_id == 2) { Model.user_group_price userPriceModel = bll_group.GetModel(modelt.goodsid, _users.id); if (userPriceModel != null) { modelt.user_price = userPriceModel.price; modelt.by = "vip"; i_List.Add(modelt); } } } if (model.brand_id == 3 && group_id == -2) { i_List.Add(modelt); } if (model.brand_id != 3 && group_id == -1 && model.wheresql != "jiajia") { if (_users.group_id == 1) { i_List.Add(modelt); } else { Model.user_group_price userPriceModel = bll_group.GetModel(modelt.goodsid, _users.id); if (userPriceModel == null) { i_List.Add(modelt); } } } try { if (model.wheresql == "jiajia" && group_id == -1 && Convert.ToInt32(CartKey[2]) == 1) { i_List.Add(modelt); } if (model.wheresql == "jiajia" && group_id == -2 && Convert.ToInt32(CartKey[2]) == 2) { i_List.Add(modelt); } if (model.wheresql == "jiajia" && group_id == -3 && Convert.ToInt32(CartKey[2]) == 3) { i_List.Add(modelt); } } catch (Exception eee) { } } } } return(i_List); } return(null); }
private bool DoEdit(int _id) { bool result = true; BLL.article bll = new BLL.article(); Model.article_news model = bll.GetNewsModel(_id); model.channel_id = this.channel_id; model.title = txtTitle.Text.Trim(); model.category_id = int.Parse(ddlCategoryId.SelectedValue); model.author = txtAuthor.Text.Trim(); model.from = txtFrom.Text.Trim(); model.zhaiyao = Utils.DropHTML(txtZhaiyao.Text, 250); model.link_url = txtLinkUrl.Text.Trim(); //检查是否有自定义图片 if (txtImgUrl.Text.Trim() != "") { model.img_url = txtImgUrl.Text; } else { model.img_url = focus_photo.Value; } model.content = txtContent.Value; model.seo_title = txtSeoTitle.Text.Trim(); model.seo_keywords = txtSeoKeywords.Text.Trim(); model.seo_description = txtSeoDescription.Text.Trim(); model.sort_id = int.Parse(txtSortId.Text.Trim()); model.click = int.Parse(txtClick.Text.Trim()); model.digg_good = int.Parse(txtDiggGood.Text.Trim()); model.digg_bad = int.Parse(txtDiggBad.Text.Trim()); model.is_msg = 0; model.is_top = 0; model.is_red = 0; model.is_hot = 0; model.is_slide = 0; model.is_lock = 0; if (cblItem.Items[0].Selected == true) { model.is_msg = 1; } if (cblItem.Items[1].Selected == true) { model.is_top = 1; } if (cblItem.Items[2].Selected == true) { model.is_red = 1; } if (cblItem.Items[3].Selected == true) { model.is_hot = 1; } if (cblItem.Items[4].Selected == true) { model.is_slide = 1; } if (cblItem.Items[5].Selected == true) { model.is_lock = 1; } //保存相册 if (model.albums != null) { model.albums.Clear(); } string[] albumArr = Request.Form.GetValues("hide_photo_name"); string[] remarkArr = Request.Form.GetValues("hide_photo_remark"); if (albumArr != null) { List <Model.article_albums> ls = new List <Model.article_albums>(); for (int i = 0; i < albumArr.Length; i++) { string[] imgArr = albumArr[i].Split('|'); int img_id = int.Parse(imgArr[0]); if (imgArr.Length == 3) { if (!string.IsNullOrEmpty(remarkArr[i])) { ls.Add(new Model.article_albums { id = img_id, article_id = _id, big_img = imgArr[1], small_img = imgArr[2], remark = remarkArr[i] }); } else { ls.Add(new Model.article_albums { id = img_id, article_id = _id, big_img = imgArr[1], small_img = imgArr[2] }); } } } model.albums = ls; } //扩展属性 BLL.attributes bll2 = new BLL.attributes(); DataSet ds2 = bll2.GetList("channel_id=" + this.channel_id); List <Model.attribute_value> attrls = new List <Model.attribute_value>(); foreach (DataRow dr in ds2.Tables[0].Rows) { int attr_id = int.Parse(dr["id"].ToString()); string attr_title = dr["title"].ToString(); string attr_value_id = Request.Form["value_" + attr_id]; string attr_value_content = Request.Form["content_" + attr_id]; if (!string.IsNullOrEmpty(attr_value_id) && !string.IsNullOrEmpty(attr_value_content)) { attrls.Add(new Model.attribute_value { id = Convert.ToInt32(attr_value_id), article_id = _id, attribute_id = attr_id, title = attr_title, content = attr_value_content }); } } model.attribute_values = attrls; if (!bll.Update(model)) { result = false; } return(result); }
//設置操作 protected void rptList_ItemCommand(object source, RepeaterCommandEventArgs e) { ChkAdminLevel(channel_id, DTEnums.ActionEnum.Edit.ToString()); //檢查許可權 int id = Convert.ToInt32(((HiddenField)e.Item.FindControl("hidId")).Value); BLL.article bll = new BLL.article(); Model.article_goods model = bll.GetGoodsModel(id); switch (e.CommandName.ToLower()) { case "ibtnmsg": if (model.is_msg == 1) { bll.UpdateGoodsField(id, "is_msg=0"); } else { bll.UpdateGoodsField(id, "is_msg=1"); } break; case "ibtntop": if (model.is_top == 1) { bll.UpdateGoodsField(id, "is_top=0"); } else { bll.UpdateGoodsField(id, "is_top=1"); } break; case "ibtnred": if (model.is_red == 1) { bll.UpdateGoodsField(id, "is_red=0"); } else { bll.UpdateGoodsField(id, "is_red=1"); } break; case "ibtnhot": if (model.is_hot == 1) { bll.UpdateGoodsField(id, "is_hot=0"); } else { bll.UpdateGoodsField(id, "is_hot=1"); } break; case "ibtnslide": if (model.is_slide == 1) { bll.UpdateGoodsField(id, "is_slide=0"); } else { bll.UpdateGoodsField(id, "is_slide=1"); } break; case "sk": bll.UpdateField(id, "Status=1"); break; } this.RptBind("id>0" + CombSqlTxt(this.channel_id, this.category_id, this.keywords, this.property), "sort_id asc,add_time desc"); }
private bool DoEdit(int _id) { bool result = false; BLL.article bll = new BLL.article(); Model.article model = bll.GetModel(_id); model.channel_id = this.channel_id; model.category_id = Utils.StrToInt(ddlCategoryId.SelectedValue, 0); model.brand_id = Utils.StrToInt(ddlType.SelectedValue, 0); model.call_index = txtCallIndex.Text.Trim(); model.title = txtTitle.Text.Trim(); model.link_url = txtLinkUrl.Text.Trim(); model.img_url = txtImgUrl.Text; model.seo_title = txtSeoTitle.Text.Trim(); model.seo_keywords = txtSeoKeywords.Text.Trim(); model.seo_description = txtSeoDescription.Text.Trim(); //內容摘要提取內容前255個字元 if (string.IsNullOrEmpty(txtZhaiyao.Text.Trim())) { model.zhaiyao = Utils.DropHTML(txtContent.Value, 255); } else { model.zhaiyao = Utils.DropHTML(txtZhaiyao.Text, 255); } model.content = txtContent.Value; model.sort_id = Utils.StrToInt(txtSortId.Text.Trim(), 99); model.click = int.Parse(txtClick.Text.Trim()); model.status = Utils.StrToInt(rblStatus.SelectedValue, 0); model.is_tui = 0; model.is_zhe = 0; if (cblItem.Items[0].Selected == true) { model.is_tui = 1; } if (cblItem.Items[1].Selected == true) { model.is_zhe = 1; } model.add_time = Utils.StrToDateTime(txtAddTime.Text.Trim()); model.begin_time = Utils.StrToDateTime(txtBeginTime.Text.Trim()); model.end_time = Utils.StrToDateTime(txtEndTime.Text.Trim()); DateTime _end_time; if (DateTime.TryParse(txtUpdate.Text.Trim(), out _end_time)) { model.update_time = _end_time; } DateTime __end_time; if (DateTime.TryParse(txt_Xia_Date.Text.Trim(), out __end_time)) { model.xia_date = __end_time; } if (cbIsLock.Checked) { model.is_msg = 1; } else { model.is_msg = 0; } //分表 model.sell_price = Utils.StrToDecimal(txtSell_price.Text, 0); model.market_price = Utils.StrToDecimal(txtMarket_price.Text, 0); model.point = Utils.StrToInt(txtPoint.Text, 0); model.goods_no = txtGoods_no.Text; model.guige = txtGuige.Text; model.sub_title = txtSub_title.Text; model.guigemore = txtGuigeMore.Value; model.shuoming = txtShuo.Value; System.Text.StringBuilder sb = new StringBuilder(); sb.Append(','); foreach (ListItem li in cbMore.Items) { if (li.Selected) { sb.AppendFormat("{0},", li.Value); } } model.more_type = sb.ToString(); model.tags = txtTag.Text + "$" + txtTag1.Text + "$" + txtTag2.Text; #region 儲存相冊==================== //檢查是否有自訂圖片 if (txtImgUrl.Text.Trim() == "") { model.img_url = hidFocusPhoto.Value; } if (model.albums != null) { model.albums.Clear(); } string[] albumArr = Request.Form.GetValues("hid_photo_name"); string[] remarkArr = Request.Form.GetValues("hid_photo_remark"); if (albumArr != null) { List <Model.article_albums> ls = new List <Model.article_albums>(); for (int i = 0; i < albumArr.Length; i++) { string[] imgArr = albumArr[i].Split('|'); int img_id = Utils.StrToInt(imgArr[0], 0); if (imgArr.Length == 3) { if (!string.IsNullOrEmpty(remarkArr[i])) { ls.Add(new Model.article_albums { id = img_id, article_id = _id, original_path = imgArr[1], thumb_path = imgArr[2], remark = remarkArr[i] }); } else { ls.Add(new Model.article_albums { id = img_id, article_id = _id, original_path = imgArr[1], thumb_path = imgArr[2] }); } } } model.albums = ls; } #endregion //#region 儲存會員組價格============== //List<Model.user_group_price> priceList = new List<Model.user_group_price>(); //for (int i = 0; i < rptPrice.Items.Count; i++) //{ // int hidPriceId = 0; // if (!string.IsNullOrEmpty(((HiddenField)rptPrice.Items[i].FindControl("hidePriceId")).Value)) // { // hidPriceId = Convert.ToInt32(((HiddenField)rptPrice.Items[i].FindControl("hidePriceId")).Value); // } // int hidGroupId = Convert.ToInt32(((HiddenField)rptPrice.Items[i].FindControl("hideGroupId")).Value); // decimal _price = Convert.ToDecimal(((TextBox)rptPrice.Items[i].FindControl("txtGroupPrice")).Text.Trim()); // priceList.Add(new Model.user_group_price { id = hidPriceId, article_id = _id, group_id = hidGroupId, price = _price }); //} //model.group_price = priceList; //#endregion Model.goods modelgoods = new BLL.goods().GetModel(model.team_id); modelgoods.goods_no = model.goods_no; modelgoods.img_url = model.img_url; modelgoods.market_price = model.market_price; modelgoods.sell_price = model.sell_price; modelgoods.guige = txtGuige.Text; modelgoods.stock_quantity = Utils.StrToInt(txtStock_quantity.Text, 0); modelgoods.chang = Utils.StrToDecimal(txtChang.Text, 0); modelgoods.kuan = Utils.StrToDecimal(txtKuan.Text, 0); modelgoods.gao = Utils.StrToDecimal(txtGao.Text, 0); modelgoods.zhong = Utils.StrToDecimal(txtZhong.Text, 0); new BLL.goods().Update(modelgoods); #region 保存组合商品============== BLL.goods_group bll_good_group = new BLL.goods_group(); StringBuilder idList = new StringBuilder(); string[] goodsGroupIdArr = Request.Form.GetValues("goods_group_id"); string[] parentIdArr = Request.Form.GetValues("parent_id"); string[] goodsIdArr = Request.Form.GetValues("goods_id"); string[] goodsTitleArr = Request.Form.GetValues("goods_group_title"); string[] goodsColorArr = Request.Form.GetValues("goods_group_color"); string[] originalPriceArr = Request.Form.GetValues("original_price"); string[] newPriceArr = Request.Form.GetValues("new_price"); if (goodsGroupIdArr != null && parentIdArr != null && goodsIdArr != null && goodsTitleArr != null && goodsColorArr != null && originalPriceArr != null && newPriceArr != null && goodsGroupIdArr.Length > 0 && parentIdArr.Length > 0 && goodsIdArr.Length > 0 && goodsTitleArr.Length > 0 && goodsColorArr.Length > 0 && originalPriceArr.Length > 0 && newPriceArr.Length > 0) { for (int i = 0; i < goodsGroupIdArr.Length; i++) { int groupGoodsId = Utils.StrToInt(goodsGroupIdArr[i], 0); int parentId = Utils.StrToInt(parentIdArr[i], 0); int goodsId = Utils.StrToInt(goodsIdArr[i], 0); Decimal originalPrice = Utils.StrToDecimal(originalPriceArr[i], 0); Decimal newPrice = Utils.StrToDecimal(newPriceArr[i], 0); Model.goods_group model_goods_group = null; bool update = true; if (groupGoodsId == 0) { model_goods_group = new Model.goods_group(); update = false; } else { model_goods_group = bll_good_group.GetModel(groupGoodsId); } model_goods_group.goods_id = goodsId; model_goods_group.parent_id = parentId; model_goods_group.title = goodsTitleArr[i]; model_goods_group.color = goodsColorArr[i]; model_goods_group.new_price = newPrice; model_goods_group.original_price = originalPrice; model_goods_group.main_id = model.id; if (update) { bll_good_group.Update(model_goods_group); idList.Append(model_goods_group.id + ","); } else { int a = bll_good_group.Add(model_goods_group); idList.Append(a + ","); } } } string id_list = Utils.DelLastChar(idList.ToString(), ","); if (string.IsNullOrEmpty(id_list)) { id_list = "0"; } if (!string.IsNullOrEmpty(id_list)) { Tea.DBUtility.DbHelperSQL.ExecuteSql("delete from shop_goods_group where main_id=" + model.id + " and id not in(select id from shop_goods_group where id in(" + id_list + "))"); } #endregion if (bll.Update(model)) { AddAdminLog(TWEnums.ActionEnum.Edit.ToString(), "修改" + this.channel_name + "頻道內容:" + model.title); //記錄日誌 result = true; } return(result); }
private void ShowInfo(int _id) { BLL.article bll = new BLL.article(); Model.article_goods model = bll.GetGoodsModel(_id); ddlCategoryId.SelectedValue = model.category_id.ToString(); txtTitle.Text = model.title; txtGoodsNo.Text = model.goods_no; txtStockQuantity.Text = model.stock_quantity.ToString(); txtMarketPrice.Text = model.market_price.ToString(); txtSellPrice.Text = model.sell_price.ToString(); txtPoint.Text = model.point.ToString(); txtLinkUrl.Text = model.link_url; if (model.is_msg == 1) { cblItem.Items[0].Selected = true; } if (model.is_top == 1) { cblItem.Items[1].Selected = true; } if (model.is_red == 1) { cblItem.Items[2].Selected = true; } if (model.is_hot == 1) { cblItem.Items[3].Selected = true; } if (model.is_slide == 1) { cblItem.Items[4].Selected = true; } if (model.is_lock == 1) { cblItem.Items[5].Selected = true; } txtSortId.Text = model.sort_id.ToString(); txtClick.Text = model.click.ToString(); txtDiggGood.Text = model.digg_good.ToString(); txtDiggBad.Text = model.digg_bad.ToString(); txtContent.Value = model.content; txtSeoTitle.Text = model.seo_title; txtSeoKeywords.Text = model.seo_keywords; txtSeoDescription.Text = model.seo_description; //赋值用户组价格 if (model.goods_group_prices != null) { for (int i = 0; i < this.rptPrice.Items.Count; i++) { int hideId = Convert.ToInt32(((HiddenField)this.rptPrice.Items[i].FindControl("hideGroupId")).Value); foreach (Model.goods_group_price modelt in model.goods_group_prices) { if (hideId == modelt.group_id) { ((HiddenField)this.rptPrice.Items[i].FindControl("hidePriceId")).Value = modelt.id.ToString(); ((TextBox)this.rptPrice.Items[i].FindControl("txtGroupPrice")).Text = modelt.price.ToString(); } } } } //赋值上传的相册 focus_photo.Value = model.img_url; //封面图片 LitAlbumList.Text = GetAlbumHtml(model.albums, model.img_url); //赋值属性列表 LitAttributeList.Text = GetAttributeHtml(model.attribute_values, this.channel_id, _id); }
private bool DoEdit(int _id) { bool result = true; BLL.article bll = new BLL.article(); Model.article_goods model = bll.GetGoodsModel(_id); model.channel_id = this.channel_id; model.title = txtTitle.Text.Trim(); model.category_id = int.Parse(ddlCategoryId.SelectedValue); model.goods_no = txtGoodsNo.Text; model.stock_quantity = int.Parse(txtStockQuantity.Text); model.market_price = decimal.Parse(txtMarketPrice.Text); model.sell_price = decimal.Parse(txtSellPrice.Text); model.point = int.Parse(txtPoint.Text); model.link_url = txtLinkUrl.Text.Trim(); model.img_url = focus_photo.Value; model.content = txtContent.Value; model.seo_title = txtSeoTitle.Text.Trim(); model.seo_keywords = txtSeoKeywords.Text.Trim(); model.seo_description = txtSeoDescription.Text.Trim(); model.sort_id = int.Parse(txtSortId.Text.Trim()); model.click = int.Parse(txtClick.Text.Trim()); model.digg_good = int.Parse(txtDiggGood.Text.Trim()); model.digg_bad = int.Parse(txtDiggBad.Text.Trim()); model.is_msg = 0; model.is_top = 0; model.is_red = 0; model.is_hot = 0; model.is_slide = 0; model.is_lock = 0; if (cblItem.Items[0].Selected == true) { model.is_msg = 1; } if (cblItem.Items[1].Selected == true) { model.is_top = 1; } if (cblItem.Items[2].Selected == true) { model.is_red = 1; } if (cblItem.Items[3].Selected == true) { model.is_hot = 1; } if (cblItem.Items[4].Selected == true) { model.is_slide = 1; } if (cblItem.Items[5].Selected == true) { model.is_lock = 1; } //用户组价格 List <Model.goods_group_price> priceList = new List <Model.goods_group_price>(); for (int i = 0; i < rptPrice.Items.Count; i++) { int hidPriceId = 0; if (!string.IsNullOrEmpty(((HiddenField)rptPrice.Items[i].FindControl("hidePriceId")).Value)) { hidPriceId = Convert.ToInt32(((HiddenField)rptPrice.Items[i].FindControl("hidePriceId")).Value); } int hidGroupId = Convert.ToInt32(((HiddenField)rptPrice.Items[i].FindControl("hideGroupId")).Value); decimal _price = Convert.ToDecimal(((TextBox)rptPrice.Items[i].FindControl("txtGroupPrice")).Text.Trim()); priceList.Add(new Model.goods_group_price { id = hidPriceId, article_id = _id, group_id = hidGroupId, price = _price }); } model.goods_group_prices = priceList; //保存相册 if (model.albums != null) { model.albums.Clear(); } string[] albumArr = Request.Form.GetValues("hide_photo_name"); string[] remarkArr = Request.Form.GetValues("hide_photo_remark"); if (albumArr != null) { List <Model.article_albums> ls = new List <Model.article_albums>(); for (int i = 0; i < albumArr.Length; i++) { string[] imgArr = albumArr[i].Split('|'); int img_id = int.Parse(imgArr[0]); if (imgArr.Length == 3) { if (!string.IsNullOrEmpty(remarkArr[i])) { ls.Add(new Model.article_albums { id = img_id, article_id = _id, big_img = imgArr[1], small_img = imgArr[2], remark = remarkArr[i] }); } else { ls.Add(new Model.article_albums { id = img_id, article_id = _id, big_img = imgArr[1], small_img = imgArr[2] }); } } } model.albums = ls; } //扩展属性 BLL.attributes bll2 = new BLL.attributes(); DataSet ds2 = bll2.GetList("channel_id=" + this.channel_id); List <Model.attribute_value> attrls = new List <Model.attribute_value>(); foreach (DataRow dr in ds2.Tables[0].Rows) { int attr_id = int.Parse(dr["id"].ToString()); string attr_title = dr["title"].ToString(); string attr_value_id = Request.Form["value_" + attr_id]; string attr_value_content = Request.Form["content_" + attr_id]; if (!string.IsNullOrEmpty(attr_value_id) && !string.IsNullOrEmpty(attr_value_content)) { attrls.Add(new Model.attribute_value { id = Convert.ToInt32(attr_value_id), article_id = _id, attribute_id = attr_id, title = attr_title, content = attr_value_content }); } } model.attribute_values = attrls; if (!bll.Update(model)) { result = false; } return(result); }
//設置操作 protected void rptList_ItemCommand(object source, RepeaterCommandEventArgs e) { //ChkAdminLevel("channel_" + this.channel_name + "_list", TWEnums.ActionEnum.Edit.ToString()); //檢查許可權 int id = Convert.ToInt32(((HiddenField)e.Item.FindControl("hidId")).Value); BLL.article bll = new BLL.article(); Model.article model = bll.GetModel(id); switch (e.CommandName) { case "lbtnIsMsg": if (model.is_msg == 1) { bll.UpdateField(id, "is_msg=0"); } else { bll.UpdateField(id, "is_msg=1"); } break; case "lbtnIsTop": if (model.is_tui == 1) { bll.UpdateField(id, "is_tui=0"); } else { bll.UpdateField(id, "is_tui=1"); } break; case "lbtnIsRed": if (model.is_can == 1) { bll.UpdateField(id, "is_can=0"); } else { bll.UpdateField(id, "is_can=1"); } break; case "lbtnIsHot": if (model.is_zhe == 1) { bll.UpdateField(id, "is_zhe=0"); } else { bll.UpdateField(id, "is_zhe=1"); } break; case "lbtnIsSlide": if (model.is_slide == 1) { bll.UpdateField(id, "is_slide=0"); } else { bll.UpdateField(id, "is_slide=1"); } break; case "lbtnCopy": string tempTitle = model.title; model.title = tempTitle + "(複製)"; bll.Add(model); break; } this.RptBind(this.channel_id, this.category_id, "wheresql='tuan' and company=0" + CombSqlTxt(this.keywords, this.property, this.brand_id, this.category_id), "sort_id desc,add_time desc,id desc"); }
protected void CreateExcel(DataTable dt, string fileName) { string[] titleCol = new string[] { "類型", "商品型號", "商品名稱", "品牌", "顔色", "尺寸", "市價", "售價", "備貨數量", "已售數量", "數量", "商品描述", "注意事項", "關鍵字", "上架日期", "分類", "前台排序" }; Response.Clear(); Response.Buffer = true; Response.Charset = "UTF-8"; Response.AddHeader("Content-Disposition", "attachment; filename=" + fileName); Response.ContentEncoding = System.Text.Encoding.GetEncoding("UTF-8"); Response.Write("<metahttp-equiv=Content-Type content=application/ms-excel;charset=UTF-8>"); Response.ContentType = "application/ms-excel;charset=UTF-8"; ////定義表物件與行物件,同時用DataSet對其值進行初始化 //DataTable dt = ds.Tables[0]; DataRow[] myRow = dt.Select();//可以類似dt.Select("id>10")之形式達到資料篩選目的 int i = 0; int j = 0; StringBuilder sb = new StringBuilder(); sb.Append("<table borderColor='black' border='1' >"); sb.Append("<thead>"); sb.Append("<tr>"); //取得資料表各列標題,各標題之間以t分割,最後一個列標題後加回車符 for (i = 0; i < titleCol.Length; i++) { sb.Append("<th>" + titleCol[i].ToString() + "</th>"); } sb.Append("</tr>"); sb.Append("</thead>"); sb.Append("<tbody>"); //向HTTP輸出流中寫入取得的資料資訊 //逐行處理資料 DataTable goodsDt = new DataTable(); BLL.goods goodsBll = new BLL.goods(); BLL.article_category categoryBll = new BLL.article_category(); foreach (DataRow row in myRow) { //當前行資料寫入HTTP輸出流,並且置空ls_item以便下行資料 Model.article model = new BLL.article().GetModel(Utils.ObjToInt(row["id"], 0)); sb.Append("<tr>"); for (i = 0; i < titleCol.Length; i++) { switch (i) { case 0: sb.Append("<td>主件</td>"); break; case 1: sb.Append("<td>" + model.guige.ToString() + "</td>"); break; case 2: sb.Append("<td>" + row["title"].ToString() + "</td>"); break; case 3: sb.Append("<td>" + model.guige + "</td>"); break; case 4: sb.Append("<td>" + model.guige + "</td>"); break; case 5: sb.Append("<td>" + model.guige + "</td>"); break; case 6: sb.Append("<td>" + model.id + "</td>"); break; case 7: sb.Append("<td>" + model.id + "</td>"); break; case 8: sb.Append("<td> </td>"); break; case 9: sb.Append("<td> </td>"); break; case 10: sb.Append("<td>" + model.id.ToString() + "</td>"); break; case 11: sb.Append("<td>" + Tea.Common.Utils.ToTxt(model.guige) + "</td>"); break; case 12: sb.Append("<td>" + Tea.Common.Utils.ToTxt(model.guige) + "</td>"); break; case 13: sb.Append("<td>" + row["seo_keywords"].ToString() + "</td>"); break; case 14: sb.Append("<td>" + row["add_time"].ToString() + "</td>"); break; case 15: sb.Append("<td>" + categoryBll.GetTitle(Utils.ObjToInt(row["category_id"], 0)) + "</td>"); break; case 16: sb.Append("<td>" + row["sort_id"].ToString() + "</td>"); break; } } sb.Append("</tr>"); goodsDt = goodsBll.GetList("parent_id=" + Utils.ObjToInt(row["id"], 0)).Tables[0]; foreach (DataRow row1 in goodsDt.Rows) { sb.Append("<tr>"); for (j = 0; j < titleCol.Length; j++) { switch (j) { case 0: sb.Append("<td>子件</td>"); break; case 1: sb.Append("<td>" + row1["goods_no"].ToString() + "</td>"); break; case 2: sb.Append("<td>" + row["title"].ToString() + "</td>"); break; case 3: sb.Append("<td>" + row["title"].ToString() + "</td>"); break; case 4: sb.Append("<td>" + row1["color"].ToString() + "</td>"); break; case 5: sb.Append("<td>" + row1["size"].ToString() + "</td>"); break; case 6: sb.Append("<td>" + row1["market_price"].ToString() + "</td>"); break; case 7: sb.Append("<td>" + row1["sell_price"].ToString() + "</td>"); break; case 8: sb.Append("<td>" + getku(row1["id"].ToString()) + "</td>"); break; case 9: sb.Append("<td>" + getcode(row1["id"].ToString()) + "</td>"); break; case 10: sb.Append("<td>" + row1["stock_quantity"].ToString() + "</td>"); break; } } sb.Append("</tr>"); } } sb.Append("</tbody></table>"); Response.Write(sb.ToString()); Response.End(); }
private void Bind() { BLL.article bll = new BLL.article(); Model.article_goods model = bll.GetGoodsModel(id); if (model != null) { LabTel.Text = model.dianhua; lblConnet.Text = model.lianxiren; lblTitle.Text = model.title; lblContent.Text = model.content; Image1Url = model.img_url; lblSellPrice.Text = model.single_price.ToString(); lblTotalPrice.Text = model.sell_price.ToString(); lblyajin.Text = model.shangpinType.ToString(); lblZjprice.Text = model.market_price.ToString(); //lblzuoxiang.Text = model.zuoxiang; lblpingshu.Text = model.mianji.ToString(); BLL.category bllCata = new BLL.category(); Model.category Cata = bllCata.GetModel(model.xianlu); lblNo.Text = model.shequ; switch (model.category_id) { case 302: hire.Visible = true; sell.Visible = false; break; case 303: hire.Visible = false; sell.Visible = true; break; case 328: hire.Visible = true; sell.Visible = true; break; } //if (Cata != null) //{ // int Pid = Cata.parent_id; // string FirstStaton = bllCata.GetModel(Pid).title; if (model.quyu == 0 || string.IsNullOrEmpty(model.quyu.ToString())) { lblStation.Text = "無資料"; } else { lblStation.Text = model.quyu.ToString() + "%"; } // } lblhuxing.Text = model.stock_quantity == 1 ? "有" : "無"; Cata = bllCata.GetModel(model.category_id); lblxingneng.Text = model.xingneng; lblAge.Text = model.fuwuxiangju.ToString(); if (!string.IsNullOrEmpty(model.link_url)) { lbllouceng.Text = model.link_url.ToString(); } //if (Cata != null) //{ // lblyongtu.Text = Cata.title; //} lblFenQu.Text = GetUserArea(model.point); if (model.jiaqianQJ == 0 || string.IsNullOrEmpty(model.jiaqianQJ.ToString())) { lblchwei.Text = "無資料"; } else { lblchwei.Text = model.jiaqianQJ.ToString() + "%"; } //lblshequ.Text = model.shequ; if (model.huxing == 0 || string.IsNullOrEmpty(model.huxing.ToString())) { lbldizhi.Text = "無資料"; } else { lbldizhi.Text = model.huxing.ToString() + "米"; } string Adress = model.dizhi; string Values = model.goods_no; big5Address = System.Web.HttpUtility.UrlEncode(Adress, Encoding.GetEncoding("UTF-8")); if (!string.IsNullOrEmpty(Values)) { if (Values.IndexOf('|') > 0) { string[] ArrList = Values.Split('|'); X = ArrList[0]; Y = ArrList[1]; } } foreach (var item in model.albums) { Images += " <li><a href='" + item.small_img + "'><img src=\"" + item.small_img + "\" alt=\"" + item.remark + "\" width=\"68\" height=\"50\" rel=\"" + item.big_img + "\"/></a></li>"; } repdateImgae.DataSource = model.albums; repdateImgae.DataBind(); } }
private bool DoEdit(int _id) { bool result = false; BLL.article bll = new BLL.article(); Model.article model = bll.GetModel(_id); model.channel_id = this.channel_id; model.category_id = Utils.StrToInt(ddlCategoryId.SelectedValue, 0); model.call_index = txtCallIndex.Text.Trim(); model.title = txtTitle.Text.Trim(); model.link_url = txtLinkUrl.Text.Trim(); model.img_url = txtImgUrl.Text; model.seo_title = txtSeoTitle.Text.Trim(); model.seo_keywords = txtSeoKeywords.Text.Trim(); model.seo_description = txtSeoDescription.Text.Trim(); //内容摘要提取内容前255个字符 if (string.IsNullOrEmpty(txtZhaiyao.Text.Trim())) { model.zhaiyao = Utils.DropHTML(txtContent.Value, 255); } else { model.zhaiyao = Utils.DropHTML(txtZhaiyao.Text, 255); } model.content = txtContent.Value; model.sort_id = Utils.StrToInt(txtSortId.Text.Trim(), 99); model.click = int.Parse(txtClick.Text.Trim()); model.status = Utils.StrToInt(rblStatus.SelectedValue, 0); model.is_msg = 0; model.is_top = 0; model.is_red = 0; model.is_hot = 0; model.is_slide = 0; if (cblItem.Items[0].Selected == true) { model.is_msg = 1; } if (cblItem.Items[1].Selected == true) { model.is_top = 1; } if (cblItem.Items[2].Selected == true) { model.is_red = 1; } if (cblItem.Items[3].Selected == true) { model.is_hot = 1; } if (cblItem.Items[4].Selected == true) { model.is_slide = 1; } model.add_time = Utils.StrToDateTime(txtAddTime.Text.Trim()); model.update_time = DateTime.Now; model.fields = SetFieldValues(this.channel_id); //扩展字段赋值 #region 保存相册==================== //检查是否有自定义图片 if (txtImgUrl.Text.Trim() == "") { model.img_url = hidFocusPhoto.Value; } if (model.albums != null) { model.albums.Clear(); } string[] albumArr = Request.Form.GetValues("hid_photo_name"); string[] remarkArr = Request.Form.GetValues("hid_photo_remark"); if (albumArr != null) { List <Model.article_albums> ls = new List <Model.article_albums>(); for (int i = 0; i < albumArr.Length; i++) { string[] imgArr = albumArr[i].Split('|'); int img_id = Utils.StrToInt(imgArr[0], 0); if (imgArr.Length == 3) { if (!string.IsNullOrEmpty(remarkArr[i])) { ls.Add(new Model.article_albums { id = img_id, article_id = _id, original_path = imgArr[1], thumb_path = imgArr[2], remark = remarkArr[i] }); } else { ls.Add(new Model.article_albums { id = img_id, article_id = _id, original_path = imgArr[1], thumb_path = imgArr[2] }); } } } model.albums = ls; } #endregion #region 保存附件==================== if (model.attach != null) { model.attach.Clear(); } string[] attachIdArr = Request.Form.GetValues("hid_attach_id"); string[] attachFileNameArr = Request.Form.GetValues("hid_attach_filename"); string[] attachFilePathArr = Request.Form.GetValues("hid_attach_filepath"); string[] attachFileSizeArr = Request.Form.GetValues("hid_attach_filesize"); string[] attachPointArr = Request.Form.GetValues("txt_attach_point"); if (attachIdArr != null && attachFileNameArr != null && attachFilePathArr != null && attachFileSizeArr != null && attachPointArr != null && attachIdArr.Length > 0 && attachFileNameArr.Length > 0 && attachFilePathArr.Length > 0 && attachFileSizeArr.Length > 0 && attachPointArr.Length > 0) { List <Model.article_attach> ls = new List <Model.article_attach>(); for (int i = 0; i < attachFileNameArr.Length; i++) { int attachId = Utils.StrToInt(attachIdArr[i], 0); int fileSize = Utils.StrToInt(attachFileSizeArr[i], 0); string fileExt = Utils.GetFileExt(attachFilePathArr[i]); int _point = Utils.StrToInt(attachPointArr[i], 0); ls.Add(new Model.article_attach { id = attachId, article_id = _id, file_name = attachFileNameArr[i], file_path = attachFilePathArr[i], file_size = fileSize, file_ext = fileExt, point = _point, }); } model.attach = ls; } #endregion #region 保存会员组价格============== List <Model.user_group_price> priceList = new List <Model.user_group_price>(); for (int i = 0; i < rptPrice.Items.Count; i++) { int hidPriceId = 0; if (!string.IsNullOrEmpty(((HiddenField)rptPrice.Items[i].FindControl("hidePriceId")).Value)) { hidPriceId = Convert.ToInt32(((HiddenField)rptPrice.Items[i].FindControl("hidePriceId")).Value); } int hidGroupId = Convert.ToInt32(((HiddenField)rptPrice.Items[i].FindControl("hideGroupId")).Value); decimal _price = Convert.ToDecimal(((TextBox)rptPrice.Items[i].FindControl("txtGroupPrice")).Text.Trim()); priceList.Add(new Model.user_group_price { id = hidPriceId, article_id = _id, group_id = hidGroupId, price = _price }); } model.group_price = priceList; #endregion if (bll.Update(model)) { AddAdminLog(DTEnums.ActionEnum.Edit.ToString(), "修改" + this.channel_name + "频道内容:" + model.title); //记录日志 result = true; } return(result); }
//微信推送 protected void btnWxPost_Click(object sender, EventArgs e) { ChkAdminLevel("channel_" + this.channel_name + "_list", DTEnums.ActionEnum.Edit.ToString()); //检查权限 //检查该微信公众号是否开启消息推送功能 Model.weixin_account wxModel = new BLL.weixin_account().GetModel(); if (wxModel == null || wxModel.is_push == 0) { JscriptMsg("微信账户未开启消息推送!", string.Empty); return; } string errmsg = string.Empty; //错误消息 string linkdomain = GetLinkDomain(); //链接网址 List <Model.article> artls = new List <Model.article>(); //选中文章的实体 API.Weixin.Common.CRMComm wxComm = new API.Weixin.Common.CRMComm(); List <Senparc.Weixin.MP.AdvancedAPIs.GroupMessage.NewsModel> ls = new List <Senparc.Weixin.MP.AdvancedAPIs.GroupMessage.NewsModel>(); BLL.article bll = new BLL.article(); Repeater rptList = new Repeater(); if (this.rptList1.Visible == true) { rptList = this.rptList1; } else { rptList = this.rptList2; } for (int i = 0; i < rptList.Items.Count; i++) { int id = Convert.ToInt32(((HiddenField)rptList.Items[i].FindControl("hidId")).Value); CheckBox cb = (CheckBox)rptList.Items[i].FindControl("chkId"); if (cb.Checked) { Model.article model = bll.GetWXModel(id); //获取文章实体 if (model == null || string.IsNullOrEmpty(model.img_url.Trim())) { JscriptMsg("错误:所选择信息有些没有图片!", string.Empty); return; } artls.Add(model); } } //判断是否超出推送的数量 if (artls.Count == 0 || artls.Count > 10) { JscriptMsg("错误:推送消息数量应在1-10条范围!", string.Empty); return; } //上传及群发消息 foreach (Model.article modelt in artls) { //上传永久素材获取media_id string mediaId = wxComm.UploadForeverMedia(Utils.GetMapPath(modelt.img_url), out errmsg); if (string.IsNullOrEmpty(mediaId)) { JscriptMsg("错误:" + errmsg, string.Empty); return; } //添加消息实体 Senparc.Weixin.MP.AdvancedAPIs.GroupMessage.NewsModel newsModel = new Senparc.Weixin.MP.AdvancedAPIs.GroupMessage.NewsModel(); newsModel.thumb_media_id = mediaId; //图文消息缩略图的media_id newsModel.title = modelt.title; //图文消息的标题 newsModel.content_source_url = linkdomain; //点击“阅读原文”后的页面 newsModel.content = ReplaceImagesPath(modelt.content); //图文消息页面的内容,替换图片路径 newsModel.digest = modelt.zhaiyao; //图文消息的描述 newsModel.show_cover_pic = "1"; //是否显示封面,1为显示,0为不显示 ls.Add(newsModel); //添加实体到泛型 } //开始群发消息 bool result = wxComm.SendGroupMessageByGroupId(ls, out errmsg); if (!result) { JscriptMsg("错误:" + errmsg, string.Empty); return; } JscriptMsg("微信消息推送成功!", Utils.CombUrlTxt("article_list.aspx", "channel_id={0}&category_id={1}&keywords={2}&property={3}&page={4}", this.channel_id.ToString(), this.category_id.ToString(), this.keywords, this.property, this.page.ToString())); }
private void ShowInfo(int _id) { BLL.article bll = new BLL.article(); Model.article model = bll.GetModel(_id); ddlCategoryId.SelectedValue = model.category_id.ToString(); ddlType.SelectedValue = model.brand_id.ToString(); txtCallIndex.Text = model.call_index; txtTitle.Text = model.title; txtLinkUrl.Text = model.link_url; //不是相冊圖片就綁定 string filename = model.img_url.Substring(model.img_url.LastIndexOf("/") + 1); if (!filename.StartsWith("thumb_")) { txtImgUrl.Text = model.img_url; } txtSeoTitle.Text = model.seo_title; txtSeoKeywords.Text = model.seo_keywords; txtSeoDescription.Text = model.seo_description; txtZhaiyao.Text = model.zhaiyao; txtContent.Value = model.content; txtSortId.Text = model.sort_id.ToString(); txtClick.Text = model.click.ToString(); rblStatus.SelectedValue = model.status.ToString(); if (action == TWEnums.ActionEnum.Edit.ToString()) { txtAddTime.Text = model.add_time.ToString("yyyy-MM-dd"); txtBeginTime.Text = model.begin_time.ToString("yyyy-MM-dd"); txtEndTime.Text = model.end_time.ToString("yyyy-MM-dd"); if (model.update_time != null) { txtUpdate.Text = model.update_time.GetValueOrDefault().ToString("yyyy-MM-dd"); } if (model.xia_date != null) { txt_Xia_Date.Text = model.xia_date.GetValueOrDefault().ToString("yyyy-MM-dd"); } } if (model.is_tui == 1) { cblItem.Items[0].Selected = true; } if (model.is_zhe == 1) { cblItem.Items[1].Selected = true; } //擴展欄位賦值 txtGuige.Text = model.guige; txtGuigeMore.Value = model.guigemore; txtShuo.Value = model.shuoming; IList _list = model.more_type.Split(','); foreach (ListItem li in cbMore.Items) { if (_list.Contains(li.Value)) { li.Selected = true; } } txtSub_title.Text = model.sub_title; txtPoint.Text = model.point.ToString(); txtSell_price.Text = model.sell_price.ToString("0."); txtMarket_price.Text = model.market_price.ToString("0."); txtGoods_no.Text = model.goods_no; try { Tea.Model.goods model_goods = new BLL.goods().GetModel(model.team_id); txtChang.Text = model_goods.chang.ToString(); txtKuan.Text = model_goods.kuan.ToString(); txtGao.Text = model_goods.gao.ToString(); txtZhong.Text = model_goods.zhong.ToString(); txtStock_quantity.Text = model_goods.stock_quantity.ToString(); } catch (Exception eee) { } if (model.is_msg == 1) { cbIsLock.Checked = true; } try { txtTag.Text = model.tags.Split('$')[0].ToString(); txtTag1.Text = model.tags.Split('$')[1].ToString(); txtTag2.Text = model.tags.Split('$')[2].ToString(); } catch (Exception eee) { } //連結圖片相冊 if (filename.StartsWith("thumb_")) { hidFocusPhoto.Value = model.img_url; //封面圖片 } rptAlbumList.DataSource = model.albums; rptAlbumList.DataBind(); rptGroup.DataSource = Tea.DBUtility.DbHelperSQL.Query("select * from shop_goods_group where main_id=" + id + ""); rptGroup.DataBind(); //賦值用戶組價格 if (model.group_price != null) { for (int i = 0; i < this.rptPrice.Items.Count; i++) { int hideId = Convert.ToInt32(((HiddenField)this.rptPrice.Items[i].FindControl("hideGroupId")).Value); foreach (Model.user_group_price modelt in model.group_price) { if (hideId == modelt.group_id) { ((HiddenField)this.rptPrice.Items[i].FindControl("hidePriceId")).Value = modelt.id.ToString(); ((TextBox)this.rptPrice.Items[i].FindControl("txtGroupPrice")).Text = modelt.price.ToString(); } } } } }
private void BindHot() { BLL.article bll = new BLL.article(); RepBindHot.DataSource = bll.GetList("news", 100000, "status=0", "sort_id asc,id desc"); RepBindHot.DataBind(); }
private void BindNext(int category_id, int id) { BLL.article bll = new BLL.article(); //RepBindNext.DataSource = bll.GetList("news", category_id, 1, "status=0 and id>" + id, "id asc"); //RepBindNext.DataBind(); }
//设置操作 protected void rptList_ItemCommand(object source, RepeaterCommandEventArgs e) { ChkAdminLevel("articleinfo", MXEnums.ActionEnum.Edit.ToString()); //检查权限 int id = Convert.ToInt32(((HiddenField)e.Item.FindControl("hidId")).Value); BLL.article bll = new BLL.article(); Model.article model = bll.GetModel(id); switch (e.CommandName) { case "lbtnIsMsg": if (model.is_msg == 1) { bll.UpdateField(id, "is_msg=0"); } else { bll.UpdateField(id, "is_msg=1"); } break; case "lbtnIsTop": if (model.is_top == 1) { bll.UpdateField(id, "is_top=0"); } else { bll.UpdateField(id, "is_top=1"); } break; case "lbtnIsRed": if (model.is_red == 1) { bll.UpdateField(id, "is_red=0"); } else { bll.UpdateField(id, "is_red=1"); } break; case "lbtnIsHot": if (model.is_hot == 1) { bll.UpdateField(id, "is_hot=0"); } else { bll.UpdateField(id, "is_hot=1"); } break; case "lbtnIsSlide": if (model.is_slide == 1) { bll.UpdateField(id, "is_slide=0"); } else { bll.UpdateField(id, "is_slide=1"); } break; } this.RptBind(this.channel_id, this.category_id, "id>0" + CombSqlTxt(this.keywords, this.property), "sort_id asc,add_time desc,id desc"); }
private bool DoEdit(int _id) { bool result = true; BLL.article bll = new BLL.article(); Model.article_download model = bll.GetDownloadModel(_id); model.channel_id = this.channel_id; model.title = txtTitle.Text.Trim(); model.category_id = int.Parse(ddlCategoryId.SelectedValue); model.link_url = txtLinkUrl.Text.Trim(); model.img_url = txtImgUrl.Text.Trim(); model.content = txtContent.Value; model.seo_title = txtSeoTitle.Text.Trim(); model.seo_keywords = txtSeoKeywords.Text.Trim(); model.seo_description = txtSeoDescription.Text.Trim(); model.sort_id = int.Parse(txtSortId.Text.Trim()); model.click = int.Parse(txtClick.Text.Trim()); model.digg_good = int.Parse(txtDiggGood.Text.Trim()); model.digg_bad = int.Parse(txtDiggBad.Text.Trim()); model.is_msg = 0; model.is_red = 0; model.is_lock = 0; if (cblItem.Items[0].Selected == true) { model.is_msg = 1; } if (cblItem.Items[1].Selected == true) { model.is_red = 1; } if (cblItem.Items[2].Selected == true) { model.is_lock = 1; } //保存附件 if (model.download_attachs != null) { model.download_attachs.Clear(); } string hidFileList = Request.Params["hidFileName"]; string[] pointArr = Request.Form.GetValues("txtPoint"); if (!string.IsNullOrEmpty(hidFileList)) { string[] fileListArr = hidFileList.Split(','); List <Model.download_attach> ls = new List <Model.download_attach>(); for (int i = 0; i < fileListArr.Length; i++) { string[] fileArr = fileListArr[i].Split('|'); if (fileArr.Length == 3) { int attach_id = int.Parse(fileArr[0]); int fileSize = Utils.GetFileSize(fileArr[2]); string fileExt = Utils.GetFileExt(fileArr[2]); int _point = int.Parse(pointArr[i]); //删除旧文件 if (attach_id > 0) { new BLL.download_attach().DeleteFile(attach_id, fileArr[2]); } ls.Add(new Model.download_attach { id = attach_id, article_id = _id, title = fileArr[1], file_path = fileArr[2], file_size = fileSize, file_ext = fileExt, point = _point }); } } model.download_attachs = ls; } if (!bll.Update(model)) { result = false; } return(result); }
private bool DoEdit(int _id) { bool result = false; BLL.article bll = new BLL.article(); Model.article model = bll.GetModel(this.channel_id, _id); model.site_id = this.channelModel.site_id; model.channel_id = this.channel_id; model.category_id = Utils.StrToInt(ddlCategoryId.SelectedValue, 0); model.call_index = txtCallIndex.Text.Trim(); model.title = txtTitle.Text.Trim(); model.link_url = txtLinkUrl.Text.Trim(); model.img_url = txtImgUrl.Text; model.sort_id = Utils.StrToInt(txtSortId.Text.Trim(), 99); model.click = int.Parse(txtClick.Text.Trim()); model.is_msg = 0; model.is_top = 0; if (cblItem.Items[0].Selected == true) { model.is_msg = 1; } if (cblItem.Items[1].Selected == true) { model.is_top = 1; } if (cbStatus.Checked == false) { model.status = 2; } else { model.status = GetAdminInfo().is_audit; } model.add_time = Utils.StrToDateTime(txtAddTime.Text.Trim()); model.update_time = DateTime.Now; model.fields = SetFieldValues(this.channel_id); //扩展字段赋值 #region 保存相册==================== //检查是否有自定义图片 if (txtImgUrl.Text.Trim() == "") { model.img_url = hidFocusPhoto.Value; } if (model.albums != null) { model.albums.Clear(); } string[] albumArr = Request.Form.GetValues("hid_photo_name"); string[] remarkArr = Request.Form.GetValues("hid_photo_remark"); if (albumArr != null) { List <Model.article_albums> ls = new List <Model.article_albums>(); for (int i = 0; i < albumArr.Length; i++) { string[] imgArr = albumArr[i].Split('|'); int img_id = Utils.StrToInt(imgArr[0], 0); if (imgArr.Length == 3) { if (!string.IsNullOrEmpty(remarkArr[i])) { ls.Add(new Model.article_albums { id = img_id, channel_id = this.channel_id, article_id = _id, original_path = imgArr[1], thumb_path = imgArr[2], remark = remarkArr[i] }); } else { ls.Add(new Model.article_albums { id = img_id, channel_id = this.channel_id, article_id = _id, original_path = imgArr[1], thumb_path = imgArr[2] }); } } } model.albums = ls; } #endregion #region 保存会员组价格============== List <Model.user_group_price> priceList = new List <Model.user_group_price>(); for (int i = 0; i < rptPrice.Items.Count; i++) { int hidPriceId = 0; if (!string.IsNullOrEmpty(((HiddenField)rptPrice.Items[i].FindControl("hidePriceId")).Value)) { hidPriceId = Convert.ToInt32(((HiddenField)rptPrice.Items[i].FindControl("hidePriceId")).Value); } int hidGroupId = Convert.ToInt32(((HiddenField)rptPrice.Items[i].FindControl("hideGroupId")).Value); decimal _price = Convert.ToDecimal(((TextBox)rptPrice.Items[i].FindControl("txtGroupPrice")).Text.Trim()); priceList.Add(new Model.user_group_price { id = hidPriceId, channel_id = this.channel_id, article_id = _id, group_id = hidGroupId, price = _price }); } model.group_price = priceList; #endregion if (bll.Update(model)) { AddAdminLog(DTEnums.ActionEnum.Edit.ToString(), "修改" + this.channelModel.title + "频道内容:" + model.title); //记录日志 result = true; } return(result); }
private void ShowInfo(int _id) { BLL.article bll = new BLL.article(); Model.article_goods model = bll.GetGoodsModel(_id); #region 土地參數 txtDImu.Text = model.link_url; //地目 txtChiFen.Text = model.fuwuxiangju; //持分 txtRongyiLv.Text = model.jiaqianQJ.ToString(); //容積率 txtNowPrice.Text = model.shangpinType; //公告現值 txtJianBiLv.Text = model.quyu.ToString(); //建蔽率 chkDiShangWu.Checked = false; if (model.stock_quantity == 1) { chkDiShangWu.Checked = true; //地上物 } //ddlForm.SelectedValue = model.fangshi.ToString(); //形式 txtUserTo.Text = model.xingneng; //現況用途 txtRoadsWidth.Text = model.huxing.ToString(); //路宽 #endregion txtPrice.Text = model.market_price.ToString(); ddlCategoryId.SelectedValue = model.category_id.ToString(); ddlArea.SelectedValue = model.point.ToString(); txtTitle.Text = model.title; txtY.Text = model.goods_no; //txtStockQuantity.Text = model.stock_quantity.ToString(); txtMarketPrice.Text = model.sell_price.ToString(); //txtSellPrice.Text = model.sell_price.ToString(); txtSinglePrice.Text = model.single_price.ToString(); model.point = Utils.StringToNum(ddlArea.SelectedValue); //使用分區 //txtLinkUrl.Text = model.link_url; txtTime.Text = model.add_time.ToString(); txtuser.Text = model.lianxiren; // txtshangpintype.Text = model.shangpinType; if (model.is_msg == 1) { cblItem.Items[0].Selected = true; } if (model.is_top == 1) { cblItem.Items[1].Selected = true; } if (model.is_red == 1) { cblItem.Items[2].Selected = true; } if (model.is_hot == 1) { cblItem.Items[3].Selected = true; } if (model.is_slide == 1) { cblItem.Items[4].Selected = true; } if (model.is_lock == 1) { cblItem.Items[5].Selected = true; } //txtSortId.Text = model.sort_id.ToString(); //txtClick.Text = model.click.ToString(); //txtDiggGood.Text = model.digg_good.ToString(); //txtDiggBad.Text = model.digg_bad.ToString(); txtContent.Value = model.content; txtSeoTitle.Text = model.seo_title; txtSeoKeywords.Text = model.seo_keywords; txtSeoDescription.Text = model.seo_description; //賦值用戶組價格 //if (model.goods_group_prices != null) //{ // for (int i = 0; i < this.rptPrice.Items.Count; i++) // { // int hideId = Convert.ToInt32(((HiddenField)this.rptPrice.Items[i].FindControl("hideGroupId")).Value); // foreach (Model.goods_group_price modelt in model.goods_group_prices) // { // if (hideId == modelt.group_id) // { // ((HiddenField)this.rptPrice.Items[i].FindControl("hidePriceId")).Value = modelt.id.ToString(); // ((TextBox)this.rptPrice.Items[i].FindControl("txtGroupPrice")).Text = modelt.price.ToString(); // } // } // } //} //賦值上傳的相冊 img_Url = model.img_url; //封面圖片 LitAlbumList.Text = GetAlbumHtml(model.albums, model.img_url); //賦值屬性清單 LitAttributeList.Text = GetAttributeHtml(model.attribute_values, this.channel_id, _id); cblItem.SelectedValue = model.Type.ToString(); CheckBoxList1.SelectedValue = model.Postid; //ddlquyu.SelectedValue = model.quyu.ToString(); //ddljiaqian.SelectedValue = model.jiaqianQJ.ToString(); txtMianJi.Text = model.mianji.ToString(); //ddlhuxing.SelectedValue = model.huxing.ToString(); //ddlfangshi.SelectedValue = model.fangshi.ToString(); ddlditie.SelectedValue = model.xianlu.ToString(); txtyajin.Text = model.yajin.ToString(); //txtzuoxiang.Text = model.zuoxiang; //txtlouceng.Text = model.louceng; //txtxingneng.Text = model.xingneng; txtyongtu.Text = model.yongtu; txtSinglePrice.Text = model.single_price.ToString(); chkPort.Checked = model.chewei == "有" ? true : false; txtNo.Text = model.shequ; txtdizhi.Text = model.dizhi; txtgongsi.Text = model.gongsi; //txtfuwxiangmu.Text = model.fuwuxiangju; txtdianhua.Text = model.dianhua; ddlAreaid.SelectedValue = model.Areaid.ToString(); xiajiacheck.Checked = model.Status == 1 ? false : true; xiajiatext.Value = model.xiajialiyou; }
/// <summary> /// 转换成List /// </summary> public static List <Model.cart_items> ToList(List <Model.cart_keys> ls, int group_id) { if (ls != null) { List <Model.cart_items> iList = new List <Model.cart_items>(); foreach (Model.cart_keys item in ls) { //查询文章的信息 Model.article articleModel = new BLL.article().GetModel(item.article_id); if (articleModel == null || !articleModel.fields.ContainsKey("sell_price")) { continue; } //查询商品信息 Model.article_goods goodsModel = articleModel.goods.Find(p => p.id == item.goods_id); if (articleModel.goods != null && articleModel.goods.Count > 0 && goodsModel == null) { continue; } //开始赋值 Model.cart_items modelt = new Model.cart_items(); modelt.article_id = articleModel.id; if (articleModel.fields.ContainsKey("goods_no")) { modelt.goods_no = articleModel.fields["goods_no"]; } modelt.title = articleModel.title; modelt.img_url = articleModel.img_url; modelt.sell_price = Utils.StrToDecimal(articleModel.fields["sell_price"], 0); modelt.user_price = Utils.StrToDecimal(articleModel.fields["sell_price"], 0); if (articleModel.fields.ContainsKey("point")) { modelt.point = Utils.StrToInt(articleModel.fields["point"], 0); } if (articleModel.fields.ContainsKey("stock_quantity")) { modelt.stock_quantity = Utils.StrToInt(articleModel.fields["stock_quantity"], 0); } bool setStatus = false; //会员组价格赋值状态 if (goodsModel != null) { modelt.stock_quantity = goodsModel.stock_quantity; //库存 modelt.sell_price = goodsModel.sell_price; //商品价格 modelt.user_price = goodsModel.sell_price; //会员组价格 modelt.goods_id = goodsModel.id; modelt.goods_no = goodsModel.goods_no; modelt.spec_text = goodsModel.spec_text; //会员组价格 if (group_id > 0 && goodsModel.group_prices != null) { Model.user_group_price userPriceModel = goodsModel.group_prices.Find(p => p.group_id == group_id); if (userPriceModel != null) { setStatus = true; //已赋值 modelt.user_price = userPriceModel.price; } } } //如果未曾有会员组价格则使用折扣价格 if (group_id > 0 && !setStatus) { int discount = new BLL.user_groups().GetDiscount(group_id); if (discount > 0) { modelt.user_price = modelt.sell_price * discount / 100; } } modelt.quantity = item.quantity; //添加入列表 iList.Add(modelt); } return(iList); } return(null); }
private bool DoEdit(int _id) { bool result = true; BLL.article bll = new BLL.article(); Model.article_goods model = bll.GetGoodsModel(_id); model.channel_id = this.channel_id; model.title = txtTitle.Text.Trim(); model.category_id = int.Parse(ddlCategoryId.SelectedValue); model.img_url = focus_photo.Value; model.sort_id = int.Parse(txtSortId.Text.Trim()); model.add_time = model.add_time; model.is_msg = 0; model.is_top = 0; model.is_red = 0; model.is_hot = 0; model.is_slide = 0; model.is_lock = 0; model.content = txtContent.Value; //用戶組價格 List <Model.goods_group_price> priceList = new List <Model.goods_group_price>(); model.goods_group_prices = priceList; //儲存相冊 if (model.albums != null) { model.albums.Clear(); } string[] albumArr = Request.Form.GetValues("hide_photo_name"); string[] remarkArr = Request.Form.GetValues("hide_photo_remark"); if (albumArr != null) { List <Model.article_albums> ls = new List <Model.article_albums>(); for (int i = 0; i < albumArr.Length; i++) { string[] imgArr = albumArr[i].Split('|'); int img_id = int.Parse(imgArr[0]); if (imgArr.Length == 3) { if (!string.IsNullOrEmpty(remarkArr[i])) { ls.Add(new Model.article_albums { id = img_id, article_id = _id, big_img = imgArr[1], small_img = imgArr[2], remark = remarkArr[i] }); } else { ls.Add(new Model.article_albums { id = img_id, article_id = _id, big_img = imgArr[1], small_img = imgArr[2] }); } } } model.albums = ls; } //擴展屬性 BLL.attributes bll2 = new BLL.attributes(); DataSet ds2 = bll2.GetList("channel_id=" + this.channel_id); List <Model.attribute_value> attrls = new List <Model.attribute_value>(); foreach (DataRow dr in ds2.Tables[0].Rows) { int attr_id = int.Parse(dr["id"].ToString()); string attr_title = dr["title"].ToString(); string attr_value_id = Request.Form["value_" + attr_id]; string attr_value_content = Request.Form["content_" + attr_id]; if (!string.IsNullOrEmpty(attr_value_id) && !string.IsNullOrEmpty(attr_value_content)) { attrls.Add(new Model.attribute_value { id = Convert.ToInt32(attr_value_id), article_id = _id, attribute_id = attr_id, title = attr_title, content = attr_value_content }); } } model.attribute_values = attrls; if (!bll.Update(model)) { result = false; } return(result); }
private void ShowInfo(int _id) { BLL.article bll = new BLL.article(); Model.article_goods model = bll.GetGoodsModel(_id); ddlCategoryId.SelectedValue = model.category_id.ToString(); txtTitle.Text = model.title; //txtGoodsNo.Text = model.goods_no; //txtStockQuantity.Text = model.stock_quantity.ToString(); //txtMarketPrice.Text = model.market_price.ToString(); //txtSellPrice.Text = model.sell_price.ToString(); //txtPoint.Text = model.point.ToString(); //txtLinkUrl.Text = model.link_url; txtTime.Text = model.add_time.ToString(); txtuser.Text = model.lianxiren; //txtshangpintype.Text = model.shangpinType; if (model.is_msg == 1) { cblItem.Items[0].Selected = true; } if (model.is_top == 1) { cblItem.Items[1].Selected = true; } if (model.is_red == 1) { cblItem.Items[2].Selected = true; } if (model.is_hot == 1) { cblItem.Items[3].Selected = true; } if (model.is_slide == 1) { cblItem.Items[4].Selected = true; } if (model.is_lock == 1) { cblItem.Items[5].Selected = true; } //txtSortId.Text = model.sort_id.ToString(); //txtClick.Text = model.click.ToString(); //txtDiggGood.Text = model.digg_good.ToString(); //txtDiggBad.Text = model.digg_bad.ToString(); txtContent.Value = model.content; txtSeoTitle.Text = model.seo_title; txtSeoKeywords.Text = model.seo_keywords; txtSeoDescription.Text = model.seo_description; //賦值用戶組價格 if (model.goods_group_prices != null) { //for (int i = 0; i < this.rptPrice.Items.Count; i++) //{ // int hideId = Convert.ToInt32(((HiddenField)this.rptPrice.Items[i].FindControl("hideGroupId")).Value); // foreach (Model.goods_group_price modelt in model.goods_group_prices) // { // if (hideId == modelt.group_id) // { // ((HiddenField)this.rptPrice.Items[i].FindControl("hidePriceId")).Value = modelt.id.ToString(); // ((TextBox)this.rptPrice.Items[i].FindControl("txtGroupPrice")).Text = modelt.price.ToString(); // } // } //} } //賦值上傳的相冊 focus_photo.Value = model.img_url; //封面圖片 LitAlbumList.Text = GetAlbumHtml(model.albums, model.img_url); //賦值屬性清單 //LitAttributeList.Text = GetAttributeHtml(model.attribute_values, this.channel_id, _id); cblItem.SelectedValue = model.Type.ToString(); //CheckBoxList1.SelectedValue = model.Postid; //ddlquyu.SelectedValue = model.quyu.ToString(); //ddljiaqian.SelectedValue = model.jiaqianQJ.ToString(); //ddlmianji.SelectedValue = model.mianji.ToString(); //ddlhuxing.SelectedValue = model.huxing.ToString(); //ddlfangshi.SelectedValue = model.fangshi.ToString(); //ddlditie.SelectedValue = model.xianlu.ToString(); //txtyajin.Text = model.yajin.ToString(); //txtzuoxiang.Text = model.zuoxiang; //txtlouceng.Text = model.louceng; //txtxingneng.Text = model.xingneng; //txtyongtu.Text = model.yongtu; //txtchewei.Text = model.chewei; txtTeChang.Text = model.shequ; txtdizhi.Text = model.dizhi; txtgongsi.Text = model.gongsi; txtfuwxiangmu.Text = model.fuwuxiangju; txtdianhua.Text = model.dianhua; ddlAreaid.SelectedValue = model.Areaid.ToString(); xiajiacheck.Checked = model.Status == 1 ? false : true; xiajiatext.Value = model.xiajialiyou; }
private bool DoEdit(int _id) { bool result = false; BLL.article bll = new BLL.article(); Model.article model = bll.GetModel(_id); model.channel_id = this.channel_id; model.category_id = Utils.StrToInt(ddlCategoryId.SelectedValue, 0); model.call_index = txtCallIndex.Text.Trim(); model.title = txtTitle.Text.Trim(); model.tags = txtTags.Text.Trim(); model.link_url = txtLinkUrl.Text.Trim(); model.img_url = txtImgUrl.Text; model.seo_title = txtSeoTitle.Text.Trim(); model.seo_keywords = txtSeoKeywords.Text.Trim(); model.seo_description = txtSeoDescription.Text.Trim(); //内容摘要提取内容前255个字符 if (string.IsNullOrEmpty(txtZhaiyao.Text.Trim())) { model.zhaiyao = Utils.DropHTML(txtContent.Value, 255); } else { model.zhaiyao = Utils.DropHTML(txtZhaiyao.Text, 255); } //是否将编辑器远程图片保存到本地 if (siteConfig.fileremote == 1) { model.content = AutoRemoteImageSave(txtContent.Value); } else { model.content = txtContent.Value; } model.sort_id = Utils.StrToInt(txtSortId.Text.Trim(), 99); model.click = int.Parse(txtClick.Text.Trim()); model.status = Utils.StrToInt(rblStatus.SelectedValue, 0); model.is_msg = 0; model.is_top = 0; model.is_red = 0; model.is_hot = 0; model.is_slide = 0; if (cblItem.Items[0].Selected == true) { model.is_msg = 1; } if (cblItem.Items[1].Selected == true) { model.is_top = 1; } if (cblItem.Items[2].Selected == true) { model.is_red = 1; } if (cblItem.Items[3].Selected == true) { model.is_hot = 1; } if (cblItem.Items[4].Selected == true) { model.is_slide = 1; } model.add_time = Utils.StrToDateTime(txtAddTime.Text.Trim()); model.update_time = DateTime.Now; model.fields = SetFieldValues(this.channel_id); //扩展字段赋值 #region 保存规格==================== //保存商品规格 string goodsSpecJsonStr = hide_goods_spec_list.Value; List <Model.article_goods_spec> specList = (List <Model.article_goods_spec>)JsonHelper.JSONToObject <List <Model.article_goods_spec> >(goodsSpecJsonStr); if (specList != null) { model.specs = specList; model.goods = new List <Model.article_goods>(); } //保存商品信息 string[] specGoodsIdArr = Request.Form.GetValues("hide_goods_id"); string[] specGoodsNoArr = Request.Form.GetValues("spec_goods_no"); string[] specMarketPriceArr = Request.Form.GetValues("spec_market_price"); string[] specSellPriceArr = Request.Form.GetValues("spec_sell_price"); string[] specStockQuantityArr = Request.Form.GetValues("spec_stock_quantity"); string[] specSpecIdsArr = Request.Form.GetValues("hide_spec_ids"); string[] specTextArr = Request.Form.GetValues("hide_spec_text"); string[] specGroupPriceArr = Request.Form.GetValues("hide_group_price"); if (specGoodsIdArr != null && specGoodsNoArr != null && specMarketPriceArr != null && specSellPriceArr != null && specStockQuantityArr != null && specSpecIdsArr != null && specTextArr != null && specGroupPriceArr != null && specGoodsIdArr.Length > 0 && specGoodsNoArr.Length > 0 && specMarketPriceArr.Length > 0 && specSellPriceArr.Length > 0 && specStockQuantityArr.Length > 0 && specSpecIdsArr.Length > 0 && specTextArr.Length > 0 && specGroupPriceArr.Length > 0) { List <Model.article_goods> goodsList = new List <Model.article_goods>(); for (int i = 0; i < specGoodsNoArr.Length; i++) { List <Model.user_group_price> groupList = new List <Model.user_group_price>(); if (!string.IsNullOrEmpty(specGroupPriceArr[i])) { groupList = (List <Model.user_group_price>)JsonHelper.JSONToObject <List <Model.user_group_price> >(specGroupPriceArr[i]); } goodsList.Add(new Model.article_goods { id = Utils.StrToInt(specGoodsIdArr[i], 0), article_id = model.id, goods_no = specGoodsNoArr[i], spec_ids = specSpecIdsArr[i], spec_text = specTextArr[i], stock_quantity = Utils.StrToInt(specStockQuantityArr[i], 0), market_price = Utils.StrToDecimal(specMarketPriceArr[i], 0), sell_price = Utils.StrToDecimal(specSellPriceArr[i], 0), group_prices = groupList }); } model.goods = goodsList; } #endregion #region 保存相册==================== //检查是否有自定义图片 if (txtImgUrl.Text.Trim() == "") { model.img_url = hidFocusPhoto.Value; } if (model.albums != null) { model.albums.Clear(); } string[] albumArr = Request.Form.GetValues("hid_photo_name"); string[] remarkArr = Request.Form.GetValues("hid_photo_remark"); if (albumArr != null) { List <Model.article_albums> ls = new List <Model.article_albums>(); for (int i = 0; i < albumArr.Length; i++) { string[] imgArr = albumArr[i].Split('|'); int img_id = Utils.StrToInt(imgArr[0], 0); if (imgArr.Length == 3) { if (!string.IsNullOrEmpty(remarkArr[i])) { ls.Add(new Model.article_albums { id = img_id, article_id = _id, original_path = imgArr[1], thumb_path = imgArr[2], remark = remarkArr[i] }); } else { ls.Add(new Model.article_albums { id = img_id, article_id = _id, original_path = imgArr[1], thumb_path = imgArr[2] }); } } } model.albums = ls; } #endregion #region 保存附件==================== if (model.attach != null) { model.attach.Clear(); } string[] attachIdArr = Request.Form.GetValues("hid_attach_id"); string[] attachFileNameArr = Request.Form.GetValues("hid_attach_filename"); string[] attachFilePathArr = Request.Form.GetValues("hid_attach_filepath"); string[] attachFileSizeArr = Request.Form.GetValues("hid_attach_filesize"); string[] attachPointArr = Request.Form.GetValues("txt_attach_point"); if (attachIdArr != null && attachFileNameArr != null && attachFilePathArr != null && attachFileSizeArr != null && attachPointArr != null && attachIdArr.Length > 0 && attachFileNameArr.Length > 0 && attachFilePathArr.Length > 0 && attachFileSizeArr.Length > 0 && attachPointArr.Length > 0) { List <Model.article_attach> ls = new List <Model.article_attach>(); for (int i = 0; i < attachFileNameArr.Length; i++) { int attachId = Utils.StrToInt(attachIdArr[i], 0); int fileSize = Utils.StrToInt(attachFileSizeArr[i], 0); string fileExt = Utils.GetFileExt(attachFilePathArr[i]); int _point = Utils.StrToInt(attachPointArr[i], 0); ls.Add(new Model.article_attach { id = attachId, article_id = _id, file_name = attachFileNameArr[i], file_path = attachFilePathArr[i], file_size = fileSize, file_ext = fileExt, point = _point, }); } model.attach = ls; } #endregion if (bll.Update(model)) { AddAdminLog(DTEnums.ActionEnum.Edit.ToString(), "修改" + this.channel_name + "频道内容:" + model.title); //记录日志 result = true; } return(result); }
private bool DoAdd() { bool result = true; Model.article_goods model = new Model.article_goods(); BLL.article bll = new BLL.article(); model.channel_id = this.channel_id; model.title = txtTitle.Text.Trim(); model.category_id = Utils.StrToInt(ddlCategoryId.SelectedValue, 0); model.goods_no = txtY.Text; model.sell_price = Utils.StrToDecimal(txtMarketPrice.Text, 0); //model.sell_price = decimal.Parse(txtSellPrice.Text); model.point = Utils.StrToInt(txtPoint.Text, 0); model.img_url = focus_photo.Value; model.content = txtContent.Value; model.seo_title = txtSeoTitle.Text.Trim(); model.seo_keywords = txtSeoKeywords.Text.Trim(); model.seo_description = txtSeoDescription.Text.Trim(); //model.sort_id = Utils.StrToInt(txtSortId.Text.Trim()); //model.click = Utils.StrToInt(txtClick.Text.Trim()); model.digg_good = Utils.StrToInt(txtDiggGood.Text.Trim(), 0); //model.digg_bad = Utils.StrToInt(txtDiggBad.Text.Trim()); if (string.IsNullOrEmpty(txtTime.Text)) { model.add_time = DateTime.Now; } else { model.add_time = DateTime.Parse(txtTime.Text); } model.is_msg = 0; model.is_top = 0; model.is_red = 0; model.is_hot = 0; model.is_slide = 0; model.is_lock = 0; model.lianxiren = txtuser.Text; model.is_top = Utils.StrToInt(cblItem.SelectedValue, 0); //if (cblItem.Items[0].Selected == true) //{ // model.is_msg = 1; //} //if (cblItem.Items[2].Selected == true) //{ // model.is_red = 1; //} //if (cblItem.Items[3].Selected == true) //{ // model.is_hot = 1; //} //if (cblItem.Items[4].Selected == true) //{ // model.is_slide = 1; //} //if (cblItem.Items[5].Selected == true) //{ // model.is_lock = 1; //} //會員組價格 List <Model.goods_group_price> priceList = new List <Model.goods_group_price>(); for (int i = 0; i < rptPrice.Items.Count; i++) { int _groupid = Convert.ToInt32(((HiddenField)rptPrice.Items[i].FindControl("hideGroupId")).Value); decimal _price = Convert.ToDecimal(((TextBox)rptPrice.Items[i].FindControl("txtGroupPrice")).Text.Trim()); priceList.Add(new Model.goods_group_price { group_id = _groupid, price = _price }); } model.goods_group_prices = priceList; //儲存相冊 string[] albumArr = Request.Form.GetValues("hide_photo_name"); string[] remarkArr = Request.Form.GetValues("hide_photo_remark"); if (albumArr != null && albumArr.Length > 0) { List <Model.article_albums> ls = new List <Model.article_albums>(); for (int i = 0; i < albumArr.Length; i++) { string[] imgArr = albumArr[i].Split('|'); if (imgArr.Length == 3) { if (!string.IsNullOrEmpty(remarkArr[i])) { ls.Add(new Model.article_albums { big_img = imgArr[1], small_img = imgArr[2], remark = remarkArr[i] }); } else { ls.Add(new Model.article_albums { big_img = imgArr[1], small_img = imgArr[2] }); } } } model.albums = ls; } //擴展屬性 BLL.attributes bll2 = new BLL.attributes(); DataSet ds2 = bll2.GetList("channel_id=" + this.channel_id); List <Model.attribute_value> attrls = new List <Model.attribute_value>(); foreach (DataRow dr in ds2.Tables[0].Rows) { int attr_id = Utils.StrToInt(dr["id"].ToString(), 0); string attr_title = dr["title"].ToString(); string attr_value = Request.Form["content_" + attr_id]; if (!string.IsNullOrEmpty(attr_value)) { attrls.Add(new Model.attribute_value { attribute_id = attr_id, title = attr_title, content = attr_value }); } } model.attribute_values = attrls; model.Postid = CheckBoxList1.SelectedValue; model.Type = Utils.StrToInt(cblItem.SelectedValue, 0); model.AddType = 0; //model.Status = 1; #region 宴會廳參數 model.link_url = txtZhuoShu.Text.Trim(); //桌數 model.fuwuxiangju = txtSize.Text; //尺寸 model.stock_quantity = chkKitchen.Checked == true ? 1 : 0; //廚房 model.fangshi = chkStage.Checked == true ? 1 : 0; //舞台 model.quyu = chkSound.Checked == true ? 1 : 0; //音響 model.jiaqianQJ = chkScreen.Checked == true ? 1 : 0; //投螢幕; model.shangpinType = ddlForm.Text.Trim(); //形式 #endregion model.mianji = Utils.StrToInt(txtMianJi.Text, 0); if (!string.IsNullOrEmpty(ddlhuxing.SelectedValue)) { model.huxing = Utils.StrToInt(ddlhuxing.SelectedValue, 0); } if (!string.IsNullOrEmpty(ddlditie.SelectedValue)) { model.xianlu = Utils.StrToInt(ddlditie.SelectedValue, 0); } model.yajin = string.IsNullOrEmpty(txtyajin.Text) ? 0 : Utils.StrToInt(txtyajin.Text, 0); model.zuoxiang = txtzuoxiang.Text; model.louceng = txtlouceng.Text; model.xingneng = txtxingneng.Text; model.yongtu = txtSinglePrice.Text; model.chewei = chkPort.Checked == true ? "有" : "無"; model.shequ = txtshequ.Text; model.dizhi = txtdizhi.Text; model.gongsi = txtgongsi.Text; model.dianhua = txtdianhua.Text; model.Areaid = Utils.StrToInt(ddlAreaid.SelectedValue, 0); //if (!bll.Update(model)) //{ // result = false; //} model.Status = xiajiacheck.Checked == true ? 0 : 1; if (bll.Add(model) < 1) { result = false; } return(result); }
private void RptBind(int _channel_id, int _category_id, string _strWhere, string _orderby) { Model.wx_userweixin weixin = GetWeiXinCode(); this.page = MXRequest.GetQueryInt("page", 1); if (this.category_id > 0) { this.ddlCategoryId.SelectedValue = _category_id.ToString(); } this.ddlProperty.SelectedValue = this.property; this.txtKeywords.Text = this.keywords; //图表或列表显示 BLL.article bll = new BLL.article(); DataSet artDs = bll.GetWCodeList(weixin.id, _channel_id, _category_id, this.pageSize, this.page, _strWhere, _orderby, out this.totalCount); //url链接地址处理 if (artDs != null && artDs.Tables.Count > 0 && artDs.Tables[0].Rows.Count > 0) { DataRow dr; int count = artDs.Tables[0].Rows.Count; for (int i = 0; i < count; i++) { dr = artDs.Tables[0].Rows[i]; string linkUrl = MyCommFun.ObjToStr(dr["link_url"]); if (linkUrl.Length > 0) { //外链地址 dr["link_url"] = "<span class=\"lianjie_wai\">[外]</span>" + " <a href=\"javascript:;\">" + linkUrl + "</a>"; } else { dr["link_url"] = "<span class=\"lianjie_ben\">[本]</span>" + " <a href=\"javascript:;\">" + MyCommFun.getWebSite() + "/detail.aspx?wid=" + MyCommFun.ObjToStr(dr["wid"]) + "&aid=" + dr["id"] + "</a>"; } } artDs.AcceptChanges(); } switch (this.prolistview) { case "Img": this.rptList1.Visible = false; this.rptList2.DataSource = artDs; this.rptList2.DataBind(); Utils.WriteCookie("wx_article_list_view", "Img", 14400); break; default: this.rptList2.Visible = false; this.rptList1.DataSource = artDs; this.rptList1.DataBind(); Utils.WriteCookie("wx_article_list_view", "Txt", 14400); break; } //绑定页码 txtPageNum.Text = this.pageSize.ToString(); string pageUrl = Utils.CombUrlTxt("wx_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__"); PageContent.InnerHtml = Utils.OutPageList(this.pageSize, this.page, this.totalCount, pageUrl, 8); }
private void ShowInfo(int _id) { BLL.article bll = new BLL.article(); Model.article_goods model = bll.GetGoodsModel(_id); #region 宴會廳參數 CataID = model.category_id; txtZhuoShu.Text = model.link_url; //桌數 txtSize.Text = model.fuwuxiangju; //尺寸 chkKitchen.Checked = false; if (model.stock_quantity == 1) { chkKitchen.Checked = true; //廚房 } chkStage.Checked = false; if (model.fangshi == 1) { chkStage.Checked = true; //舞台 } chkSound.Checked = false; if (model.quyu == 1) { chkSound.Checked = true; //音響 } chkScreen.Checked = false; if (model.jiaqianQJ == 1) { chkScreen.Checked = true; //投螢幕 } if (!string.IsNullOrEmpty(model.shangpinType)) { ddlForm.Text = model.shangpinType.ToString(); //形式 } #endregion ddlCategoryId.SelectedValue = model.category_id.ToString(); txtTitle.Text = model.title; txtY.Text = model.goods_no; //txtStockQuantity.Text = model.stock_quantity.ToString(); txtMarketPrice.Text = model.sell_price.ToString(); //txtSellPrice.Text = model.sell_price.ToString(); txtPoint.Text = model.point.ToString(); //txtLinkUrl.Text = model.link_url; txtTime.Text = model.add_time.ToString(); txtuser.Text = model.lianxiren; // txtshangpintype.Text = model.shangpinType; if (model.is_msg == 1) { cblItem.Items[0].Selected = true; } if (model.is_top == 1) { cblItem.Items[1].Selected = true; } if (model.is_red == 1) { cblItem.Items[2].Selected = true; } if (model.is_hot == 1) { cblItem.Items[3].Selected = true; } if (model.is_slide == 1) { cblItem.Items[4].Selected = true; } if (model.is_lock == 1) { cblItem.Items[5].Selected = true; } //txtSortId.Text = model.sort_id.ToString(); //txtClick.Text = model.click.ToString(); txtDiggGood.Text = model.digg_good.ToString(); //txtDiggBad.Text = model.digg_bad.ToString(); txtContent.Value = model.content; txtSeoTitle.Text = model.seo_title; txtSeoKeywords.Text = model.seo_keywords; txtSeoDescription.Text = model.seo_description; //賦值用戶組價格 if (model.goods_group_prices != null) { for (int i = 0; i < this.rptPrice.Items.Count; i++) { int hideId = Convert.ToInt32(((HiddenField)this.rptPrice.Items[i].FindControl("hideGroupId")).Value); foreach (Model.goods_group_price modelt in model.goods_group_prices) { if (hideId == modelt.group_id) { ((HiddenField)this.rptPrice.Items[i].FindControl("hidePriceId")).Value = modelt.id.ToString(); ((TextBox)this.rptPrice.Items[i].FindControl("txtGroupPrice")).Text = modelt.price.ToString(); } } } } //賦值上傳的相冊 focus_photo.Value = model.img_url; //封面圖片 LitAlbumList.Text = GetAlbumHtml(model.albums, model.img_url); //賦值屬性清單 LitAttributeList.Text = GetAttributeHtml(model.attribute_values, this.channel_id, _id); cblItem.SelectedValue = model.Type.ToString(); CheckBoxList1.SelectedValue = model.Postid; //ddlquyu.SelectedValue = model.quyu.ToString(); //ddljiaqian.SelectedValue = model.jiaqianQJ.ToString(); txtMianJi.Text = model.mianji.ToString(); ddlhuxing.SelectedValue = model.huxing.ToString(); //ddlfangshi.SelectedValue = model.fangshi.ToString(); ddlditie.SelectedValue = model.xianlu.ToString(); txtyajin.Text = model.yajin.ToString(); txtzuoxiang.Text = model.zuoxiang; txtlouceng.Text = model.louceng; txtxingneng.Text = model.xingneng; txtSinglePrice.Text = model.yongtu; chkPort.Checked = model.chewei == "有" ? true : false; txtshequ.Text = model.shequ; txtdizhi.Text = model.dizhi; txtgongsi.Text = model.gongsi; //txtfuwxiangmu.Text = model.fuwuxiangju; txtdianhua.Text = model.dianhua; ddlAreaid.SelectedValue = model.Areaid.ToString(); xiajiacheck.Checked = model.Status == 1 ? false : true; xiajiatext.Value = model.xiajialiyou; }
//#region 绑定会员组=============================== //private void GroupBind(string strWhere) //{ // //检查网站是否开启会员功能 // if (siteConfig.memberstatus == 0) // { // return; // } // //检查该频道是否开启会员组价格 // Model.channel model = new BLL.channel().GetModel(this.channel_id); // if (model == null || model.is_group_price == 0) // { // return; // } // BLL.user_groups bll = new BLL.user_groups(); // DataSet ds = bll.GetList(0, strWhere, "grade asc,id desc"); // if (ds.Tables[0].Rows.Count > 0) // { // this.rptPrice.DataSource = ds; // this.rptPrice.DataBind(); // } //} //#endregion //#region 扩展字段赋值============================= //private Dictionary<string, string> SetFieldValues() //{ // DataTable dt = new BLL.article_attribute_field().GetList( "").Tables[0]; // Dictionary<string, string> dic = new Dictionary<string, string>(); // foreach (DataRow dr in dt.Rows) // { // //查找相应的控件 // switch (dr["control_type"].ToString()) // { // case "single-text": //单行文本 // TextBox txtControl = FindControl("field_control_" + dr["name"].ToString()) as TextBox; // if (txtControl != null) // { // dic.Add(dr["name"].ToString(), txtControl.Text.Trim()); // } // break; // case "multi-text": //多行文本 // goto case "single-text"; // case "editor": //编辑器 // HtmlTextArea htmlTextAreaControl = FindControl("field_control_" + dr["name"].ToString()) as HtmlTextArea; // if (htmlTextAreaControl != null) // { // dic.Add(dr["name"].ToString(), htmlTextAreaControl.Value); // } // break; // case "images": //图片上传 // goto case "single-text"; // case "number": //数字 // goto case "single-text"; // case "checkbox": //复选框 // CheckBox cbControl = FindControl("field_control_" + dr["name"].ToString()) as CheckBox; // if (cbControl != null) // { // if (cbControl.Checked == true) // { // dic.Add(dr["name"].ToString(), "1"); // } // else // { // dic.Add(dr["name"].ToString(), "0"); // } // } // break; // case "multi-radio": //多项单选 // RadioButtonList rblControl = FindControl("field_control_" + dr["name"].ToString()) as RadioButtonList; // if (rblControl != null) // { // dic.Add(dr["name"].ToString(), rblControl.SelectedValue); // } // break; // case "multi-checkbox": //多项多选 // CheckBoxList cblControl = FindControl("field_control_" + dr["name"].ToString()) as CheckBoxList; // if (cblControl != null) // { // StringBuilder tempStr = new StringBuilder(); // for (int i = 0; i < cblControl.Items.Count; i++) // { // if (cblControl.Items[i].Selected) // { // tempStr.Append(cblControl.Items[i].Value.Replace(',', ',') + ","); // } // } // dic.Add(dr["name"].ToString(), Utils.DelLastComma(tempStr.ToString())); // } // break; // } // } // return dic; //} //#endregion #region 增加操作================================= private bool DoAdd() { // Model.wx_userweixin weixin = GetWeiXinCode(); bool result = false; Model.article model = new Model.article(); BLL.article bll = new BLL.article(); //model.channel_id = 0; model.category_id = Utils.StrToInt(ddlCategoryId.SelectedValue, 0); model.call_index = txtCallIndex.Text.Trim(); model.title = txtTitle.Text.Trim(); model.link_url = txtLinkUrl.Text.Trim(); model.img_url = txtImgUrl.Text; model.seo_title = txtSeoTitle.Text.Trim(); model.seo_keywords = txtSeoKeywords.Text.Trim(); model.seo_description = txtSeoDescription.Text.Trim(); //model.wid = 0; //内容摘要提取内容前255个字符 if (string.IsNullOrEmpty(txtZhaiyao.Text.Trim())) { model.zhaiyao = Utils.DropHTML(txtContent.Value, 255); } else { model.zhaiyao = Utils.DropHTML(txtZhaiyao.Text, 255); } model.content = txtContent.Value; model.sort_id = Utils.StrToInt(txtSortId.Text.Trim(), 99); model.click = int.Parse(txtClick.Text.Trim()); model.status = Utils.StrToInt(rblStatus.SelectedValue, 0); model.is_msg = 0; model.is_top = 0; model.is_red = 0; model.is_hot = 0; model.is_slide = 0; if (cblItem.Items[0].Selected == true) { model.is_msg = 1; } if (cblItem.Items[1].Selected == true) { model.is_top = 1; } if (cblItem.Items[2].Selected == true) { model.is_red = 1; } if (cblItem.Items[3].Selected == true) { model.is_hot = 1; } if (cblItem.Items[4].Selected == true) { model.is_slide = 1; } model.is_sys = 1; //管理员发布 model.user_name = "admin"; //获得当前登录用户名 model.add_time = Utils.StrToDateTime(txtAddTime.Text.Trim()); // model.fields = SetFieldValues(); //扩展字段赋值 #region 保存相册==================== //检查是否有自定义图片 if (txtImgUrl.Text.Trim() == "") { model.img_url = hidFocusPhoto.Value; } string[] albumArr = Request.Form.GetValues("hid_photo_name"); string[] remarkArr = Request.Form.GetValues("hid_photo_remark"); if (albumArr != null && albumArr.Length > 0) { List <Model.article_albums> ls = new List <Model.article_albums>(); for (int i = 0; i < albumArr.Length; i++) { string[] imgArr = albumArr[i].Split('|'); if (imgArr.Length == 3) { if (!string.IsNullOrEmpty(remarkArr[i])) { ls.Add(new Model.article_albums { original_path = imgArr[1], thumb_path = imgArr[2], remark = remarkArr[i] }); } else { ls.Add(new Model.article_albums { original_path = imgArr[1], thumb_path = imgArr[2] }); } } } model.albums = ls; } #endregion #region 保存附件==================== //保存附件 string[] attachFileNameArr = Request.Form.GetValues("hid_attach_filename"); string[] attachFilePathArr = Request.Form.GetValues("hid_attach_filepath"); string[] attachFileSizeArr = Request.Form.GetValues("hid_attach_filesize"); string[] attachPointArr = Request.Form.GetValues("txt_attach_point"); if (attachFileNameArr != null && attachFilePathArr != null && attachFileSizeArr != null && attachPointArr != null && attachFileNameArr.Length > 0 && attachFilePathArr.Length > 0 && attachFileSizeArr.Length > 0 && attachPointArr.Length > 0) { List <Model.article_attach> ls = new List <Model.article_attach>(); for (int i = 0; i < attachFileNameArr.Length; i++) { int fileSize = Utils.StrToInt(attachFileSizeArr[i], 0); string fileExt = Utils.GetFileExt(attachFilePathArr[i]); int _point = Utils.StrToInt(attachPointArr[i], 0); ls.Add(new Model.article_attach { file_name = attachFileNameArr[i], file_path = attachFilePathArr[i], file_size = fileSize, file_ext = fileExt, point = _point }); } model.attach = ls; } #endregion //#region 保存会员组价格============== //List<Model.user_group_price> priceList = new List<Model.user_group_price>(); //for (int i = 0; i < rptPrice.Items.Count; i++) //{ // int _groupid = Convert.ToInt32(((HiddenField)rptPrice.Items[i].FindControl("hideGroupId")).Value); // decimal _price = Convert.ToDecimal(((TextBox)rptPrice.Items[i].FindControl("txtGroupPrice")).Text.Trim()); // priceList.Add(new Model.user_group_price { group_id = _groupid, price = _price }); //} //model.group_price = priceList; //#endregion if (bll.Add(model) > 0) { //开始生成缩略图咯 AddAdminLog(MXEnums.ActionEnum.Add.ToString(), "添加article_list频道内容:" + model.title); //记录日志 result = true; } return(result); }