//保存排序
 protected void btnSave_Click(object sender, EventArgs e)
 {
     BLL.goods bll = new BLL.goods();
     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");
 }
 //批量删除
 protected void btnDelete_Click(object sender, EventArgs e)
 {
     ChkAdminLevel(channel_id, DTEnums.ActionEnum.Delete.ToString()); //检查权限
     BLL.goods bll = new BLL.goods();
     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");
 }
Beispiel #3
0
        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 RptBind(string _strWhere, string _orderby)
 {
     this.page = DTRequest.GetQueryInt("page", 1);
     if (this.category_id > 0)
     {
         this.ddlBusiness.SelectedValue = this.category_id.ToString();
     }
     this.ddlProperty.SelectedValue = this.property;
     this.txtKeywords.Text = this.keywords;
     //图表或列表显示
     BLL.goods bll = new BLL.goods();
     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);
 }
Beispiel #5
0
        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);
        }
 //设置操作
 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.goods bll = new BLL.goods();
     Model.goods model = bll.GetGoodsModel(id);
     switch (e.CommandName.ToLower())
     {
         case "ibtntop":
             if (model.is_top == 1)
                 bll.UpdateField(id, "is_top=0");
             else
                 bll.UpdateField(id, "is_top=1");
             break;
         case "ibtnred":
             if (model.is_red == 1)
                 bll.UpdateField(id, "is_red=0");
             else
                 bll.UpdateField(id, "is_red=1");
             break;
     }
     this.RptBind("id>0" + CombSqlTxt(this.channel_id, this.category_id, this.keywords, this.property), "sort_id asc,add_time desc");
 }
Beispiel #7
0
        /// <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);
        }
Beispiel #8
0
        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();
                        }
                    }
                }
            }
        }
Beispiel #9
0
        private bool DoAdd()
        {
            bool result = false;

            Model.article model = new Model.article();
            BLL.article   bll   = new BLL.article();
            model.wheresql    = "jiajia";
            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);
            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);
        }
Beispiel #10
0
        private void ShowInfo(int _id)
        {
            BLL.goods bll = new BLL.goods();
            Model.goods model = bll.GetGoodsModel(_id);

            ddlBusiness.SelectedValue = model.category_id.ToString();

            ddlDiscount.SelectedValue = model.discount.ToString();
            ddlType.SelectedValue = model.type_id.ToString();

            txtTitle.Text = model.title;
            txtImgUrl.Text = model.img_url;
            txtContent.Text = model.content;
            //9:30-22:00";
            string[] arr_time =  model.sell_time.Split('-');
            if (arr_time.Length > 1)
            {
                ddlTime_l1.SelectedValue = arr_time[0].Split(':')[0];
                ddlTime_l2.SelectedValue = arr_time[0].Split(':')[1];
                ddlTime_r1.SelectedValue = arr_time[1].Split(':')[0];
                ddlTime_r2.SelectedValue = arr_time[1].Split(':')[1];
            }
            txtPhone.Text = model.phone;
            txtMobile.Text = model.mobilephone;
            txtLocation.Text = model.address;
            txtlng.Text = model.lng;
            txtlat.Text = model.lat;
            txtContact.Text = model.contact;

            txtAvgPrice.Text = model.avg_price.ToString();

            //判断 当为门票类型时,market_price为成人票价格 sell_price 为儿童票价格
            if (model.category_id == (int)DTEnums.CatergoryID.season)
            {
                txtAdultPrice.Text = model.market_price.ToString();
                txtChildPrice.Text = model.sell_price.ToString();
            }
            else
            {
                txtMarketPrice.Text = model.market_price.ToString();
            }

            rdoItem.SelectedValue = model.good_limit.ToString();// 0;//用户导游都能看
            cblItem.SelectedValue = model.type_id.ToString();
            txtSortId.Text = model.sort_id.ToString();
            //model.sell_price = 0;
            //model.status = 1; //0是申请 1是正常  2是过期禁用

            txtStartDate.Text = model.begin_date;
            txtEndDate.Text = model.end_date;
            if (model.is_top == 1)
            {
                cblItem.Items[0].Selected = true;
            }
            if (model.is_red == 1)
            {
                cblItem.Items[1].Selected = true;
            }
            //赋值用户组价格
            //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();
            //            }
            //        }
            //    }
            //}
            if (!string.IsNullOrEmpty(model.remark1))
            {
                string[] arrList = model.remark1.Split(',');
                //绑定对应城市数据
                CityBind(int.Parse(arrList[0].ToString()), int.Parse(arrList[1].ToString()));
                this.ddlProvince.SelectedValue = arrList[0].ToString();
                this.ddlCity.SelectedValue = arrList[1].ToString();
                this.ddlArea.SelectedValue = arrList[2].ToString();

            }
            //赋值上传的相册
            focus_photo.Value = model.img_url; //封面图片
            LitAlbumList.Text = GetAlbumHtml(model.albums, model.img_url);
        }
Beispiel #11
0
        private bool DoEdit(int _id)
        {
            bool result = true;
            BLL.goods bll = new BLL.goods();
            Model.goods model = bll.GetGoodsModel(_id);
            model.id = _id;
            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); //"9:30-22:00";
            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"]);
            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());
            model.contact = txtContact.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);
            }
            else
            {
                model.market_price = decimal.Parse(txtMarketPrice.Text);
                model.sell_price = 0;
            }

            model.status = 1;
            model.sort_id = int.Parse(txtSortId.Text.Trim());
            model.begin_date = txtStartDate.Text.Trim();
            model.end_date = txtEndDate.Text.Trim();
            model.good_limit = int.Parse(rdoItem.SelectedValue);//用户导游都能看

            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;

            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;

            //保存相册
            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.goods_albums> ls = new List<Model.goods_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.goods_albums { id = img_id, good_id = _id, big_img = imgArr[1], small_img = imgArr[2], remark = remarkArr[i] });
                        }
                        else
                        {
                            ls.Add(new Model.goods_albums { id = img_id, good_id = _id, big_img = imgArr[1], small_img = imgArr[2] });
                        }
                    }
                }
                model.albums = ls;
            }

            if (!bll.Update(model))
            {
                result = false;
            }
            return result;
        }
Beispiel #12
0
        //將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);
        }
Beispiel #13
0
        /// <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);
        }