private void RptBind(string strWhere) { BLL.photo_attribute bll = new BLL.photo_attribute(); DataSet ds = bll.GetList(strWhere); this.rptList.DataSource = ds; this.rptList.DataBind(); }
private void RptBind(string strWhere) { BLL.photo_attribute bll = new BLL.photo_attribute(); DataSet ds = bll.GetList(strWhere); this.rptList.DataSource = ds; this.rptList.DataBind(); }
private string GetAttributeHtml(List <Model.photo_attribute_value> models, int _channel_id, int _photo_id) { StringBuilder strTxt = new StringBuilder(); BLL.photo_attribute bll = new BLL.photo_attribute(); 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.photo_attribute_value modelt in models) { if (modelt.attribute_id == Convert.ToInt32(dr["id"]) && modelt.photo_id == _photo_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; DTcms.BLL.photo bll = new BLL.photo(); DTcms.Model.photo model = bll.GetModel(_id); model.channel_id = this.channel_id; model.title = txtTitle.Text.Trim(); model.category_id = int.Parse(ddlCategoryId.SelectedValue); model.photo_no = txtPhotoNo.Text.Trim(); model.market_price = decimal.Parse(txtMarketPrice.Text.Trim()); model.sell_price = decimal.Parse(txtSellPrice.Text.Trim()); 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.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.photo_albums != null) { model.photo_albums.Clear(); } string[] albumArr = Request.Form.GetValues("hide_photo_name"); if (albumArr != null) { List <Model.photo_album> ls = new List <Model.photo_album>(); for (int i = 0; i < albumArr.Length; i++) { string[] imgArr = albumArr[i].Split('|'); int img_id = int.Parse(imgArr[0]); if (imgArr.Length == 3) { ls.Add(new Model.photo_album { id = img_id, photo_id = _id, big_img = imgArr[1], small_img = imgArr[2] }); } } model.photo_albums = ls; } //扩展属性 BLL.photo_attribute bll2 = new BLL.photo_attribute(); DataSet ds2 = bll2.GetList("channel_id=" + this.channel_id); List <Model.photo_attribute_value> attrls = new List <Model.photo_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.photo_attribute_value { id = Convert.ToInt32(attr_value_id), photo_id = _id, attribute_id = attr_id, title = attr_title, content = attr_value_content }); } } model.photo_attribute_values = attrls; if (!bll.Update(model)) { result = false; } return(result); }
private bool DoAdd() { bool result = true; DTcms.Model.photo model = new Model.photo(); DTcms.BLL.photo bll = new BLL.photo(); model.channel_id = this.channel_id; model.title = txtTitle.Text.Trim(); model.category_id = int.Parse(ddlCategoryId.SelectedValue); model.photo_no = txtPhotoNo.Text.Trim(); model.market_price = decimal.Parse(txtMarketPrice.Text.Trim()); model.sell_price = decimal.Parse(txtSellPrice.Text.Trim()); 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.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; } //保存相册 string[] albumArr = Request.Form.GetValues("hide_photo_name"); if (albumArr != null && albumArr.Length > 0) { List<Model.photo_album> ls = new List<Model.photo_album>(); for (int i = 0; i < albumArr.Length; i++) { string[] imgArr = albumArr[i].Split('|'); if (imgArr.Length == 3) { ls.Add(new Model.photo_album { big_img = imgArr[1], small_img = imgArr[2] }); } } model.photo_albums = ls; } //扩展属性 BLL.photo_attribute bll2 = new BLL.photo_attribute(); DataSet ds2 = bll2.GetList("channel_id=" + this.channel_id); List<Model.photo_attribute_value> attrls = new List<Model.photo_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 = Request.Form["content_" + attr_id]; if (!string.IsNullOrEmpty(attr_value)) { attrls.Add(new Model.photo_attribute_value { attribute_id = attr_id, title = attr_title, content = attr_value }); } } model.photo_attribute_values = attrls; if (bll.Add(model) < 1) { result = false; } return result; }
private string GetAttributeHtml(List<Model.photo_attribute_value> models, int _channel_id, int _photo_id) { StringBuilder strTxt = new StringBuilder(); BLL.photo_attribute bll = new BLL.photo_attribute(); 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.photo_attribute_value modelt in models) { if (modelt.attribute_id == Convert.ToInt32(dr["id"]) && modelt.photo_id == _photo_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(); }