List <Model.goods> IGoods.GetList(string cls_no, string keyword, string theme, string is_no_show_mall, int pageSize, int pageIndex, out int total) { var req = new Request(); var json = req.request("/goods?t=select_key", "{\"cls_no\":\"" + cls_no + "\",\"keyword\":\"" + keyword + "\",\"theme\":\"" + theme + "\",\"is_no_show_mall\":\"" + is_no_show_mall + "\",\"pageIndex\":\"" + pageIndex + "\",\"pageSize\":\"" + pageSize + "\"}"); ReadWriteContext.IReadContext read = new ReadWriteContext.ReadContextByJson(json); if (read.Read("errId") != "0") { throw new Exception(read.Read("errMsg")); } // total = Conv.ToInt(read.Read("total")); // var lst = new List <Model.goods>(); if (read.Read("datas") != "") { foreach (ReadWriteContext.IReadContext r in read.ReadList("datas")) { var item = new Model.goods(); lst.Add(item); item.goods_id = r.Read("goods_id"); item.goods_no = r.Read("goods_no"); item.goods_name = r.Read("goods_name"); item.is_show_mall = r.Read("is_show_mall"); item.status = r.Read("status"); item.cls_id = r.Read("cls_id"); item.cls_name = r.Read("cls_name"); item.themes = r.Read("themes"); } } return(lst); }
public Model.goods getItem() { var item = new Model.goods(); item.goods_id = goods_id; item.goods_no = goods基础信息设置.txt_no.Text; item.goods_name = goods基础信息设置.txt_name.Text; if (goods基础信息设置.comboBox1.SelectedValue != null) { item.cls_id = goods基础信息设置.comboBox1.SelectedValue.ToString(); } var t_is_show_mall = "0"; if (goods基础信息设置.is_show_mall.Checked) { t_is_show_mall = "1"; } item.is_show_mall = t_is_show_mall; string themes = ""; foreach (Control obj in goods基础信息设置.pnl_theme.Controls) { var chk = (CheckBox)obj; if (chk.Checked) { themes += chk.Tag.ToString() + ","; } } if (themes.Length > 0) { themes = themes.Substring(0, themes.Length - 1); } item.themes = themes; return(item); }
/// <summary> /// 增加一条数据 /// </summary> public int Add(Model.goods model) { StringBuilder strSql = new StringBuilder(); strSql.Append("insert into " + databaseprefix + "goods("); strSql.Append("parent_id,color,size,market_price,sell_price,stock_quantity,alert_quantity,goods_no,img_url,company,yu_lock,yu_day,yu_num,yu_date,guige,chang,kuan,gao,zhong)"); strSql.Append(" values ("); strSql.Append("@parent_id,@color,@size,@market_price,@sell_price,@stock_quantity,@alert_quantity,@goods_no,@img_url,@company,@yu_lock,@yu_day,@yu_num,@yu_date,@guige,@chang,@kuan,@gao,@zhong)"); strSql.Append(";select @@IDENTITY"); SqlParameter[] parameters = { new SqlParameter("@parent_id", SqlDbType.Int, 4), new SqlParameter("@color", SqlDbType.NVarChar, 56), new SqlParameter("@size", SqlDbType.NVarChar, 56), new SqlParameter("@market_price", SqlDbType.Decimal, 5), new SqlParameter("@sell_price", SqlDbType.Decimal, 5), new SqlParameter("@stock_quantity", SqlDbType.Int, 4), new SqlParameter("@alert_quantity", SqlDbType.Int, 4), new SqlParameter("@goods_no", SqlDbType.NVarChar, 50), new SqlParameter("@img_url", SqlDbType.NVarChar, 100), new SqlParameter("@company", SqlDbType.Int, 4), new SqlParameter("@yu_lock", SqlDbType.Int, 4), new SqlParameter("@yu_day", SqlDbType.Int, 4), new SqlParameter("@yu_num", SqlDbType.Int, 4), new SqlParameter("@yu_date", SqlDbType.DateTime), new SqlParameter("@guige", SqlDbType.NVarChar, 128), new SqlParameter("@chang", SqlDbType.Decimal, 5), new SqlParameter("@kuan", SqlDbType.Decimal, 5), new SqlParameter("@gao", SqlDbType.Decimal, 5), new SqlParameter("@zhong", SqlDbType.Decimal, 5), }; parameters[0].Value = model.parent_id; parameters[1].Value = model.color; parameters[2].Value = model.size; parameters[3].Value = model.market_price; parameters[4].Value = model.sell_price; parameters[5].Value = model.stock_quantity; parameters[6].Value = model.alert_quantity; parameters[7].Value = model.goods_no; parameters[8].Value = model.img_url; parameters[9].Value = model.company; parameters[10].Value = model.yu_lock; parameters[11].Value = model.yu_day; parameters[12].Value = model.yu_num; parameters[13].Value = model.yu_date; parameters[14].Value = model.guige; parameters[15].Value = model.chang; parameters[16].Value = model.kuan; parameters[17].Value = model.gao; parameters[18].Value = model.zhong; object obj = DbHelperSQL.GetSingle(strSql.ToString(), parameters); if (obj == null) { return(0); } else { return(Convert.ToInt32(obj)); } }
/// <summary> /// 得到一个对象实体 /// </summary> public Model.goods GetModel(int id) { StringBuilder strSql = new StringBuilder(); strSql.Append("select top 1 * from " + databaseprefix + "goods "); strSql.Append(" where id=@id"); SqlParameter[] parameters = { new SqlParameter("@id", SqlDbType.Int, 4) }; parameters[0].Value = id; Model.goods model = new Model.goods(); DataSet ds = DbHelperSQL.Query(strSql.ToString(), parameters); if (ds.Tables[0].Rows.Count > 0) { if (ds.Tables[0].Rows[0]["id"].ToString() != "") { model.id = int.Parse(ds.Tables[0].Rows[0]["id"].ToString()); } if (ds.Tables[0].Rows[0]["parent_id"].ToString() != "") { model.parent_id = int.Parse(ds.Tables[0].Rows[0]["parent_id"].ToString()); } model.color = ds.Tables[0].Rows[0]["color"].ToString(); model.size = ds.Tables[0].Rows[0]["size"].ToString(); if (ds.Tables[0].Rows[0]["market_price"].ToString() != "") { model.market_price = decimal.Parse(ds.Tables[0].Rows[0]["market_price"].ToString()); } if (ds.Tables[0].Rows[0]["sell_price"].ToString() != "") { model.sell_price = decimal.Parse(ds.Tables[0].Rows[0]["sell_price"].ToString()); } if (ds.Tables[0].Rows[0]["stock_quantity"].ToString() != "") { model.stock_quantity = int.Parse(ds.Tables[0].Rows[0]["stock_quantity"].ToString()); } if (ds.Tables[0].Rows[0]["alert_quantity"].ToString() != "") { model.alert_quantity = int.Parse(ds.Tables[0].Rows[0]["alert_quantity"].ToString()); } model.goods_no = ds.Tables[0].Rows[0]["goods_no"].ToString(); model.img_url = ds.Tables[0].Rows[0]["img_url"].ToString(); if (ds.Tables[0].Rows[0]["company"].ToString() != "") { model.company = int.Parse(ds.Tables[0].Rows[0]["company"].ToString()); } if (ds.Tables[0].Rows[0]["yu_lock"].ToString() != "") { model.yu_lock = int.Parse(ds.Tables[0].Rows[0]["yu_lock"].ToString()); } if (ds.Tables[0].Rows[0]["yu_day"].ToString() != "") { model.yu_day = int.Parse(ds.Tables[0].Rows[0]["yu_day"].ToString()); } if (ds.Tables[0].Rows[0]["yu_num"].ToString() != "") { model.yu_num = int.Parse(ds.Tables[0].Rows[0]["yu_num"].ToString()); } if (ds.Tables[0].Rows[0]["yu_date"].ToString() != "") { model.yu_date = DateTime.Parse(ds.Tables[0].Rows[0]["yu_date"].ToString()); } model.guige = ds.Tables[0].Rows[0]["guige"].ToString(); if (ds.Tables[0].Rows[0]["chang"].ToString() != "") { model.chang = Decimal.Parse(ds.Tables[0].Rows[0]["chang"].ToString()); } if (ds.Tables[0].Rows[0]["kuan"].ToString() != "") { model.kuan = Decimal.Parse(ds.Tables[0].Rows[0]["kuan"].ToString()); } if (ds.Tables[0].Rows[0]["gao"].ToString() != "") { model.gao = Decimal.Parse(ds.Tables[0].Rows[0]["gao"].ToString()); } if (ds.Tables[0].Rows[0]["zhong"].ToString() != "") { model.zhong = Decimal.Parse(ds.Tables[0].Rows[0]["zhong"].ToString()); } return(model); } else { return(null); } }
/// <summary> /// 更新一条数据 /// </summary> public bool Update(Model.goods model) { StringBuilder strSql = new StringBuilder(); strSql.Append("update " + databaseprefix + "goods set "); strSql.Append("parent_id=@parent_id,"); strSql.Append("color=@color,"); strSql.Append("size=@size,"); strSql.Append("market_price=@market_price,"); strSql.Append("sell_price=@sell_price,"); strSql.Append("stock_quantity=@stock_quantity,"); strSql.Append("alert_quantity=@alert_quantity,"); strSql.Append("goods_no=@goods_no,"); strSql.Append("img_url=@img_url,"); strSql.Append("yu_lock=@yu_lock,"); strSql.Append("yu_day=@yu_day,"); strSql.Append("yu_num=@yu_num,"); strSql.Append("yu_date=@yu_date,"); strSql.Append("guige=@guige,"); strSql.Append("chang=@chang,"); strSql.Append("kuan=@kuan,"); strSql.Append("gao=@gao,"); strSql.Append("zhong=@zhong"); strSql.Append(" where id=@id"); SqlParameter[] parameters = { new SqlParameter("@parent_id", SqlDbType.Int, 4), new SqlParameter("@color", SqlDbType.NVarChar, 56), new SqlParameter("@size", SqlDbType.NVarChar, 56), new SqlParameter("@market_price", SqlDbType.Decimal, 5), new SqlParameter("@sell_price", SqlDbType.Decimal, 5), new SqlParameter("@stock_quantity", SqlDbType.Int, 4), new SqlParameter("@alert_quantity", SqlDbType.Int, 4), new SqlParameter("@goods_no", SqlDbType.NVarChar, 50), new SqlParameter("@img_url", SqlDbType.NVarChar, 100), new SqlParameter("@yu_lock", SqlDbType.Int, 4), new SqlParameter("@yu_day", SqlDbType.Int, 4), new SqlParameter("@yu_num", SqlDbType.Int, 4), new SqlParameter("@yu_date", SqlDbType.DateTime), new SqlParameter("@guige", SqlDbType.NVarChar, 128), new SqlParameter("@chang", SqlDbType.Decimal, 5), new SqlParameter("@kuan", SqlDbType.Decimal, 5), new SqlParameter("@gao", SqlDbType.Decimal, 5), new SqlParameter("@zhong", SqlDbType.Decimal, 5), new SqlParameter("@id", SqlDbType.Int, 4) }; parameters[0].Value = model.parent_id; parameters[1].Value = model.color; parameters[2].Value = model.size; parameters[3].Value = model.market_price; parameters[4].Value = model.sell_price; parameters[5].Value = model.stock_quantity; parameters[6].Value = model.alert_quantity; parameters[7].Value = model.goods_no; parameters[8].Value = model.img_url; parameters[9].Value = model.yu_lock; parameters[10].Value = model.yu_day; parameters[11].Value = model.yu_num; parameters[12].Value = model.yu_date; parameters[13].Value = model.guige; parameters[14].Value = model.chang; parameters[15].Value = model.kuan; parameters[16].Value = model.gao; parameters[17].Value = model.zhong; parameters[18].Value = model.id; int rows = DbHelperSQL.ExecuteSql(strSql.ToString(), parameters); if (rows > 0) { return(true); } else { return(false); } }
/// <summary> /// 更新一条数据 /// </summary> public bool Update(Model.goods model) { return(dal.Update(model)); }
/// <summary> /// 增加一条数据 /// </summary> public int Add(Model.goods model) { return(dal.Add(model)); }
private bool DoAdd() { bool result = false; Model.article model = new Model.article(); BLL.article bll = new BLL.article(); model.wheresql = "more"; 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.user_name = GetAdminInfo().user_name; //獲得當前登錄用戶名 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.update_time = DateTime.Now; 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; } 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 儲存會員組價格============== //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 int aid = bll.Add(model); #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 + ","); } } } #endregion if (aid > 0) { Model.goods modelgoods = new Model.goods(); modelgoods.goods_no = model.goods_no; modelgoods.img_url = model.img_url; modelgoods.parent_id = aid; 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); int newid = new BLL.goods().Add(modelgoods); if (newid > 0) { bll.UpdateField(aid, "team_id=" + newid + ""); result = true; } AddAdminLog(TWEnums.ActionEnum.Add.ToString(), "添加" + this.channel_name + "頻道內容:" + model.title); //記錄日誌 result = true; } return(result); }
/// <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 DoAdd() { bool result = true; Model.goods model = new Model.goods(); BLL.goods bll = new BLL.goods(); model.channel_id = this.channel_id; model.title = txtTitle.Text.Trim(); model.category_id = int.Parse(ddlBusiness.SelectedValue); model.link_url = ""; //检查是否有自定义图片 if (txtImgUrl.Text.Trim() != "") { model.img_url = txtImgUrl.Text; } else { model.img_url = @"/admin/images/default.png"; } model.content = txtContent.Text.Trim(); model.sell_time = String.Format("{0}:{1}-{2}:{3}", ddlTime_l1.SelectedValue, ddlTime_l2.SelectedValue, ddlTime_r1.SelectedValue, ddlTime_r2.SelectedValue); model.phone = txtPhone.Text.Trim(); model.mobilephone = txtMobile.Text.Trim(); model.city_id = int.Parse(Request.Form["ddlArea"]); model.address = txtLocation.Text.Trim(); model.lat = txtlat.Text.Trim(); model.lng = txtlng.Text.Trim() ; model.type_id = string.IsNullOrEmpty(Request.Form["ddlType"]) ? 0 : int.Parse(Request.Form["ddlType"]); //Request.Form["selectA"] model.rtype_id = 0; model.discount = string.IsNullOrEmpty(Request.Form["ddlDiscount"]) ? 0 : int.Parse(Request.Form["ddlDiscount"]); model.avg_price = decimal.Parse(txtAvgPrice.Text.Trim()); //判断 当为门票类型时,market_price为成人票价格 sell_price 为儿童票价格 if (int.Parse(ddlBusiness.SelectedValue) == (int)DTEnums.CatergoryID.season) { model.market_price = decimal.Parse(txtAdultPrice.Text); model.sell_price = decimal.Parse(txtChildPrice.Text); model.old_price = decimal.Parse(txtOldPrice.Text); } else { model.market_price = decimal.Parse(txtMarketPrice.Text); model.sell_price = 0; model.old_price = 0; } model.status = 1; //0申请 1正常 2过期 model.sort_id = int.Parse(txtSortId.Text.Trim()); model.begin_date = txtStartDate.Text.Trim(); model.end_date = txtEndDate.Text.Trim(); model.add_time = DateTime.Now; model.good_limit = 0; model.is_red = 0; model.is_slide = 0; model.is_top = 0; model.remark1 = Request.Form["ddlProvince"] + "," + Request.Form["ddlCity"] + "," + Request.Form["ddlArea"]; model.remark2 = 0; model.contact = txtContact.Text.Trim(); if (cblItem.Items[0].Selected == true) { model.is_top = 1; } if (cblItem.Items[1].Selected == true) { model.is_red = 1; } //查看权限 model.good_limit = int.Parse(rdoItem.SelectedValue); ////会员组价格 //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.goods_albums> ls = new List<Model.goods_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.goods_albums { big_img = imgArr[1], small_img = imgArr[2], remark = remarkArr[i] }); } else { ls.Add(new Model.goods_albums { big_img = imgArr[1], small_img = imgArr[2] }); } } } model.albums = ls; } if (bll.Add(model) < 1) { result = false; } return result; }
//將excel的資料寫入資料庫 private string InsertGoods(DataTable dt) { string result = ""; BLL.article_category categoryBll = new BLL.article_category(); BLL.article articleBll = new BLL.article(); BLL.goods goodsBll = new BLL.goods(); Model.article articleModel = null; Model.goods goodsModel = null; //判斷列名是否規範 string[] strColumn = { "類別*", "品牌", "商品型號*", "商品名稱", "隊伍", "顏色*", "尺寸*", "數量量*", "市價", "售價", "商品描述", "商品說明", "注意事項", "商品分類1", "商品分類2", "商品分類3", "關鍵字", "上架日期", "下架日期", "每人限購數量*", "前臺排序", "重量", "長", "寬", "高", "紅利" }; int num = 0; for (int i = 0; i < dt.Columns.Count; i++) { foreach (string str in strColumn) { if (str == dt.Columns[i].ColumnName) { num++; } } } if (num == strColumn.Length) { //遍歷主件 DataRow[] drArr = dt.Select("[類別*]='商品主件'"); foreach (DataRow dr in drArr) { if (dr[0].ToString().Trim() != "") { bool updatea = true; DataSet ds = Tea.DBUtility.DbHelperSQL.Query("select * from shop_article where goods_no='" + dr[2].ToString().Trim() + "'"); if (ds.Tables[0].Rows.Count > 0) { articleModel = articleBll.GetModel(int.Parse(ds.Tables[0].Rows[0]["id"].ToString())); } if (articleModel == null) { articleModel = new Model.article(); updatea = false; } articleModel.channel_id = 2; if (string.IsNullOrEmpty(dr[13].ToString())) { articleModel.category_id = 0; } else { articleModel.category_id = int.Parse(dr[13].ToString());// categoryBll.GetID(dr[13].ToString().Split(',')[0]); } //articleModel.more_type = dr[15].ToString(); articleModel.call_index = ""; articleModel.title = dr[3].ToString(); articleModel.link_url = ""; if (string.IsNullOrEmpty(dr[1].ToString())) { //articleModel.brand_id = 0; } else { //articleModel.brand_id = brandBll.GetID(dr[1].ToString()); } if (string.IsNullOrEmpty(dr[4].ToString())) { // articleModel.team_id = 0; } else { //articleModel.team_id = teamBll.GetID(dr[4].ToString()); } articleModel.img_url = ""; articleModel.seo_title = ""; articleModel.seo_keywords = dr[16].ToString(); articleModel.seo_description = ""; articleModel.zhaiyao = ""; articleModel.content = "";// dr[10].ToString(); articleModel.sort_id = Utils.ObjToInt(dr[20], 999); articleModel.click = 0; articleModel.status = 1; articleModel.is_msg = 0; articleModel.is_tui = 0; articleModel.is_can = 0; articleModel.is_zhe = 0; articleModel.is_slide = 0; articleModel.is_sys = 1; //管理員發佈 articleModel.user_name = "admin"; //獲得當前登入用戶名 articleModel.add_time = DateTime.Now; //articleModel.sales_id = 0; int pid = 0; if (updatea) { articleBll.Update(articleModel); pid = articleModel.id; } else { pid = articleBll.Add(articleModel); } //匯入子件 DataRow[] drArr1 = dt.Select("[類別*]='子件' and [商品型號*] like '" + dr[2].ToString() + "%'"); foreach (DataRow dr1 in drArr1) { bool updateg = true; DataSet dsg = Tea.DBUtility.DbHelperSQL.Query("select * from shop_goods where goods_no='" + dr1[2].ToString().Trim() + "'"); if (dsg.Tables[0].Rows.Count > 0) { goodsModel = goodsBll.GetModel(int.Parse(dsg.Tables[0].Rows[0]["id"].ToString())); } if (goodsModel == null) { goodsModel = new Model.goods(); updateg = false; } goodsModel.parent_id = pid; goodsModel.color = dr1[5].ToString(); goodsModel.size = dr1[6].ToString(); goodsModel.goods_no = dr1[2].ToString(); if (dr1[8].ToString().Trim() != "") { goodsModel.market_price = Utils.ObjToDecimal(dr1[8], 0M); } else { goodsModel.market_price = Utils.ObjToDecimal(dr[8], 0M); } if (dr1[9].ToString().Trim() != "") { goodsModel.sell_price = Utils.ObjToDecimal(dr1[9], 0M); } else { goodsModel.sell_price = Utils.ObjToDecimal(dr[9], 0M); } if (dr1[7].ToString().Trim() != "") { goodsModel.stock_quantity = Utils.ObjToInt(dr1[7], 0); } else { goodsModel.stock_quantity = Utils.ObjToInt(dr[7], 0); } goodsModel.alert_quantity = 0; goodsModel.img_url = ""; if (goodsModel.goods_no.Trim().Length > 4) { if (updateg) { goodsBll.Update(goodsModel); } else { goodsBll.Add(goodsModel); } } } } } } else { result = "請檢查excel檔案格式!" + num + strColumn.Length; } return(result); }
/// <summary> /// 获取实体 /// </summary> public Model.goods GetGoodsModel(int id) { StringBuilder strSql = new StringBuilder(); strSql.Append("select top 1 * from dt_goods "); strSql.Append(" where id=@id "); SqlParameter[] parameters = { new SqlParameter("@id", SqlDbType.Int, 4) }; parameters[0].Value = id; Model.goods model = new Model.goods(); DataSet ds = DbHelperSQL.Query(strSql.ToString(), parameters); if (ds.Tables[0].Rows.Count > 0) { #region DATA if (ds.Tables[0].Rows[0]["id"] != null && ds.Tables[0].Rows[0]["id"].ToString() != "") { model.id = int.Parse(ds.Tables[0].Rows[0]["id"].ToString()); } if (ds.Tables[0].Rows[0]["channel_id"] != null && ds.Tables[0].Rows[0]["channel_id"].ToString() != "") { model.channel_id = int.Parse(ds.Tables[0].Rows[0]["channel_id"].ToString()); } if (ds.Tables[0].Rows[0]["category_id"] != null && ds.Tables[0].Rows[0]["category_id"].ToString() != "") { model.category_id = int.Parse(ds.Tables[0].Rows[0]["category_id"].ToString()); } if (ds.Tables[0].Rows[0]["title"] != null && ds.Tables[0].Rows[0]["title"].ToString() != "") { model.title = ds.Tables[0].Rows[0]["title"].ToString(); } if (ds.Tables[0].Rows[0]["link_url"] != null && ds.Tables[0].Rows[0]["link_url"].ToString() != "") { model.link_url = ds.Tables[0].Rows[0]["link_url"].ToString(); } if (ds.Tables[0].Rows[0]["img_url"] != null && ds.Tables[0].Rows[0]["img_url"].ToString() != "") { model.img_url = ds.Tables[0].Rows[0]["img_url"].ToString(); } if (ds.Tables[0].Rows[0]["contact"] != null && ds.Tables[0].Rows[0]["contact"].ToString() != "") { model.contact = ds.Tables[0].Rows[0]["contact"].ToString(); } if (ds.Tables[0].Rows[0]["content"] != null && ds.Tables[0].Rows[0]["content"].ToString() != "") { model.content = ds.Tables[0].Rows[0]["content"].ToString(); } if (ds.Tables[0].Rows[0]["sell_time"] != null && ds.Tables[0].Rows[0]["sell_time"].ToString() != "") { model.sell_time = ds.Tables[0].Rows[0]["sell_time"].ToString(); } if (ds.Tables[0].Rows[0]["phone"] != null && ds.Tables[0].Rows[0]["phone"].ToString() != "") { model.phone = ds.Tables[0].Rows[0]["phone"].ToString(); } if (ds.Tables[0].Rows[0]["mobilephone"] != null && ds.Tables[0].Rows[0]["mobilephone"].ToString() != "") { model.mobilephone = ds.Tables[0].Rows[0]["mobilephone"].ToString(); } if (ds.Tables[0].Rows[0]["city_id"] != null && ds.Tables[0].Rows[0]["city_id"].ToString() != "") { model.city_id = int.Parse(ds.Tables[0].Rows[0]["city_id"].ToString()); } if (ds.Tables[0].Rows[0]["address"] != null && ds.Tables[0].Rows[0]["address"].ToString() != "") { model.address = ds.Tables[0].Rows[0]["address"].ToString(); } if (ds.Tables[0].Rows[0]["lat"] != null && ds.Tables[0].Rows[0]["lat"].ToString() != "") { model.lat = ds.Tables[0].Rows[0]["lat"].ToString(); } if (ds.Tables[0].Rows[0]["lng"] != null && ds.Tables[0].Rows[0]["lng"].ToString() != "") { model.lng = ds.Tables[0].Rows[0]["lng"].ToString(); } if (ds.Tables[0].Rows[0]["type_id"] != null && ds.Tables[0].Rows[0]["type_id"].ToString() != "") { model.type_id = int.Parse(ds.Tables[0].Rows[0]["type_id"].ToString()); } if (ds.Tables[0].Rows[0]["rtype_id"] != null && ds.Tables[0].Rows[0]["rtype_id"].ToString() != "") { model.rtype_id = int.Parse(ds.Tables[0].Rows[0]["rtype_id"].ToString()); } if (ds.Tables[0].Rows[0]["discount"] != null && ds.Tables[0].Rows[0]["discount"].ToString() != "") { model.discount = int.Parse(ds.Tables[0].Rows[0]["discount"].ToString()); } if (ds.Tables[0].Rows[0]["avg_price"] != null && ds.Tables[0].Rows[0]["avg_price"].ToString() != "") { model.avg_price = decimal.Parse(ds.Tables[0].Rows[0]["avg_price"].ToString()); } if (ds.Tables[0].Rows[0]["market_price"] != null && ds.Tables[0].Rows[0]["market_price"].ToString() != "") { model.market_price = decimal.Parse(ds.Tables[0].Rows[0]["market_price"].ToString()); } if (ds.Tables[0].Rows[0]["old_price"] != null && ds.Tables[0].Rows[0]["old_price"].ToString() != "") { model.old_price = decimal.Parse(ds.Tables[0].Rows[0]["old_price"].ToString()); } if (ds.Tables[0].Rows[0]["sell_price"] != null && ds.Tables[0].Rows[0]["sell_price"].ToString() != "") { model.sell_price = decimal.Parse(ds.Tables[0].Rows[0]["sell_price"].ToString()); } if (ds.Tables[0].Rows[0]["status"] != null && ds.Tables[0].Rows[0]["status"].ToString() != "") { model.status = int.Parse(ds.Tables[0].Rows[0]["status"].ToString()); } if (ds.Tables[0].Rows[0]["sort_id"] != null && ds.Tables[0].Rows[0]["sort_id"].ToString() != "") { model.sort_id = int.Parse(ds.Tables[0].Rows[0]["sort_id"].ToString()); } if (ds.Tables[0].Rows[0]["begin_date"] != null && ds.Tables[0].Rows[0]["begin_date"].ToString() != "") { model.begin_date = ds.Tables[0].Rows[0]["begin_date"].ToString(); } if (ds.Tables[0].Rows[0]["end_date"] != null && ds.Tables[0].Rows[0]["end_date"].ToString() != "") { model.end_date = ds.Tables[0].Rows[0]["end_date"].ToString(); } if (ds.Tables[0].Rows[0]["good_limit"] != null && ds.Tables[0].Rows[0]["good_limit"].ToString() != "") { model.good_limit = int.Parse(ds.Tables[0].Rows[0]["good_limit"].ToString()); } if (ds.Tables[0].Rows[0]["add_time"] != null && ds.Tables[0].Rows[0]["add_time"].ToString() != "") { model.add_time = DateTime.Parse(ds.Tables[0].Rows[0]["add_time"].ToString()); } if (ds.Tables[0].Rows[0]["is_top"] != null && ds.Tables[0].Rows[0]["is_top"].ToString() != "") { model.is_top = int.Parse(ds.Tables[0].Rows[0]["is_top"].ToString()); } if (ds.Tables[0].Rows[0]["is_slide"] != null && ds.Tables[0].Rows[0]["is_slide"].ToString() != "") { model.is_slide = int.Parse(ds.Tables[0].Rows[0]["is_slide"].ToString()); } if (ds.Tables[0].Rows[0]["is_red"] != null && ds.Tables[0].Rows[0]["is_red"].ToString() != "") { model.is_red = int.Parse(ds.Tables[0].Rows[0]["is_red"].ToString()); } if (ds.Tables[0].Rows[0]["remark1"] != null && ds.Tables[0].Rows[0]["remark1"].ToString() != "") { model.remark1 = ds.Tables[0].Rows[0]["remark1"].ToString(); } if (ds.Tables[0].Rows[0]["remark2"] != null && ds.Tables[0].Rows[0]["remark2"].ToString() != "") { model.remark2 = int.Parse(ds.Tables[0].Rows[0]["remark2"].ToString()); } #endregion model.albums = new goods_albums().GetList(id); return model; } else { return null; } }
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; model.zhuyi = txtZhuyi.Text.Replace("/s", "|"); 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 if (Request.Form.GetValues("item_goods_no") == null || Request.Form.GetValues("item_goods_no").Length < 1) { JscriptMsg("請設定商品規格!", string.Empty); return(false); } #region 儲存子件============== BLL.goods bll_goods = new BLL.goods(); StringBuilder idList = new StringBuilder(); string[] itemid = Request.Form.GetValues("item_id"); string[] goods_no = Request.Form.GetValues("item_goods_no"); string[] color = Request.Form.GetValues("item_color"); string[] imgurl = Request.Form.GetValues("item_imgurl"); string[] market_price = Request.Form.GetValues("item_market_price"); string[] sell_price = Request.Form.GetValues("item_sell_price"); string[] stock_quantity = Request.Form.GetValues("item_stock_quantity"); string[] chang = Request.Form.GetValues("item_chang"); string[] kuan = Request.Form.GetValues("item_kuan"); string[] gao = Request.Form.GetValues("item_gao"); string[] zhong = Request.Form.GetValues("item_zhong"); if (goods_no != null && goods_no.Length > 0) { for (int i = 0; i < goods_no.Length; i++) { Model.goods model_goods = null; int id = int.Parse(itemid[i].ToString()); bool update = true; if (id == 0) { model_goods = new Model.goods(); update = false; } else { model_goods = bll_goods.GetModel(id); } model_goods.parent_id = model.id; model_goods.img_url = imgurl[i].ToString(); model_goods.market_price = Utils.StrToDecimal(market_price[i].ToString(), 0); model_goods.goods_no = goods_no[i].ToString(); model_goods.sell_price = Utils.StrToDecimal(sell_price[i].ToString(), 0); model_goods.stock_quantity = Utils.StrToInt(stock_quantity[i].ToString(), 0); model_goods.color = color[i].ToString(); model_goods.guige = color[i].ToString(); model_goods.chang = Utils.StrToDecimal(chang[i].ToString(), 0); model_goods.kuan = Utils.StrToDecimal(kuan[i].ToString(), 0); model_goods.gao = Utils.StrToDecimal(gao[i].ToString(), 0); model_goods.zhong = Utils.StrToDecimal(zhong[i].ToString(), 0); if (update) { bll_goods.Update(model_goods); idList.Append(model_goods.id + ","); } else { int a = bll_goods.Add(model_goods); idList.Append(a + ","); } } } string id_list = Utils.DelLastChar(idList.ToString(), ","); if (!string.IsNullOrEmpty(id_list)) { Tea.DBUtility.DbHelperSQL.ExecuteSql("delete from shop_goods where parent_id=" + model.id + " and id not in(select id from shop_goods where id in(" + id_list + "))"); } #endregion if (bll.Update(model)) { AddAdminLog(TWEnums.ActionEnum.Edit.ToString(), "修改" + this.channel_name + "頻道內容:" + model.title); //記錄日誌 result = true; } return(result); }
/// <summary> /// 獲得購物車列表 /// </summary> public static IList <Model.cart_items> GetList(int group_id, int uid) { 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 BLL.users().GetModel(uid); 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; } 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; 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.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) { 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); } } } } } } return(i_List); } return(null); }