private void RptBind(string strWhere) { BLL.attributes bll = new BLL.attributes(); DataSet ds = bll.GetList(strWhere); this.rptList.DataSource = ds; this.rptList.DataBind(); }
private void ShowInfo(int _id) { BLL.attributes bll = new BLL.attributes(); Model.attributes model = bll.GetModel(_id); txtTitle.Text = model.title; txtRemark.Text = model.remark; ddlType.SelectedValue = model.type.ToString(); txtDefaultValue.Text = model.default_value; txtSortId.Text = model.sort_id.ToString(); }
//删除扩展属性 protected void btnDelete_Click(object sender, EventArgs e) { ChkAdminLevel(channel_id, DTEnums.ActionEnum.Delete.ToString()); //检查权限 BLL.attributes bll = new BLL.attributes(); 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}", this.channel_id.ToString()), "Success"); }
private bool DoAdd() { bool result = true; Model.attributes model = new Model.attributes(); BLL.attributes bll = new BLL.attributes(); model.channel_id = this.channel_id; model.title = txtTitle.Text.Trim(); model.remark = txtRemark.Text.Trim(); model.type = int.Parse(ddlType.SelectedValue); model.default_value = txtDefaultValue.Text.Trim(); model.sort_id = int.Parse(txtSortId.Text.Trim()); if (bll.Add(model) < 1) { result = false; } return result; }
private string GetAttributeHtml(List <Model.attribute_value> models, int _channel_id, int _article_id) { StringBuilder strTxt = new StringBuilder(); BLL.attributes bll = new BLL.attributes(); DataSet ds = bll.GetList("channel_id=" + _channel_id); if (ds.Tables[0].Rows.Count > 0) { strTxt.Append("<tr><th>扩展属性:</th><td>\n"); strTxt.Append("<table border=\"0\" cellspacing=\"0\" cellpadding=\"0\" class=\"border_table\">\n"); strTxt.Append(" <tbody><col width=\"80px\"><col>\n"); foreach (DataRow dr in ds.Tables[0].Rows) { int _value_id = 0; string _value_content = ""; if (models != null) { foreach (Model.attribute_value modelt in models) { if (modelt.attribute_id == Convert.ToInt32(dr["id"]) && modelt.article_id == _article_id) { _value_id = modelt.id; _value_content = modelt.content; } } } strTxt.Append("<tr><th>" + dr["title"] + "</th><td>\n"); strTxt.Append(GetAttributeType(Convert.ToInt32(dr["id"]), dr["title"].ToString(), dr["default_value"].ToString(), Convert.ToInt32(dr["type"]), _value_id, _value_content)); strTxt.Append("</td></tr>\n"); } strTxt.Append("</tbody>\n"); strTxt.Append("</table>\n"); strTxt.Append("</td></tr>\n"); } return(strTxt.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 = 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.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; //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; //model.Postid =0; model.Type = 0; 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 = txtshequ.Text; model.dizhi = txtdizhi.Text; model.gongsi = txtgongsi.Text; model.fuwuxiangju = txtfuwxiangmu.Text; model.dianhua = txtdianhua.Text; model.lianxiren = txtuser.Text; model.shangpinType = txtshangpintype.Text; if (!bll.Update(model)) { result = false; } return(result); }
private bool DoEdit(int _id) { bool result = true; BLL.attributes bll = new BLL.attributes(); Model.attributes model = bll.GetModel(_id); model.title = txtTitle.Text.Trim(); model.remark = txtRemark.Text.Trim(); model.type = int.Parse(ddlType.SelectedValue); model.default_value = txtDefaultValue.Text.Trim(); model.sort_id = int.Parse(txtSortId.Text.Trim()); if (!bll.Update(model)) { result = false; } return result; }
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(); model.add_time = DateTime.Parse(txtTime.Text.ToString()); //檢查是否有自訂圖片 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); }
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 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); }
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; }
private string GetAttributeHtml(List<Model.attribute_value> models, int _channel_id, int _article_id) { StringBuilder strTxt = new StringBuilder(); BLL.attributes bll = new BLL.attributes(); DataSet ds = bll.GetList("channel_id=" + _channel_id); if (ds.Tables[0].Rows.Count > 0) { strTxt.Append("<tr><th>扩展属性:</th><td>\n"); strTxt.Append("<table border=\"0\" cellspacing=\"0\" cellpadding=\"0\" class=\"border_table\">\n"); strTxt.Append(" <tbody><col width=\"80px\"><col>\n"); foreach (DataRow dr in ds.Tables[0].Rows) { int _value_id = 0; string _value_content = ""; if (models != null) { foreach (Model.attribute_value modelt in models) { if (modelt.attribute_id == Convert.ToInt32(dr["id"]) && modelt.article_id == _article_id) { _value_id = modelt.id; _value_content = modelt.content; } } } strTxt.Append("<tr><th>" + dr["title"] + "</th><td>\n"); strTxt.Append(GetAttributeType(Convert.ToInt32(dr["id"]), dr["title"].ToString(), dr["default_value"].ToString(), Convert.ToInt32(dr["type"]), _value_id, _value_content)); strTxt.Append("</td></tr>\n"); } strTxt.Append("</tbody>\n"); strTxt.Append("</table>\n"); strTxt.Append("</td></tr>\n"); } return strTxt.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 = 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 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; }