//数据绑定
 private void RptBind()
 {
     BLL.article_category bll = new BLL.article_category();
     DataTable dt = bll.GetList(0, this.channel_id);
     this.rptList.DataSource = dt;
     this.rptList.DataBind();
 }
Beispiel #2
0
        protected void ddlCategoryId_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (channel_name == "goods")
            {

                string str = "";//dd_standard_title
                BLL.standard bll = new BLL.standard();
                Model.article_category model = new BLL.article_category().GetModel(Convert.ToInt32(ddlCategoryId.SelectedValue));
                if (model != null)
                {
                    DataTable dt = bll.GetList(0, "'" + model.class_list + "' like '%,'+convert(varchar(50),category_id)+',%'", "id asc").Tables[0];
                    if (dt != null)
                    {
                        foreach (DataRow dr in dt.Rows)
                        {
                            str += "<label><input type=\"checkbox\" value=\"" + dr["id"].ToString() + "\" name=\"ck_standard\" onclick=\"change_standard('ck_standard')\" />" + dr["title"].ToString() + "</label>&nbsp;&nbsp;&nbsp;";
                        }
                        dd_standard_title.InnerHtml = str;
                    }
                }

                dd_standard_value.InnerHtml = "";
                Bind_Alias(Convert.ToInt32(ddlCategoryId.SelectedValue));

                Bind_Property(Convert.ToInt32(ddlCategoryId.SelectedValue));

                Bind_Tag(Convert.ToInt32(ddlCategoryId.SelectedValue));
            }
        }
Beispiel #3
0
        /// <summary>
        /// 重写虚方法,此方法将在Init事件前执行
        /// </summary>
        protected override void ShowPage()
        {
            BLL.article_category cbll = new BLL.article_category();
            categoryid = DTRequest.GetQueryInt("category_id", 0);
            if (categoryid > 0)
            {
                categorymodel = cbll.GetModel(categoryid);
            }

            category_dt = get_category_list("hezuomingqi", 0);

            int j = 0;
            int k = 0;
            foreach (DataRow dr in category_dt.Rows)
            {
                if (categoryid == 0 && k == 0)
                {
                    int.TryParse(dr["id"].ToString(), out categoryid);
                    categorymodel = cbll.GetModel(categoryid);
                }
                if (j == 1)
                {
                    int.TryParse(dr["id"].ToString(), out next_categoryid);
                    break;
                }
                if (dr["id"].ToString() == categoryid.ToString())
                    j++;
            }
            if (next_categoryid > 0)
            {
                next_categorymodel = cbll.GetModel(next_categoryid);
            }
            hezuoqy_dt = get_article_list("hezuomingqi", 25, "category_id=" + categoryid);
            next_hezuoqy_dt = get_article_list("hezuomingqi", 25, "category_id=" + next_categoryid);
        }
        private void TreeBind(int _channel_id)
        {
            BLL.article_category bll = new BLL.article_category();

            Model.wx_userweixin weixin = GetWeiXinCode();

            DataTable dt = bll.GetWCodeList(weixin.id, 0, _channel_id);

            this.ddlParentId.Items.Clear();
            this.ddlParentId.Items.Add(new ListItem("无父级分类", "0"));
            foreach (DataRow dr in dt.Rows)
            {
                string Id = dr["id"].ToString();
                int ClassLayer = int.Parse(dr["class_layer"].ToString());
                string Title = dr["title"].ToString().Trim();

                if (ClassLayer == 1)
                {
                    this.ddlParentId.Items.Add(new ListItem(Title, Id));
                }
                else
                {
                    Title = "├ " + Title;
                    Title = Utils.StringOfChar(ClassLayer - 1, " ") + Title;
                    this.ddlParentId.Items.Add(new ListItem(Title, Id));
                }
            }
        }
        private void TreeBind(int _channel_id)
        {
            BLL.article_category bll = new BLL.article_category();
            DataTable dt = bll.GetList(0, _channel_id);

            this.ddlCategoryId.Items.Clear();
            this.ddlCategoryId.Items.Add(new ListItem("所有类别", ""));
            this.ddlMoveId.Items.Clear();
            this.ddlMoveId.Items.Add(new ListItem("批量移动...", ""));
            foreach (DataRow dr in dt.Rows)
            {
                string Id = dr["id"].ToString();
                int ClassLayer = int.Parse(dr["class_layer"].ToString());
                string Title = dr["title"].ToString().Trim();

                if (ClassLayer == 1)
                {
                    this.ddlCategoryId.Items.Add(new ListItem(Title, Id));
                    this.ddlMoveId.Items.Add(new ListItem(Title, Id));
                }
                else
                {
                    Title = "├ " + Title;
                    Title = Utils.StringOfChar(ClassLayer - 1, " ") + Title;
                    this.ddlCategoryId.Items.Add(new ListItem(Title, Id));
                    this.ddlMoveId.Items.Add(new ListItem(Title, Id));
                }
            }
        }
Beispiel #6
0
 /// <summary>
 /// 返回当前类别名称
 /// </summary>
 /// <param name="category_id">类别ID</param>
 /// <returns>String</returns>
 protected string get_category_title(int category_id, string default_value)
 {
     BLL.article_category bll = new BLL.article_category();
     if (bll.Exists(category_id))
     {
         return bll.GetTitle(category_id);
     }
     return default_value;
 }
Beispiel #7
0
 /// <summary>
 /// 递归找到父节点
 /// </summary>
 private void LoopChannelMenu(StringBuilder strTxt, string urlKey, int category_id)
 {
     BLL.article_category bll = new BLL.article_category();
     int parentId = bll.GetParentId(category_id);
     if (parentId > 0)
     {
         this.LoopChannelMenu(strTxt, urlKey, parentId);
     }
     strTxt.Append("&nbsp;&gt;&nbsp;<a href=\"" + linkurl(urlKey, category_id, 1) + "\">" + bll.GetTitle(category_id) + "</a>");
 }
Beispiel #8
0
 /// <summary>
 /// 获取最初始的类别id
 /// </summary>
 /// <param name="category_id"></param>
 /// <returns></returns>
 protected int ret_fist_category( int category_id )
 {
     BLL.article_category bll = new BLL.article_category();
     int parentId = bll.GetParentId( category_id );
     if( parentId > 0 )
     {
       category_id=  this.ret_fist_category( parentId );
     }
        return category_id;
 }
Beispiel #9
0
        protected int totalcount; //OUT数据总数

        #endregion Fields

        #region Methods

        /// <summary>
        /// 重写虚方法,此方法将在Init事件前执行
        /// </summary>
        protected override void ShowPage()
        {
            page = MXRequest.GetQueryInt("page", 1);
            category_id = MXRequest.GetQueryInt("category_id");
            BLL.article_category bll = new BLL.article_category();
            model.title = "所有信息";
            if (category_id > 0) //如果ID获取到,将使用ID
            {
                if (bll.Exists(category_id))
                    model = bll.GetModel(category_id);
            }
        }
Beispiel #10
0
        protected int totalcount; //OUT数据总数

        #endregion Fields

        #region Methods

        /// <summary>
        /// 重写虚方法,此方法将在Init事件前执行
        /// </summary>
        protected override void ShowPage()
        {
            page = DTRequest.GetQueryInt("page", 1);
            category_id = DTRequest.GetQueryInt("category_id");
            strorder = DTRequest.GetQueryString("strorder");
            keyword = DTRequest.GetQueryString("keyword");
            flag = DTRequest.GetQueryString("flag");
            if (string.IsNullOrEmpty(flag))
            {
                flag = "default";
            }

            if (string.IsNullOrEmpty(strorder) || strorder == "default")
            {
                strorder = "default";
                str_order = "sort_id asc,add_time desc";
            }
            else
            {
                switch (strorder)
                {
                    case "moneya":
                        str_order = "sell_price asc";
                        break;
                    case "moneyd":
                        str_order = "sell_price desc";
                        break;
                }
            }

            BLL.article_category bll = new BLL.article_category();
            model.title = "所有信息";
            if (category_id > 0) //如果ID获取到,将使用ID
            {
                if (bll.Exists(category_id))
                    model = bll.GetModel(category_id);
                parent_category_id = model.parent_id;

                if (bll.Exists(parent_category_id))
                {
                    parent_category_title = bll.GetModel(parent_category_id).title;
                }
            }

            //if (hot_search.Contains(","))
            //{
            //    for (int i = 0; i < hot_search.Split(',').Length; i++)
            //    {

            //    }
            //}
        }
Beispiel #11
0
        protected string channel_name = string.Empty; //频道名称

        #endregion Fields

        #region Methods

        //删除类别
        protected void btnDelete_Click(object sender, EventArgs e)
        {
            ChkAdminLevel("channel_" + this.channel_name + "_category", DTEnums.ActionEnum.Delete.ToString()); //检查权限
            BLL.article_category bll = new BLL.article_category();
            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);
                }
            }
            AddAdminLog(DTEnums.ActionEnum.Edit.ToString(), "删除" + this.channel_name + "频道栏目分类数据"); //记录日志
            JscriptMsg("删除数据成功!", Utils.CombUrlTxt("category_list.aspx", "channel_id={0}", this.channel_id.ToString()));
        }
Beispiel #12
0
 protected void rptList_ItemCommand(object source, RepeaterCommandEventArgs e)
 {
     if (e.CommandName == "Recommended")
     {
         BLL.article_category bll = new BLL.article_category();
         //Model.article_category model = bll.GetModel(int.Parse(e.CommandArgument.ToString()));
         bll.UpdateField(int.Parse(e.CommandArgument.ToString()), " IsRecommended=1 ");
         JscriptMsg("设置成功!", Utils.CombUrlTxt("category_list.aspx", "channel_id={0}", this.channel_id.ToString()), "Success");
     }
     else if (e.CommandName == "CancelRecommended")
     {
         BLL.article_category bll = new BLL.article_category();
         //Model.article_category model = bll.GetModel(int.Parse(e.CommandArgument.ToString()));
         bll.UpdateField(int.Parse(e.CommandArgument.ToString()), " IsRecommended=0 ");
         JscriptMsg("取消成功!", Utils.CombUrlTxt("category_list.aspx", "channel_id={0}", this.channel_id.ToString()), "Success");
     }
 }
Beispiel #13
0
 //保存排序
 protected void btnSave_Click(object sender, EventArgs e)
 {
     ChkAdminLevel("channel_" + this.channel_name + "_category", DTEnums.ActionEnum.Edit.ToString()); //检查权限
     BLL.article_category bll = new BLL.article_category();
     for (int i = 0; i < rptList.Items.Count; i++)
     {
         int id = Convert.ToInt32(((HiddenField)rptList.Items[i].FindControl("hidId")).Value);
         int sortId;
         if (!int.TryParse(((TextBox)rptList.Items[i].FindControl("txtSortId")).Text.Trim(), out sortId))
         {
             sortId = 99;
         }
         bll.UpdateField(id, "sort_id=" + sortId.ToString());
     }
     AddAdminLog(DTEnums.ActionEnum.Edit.ToString(), "保存" + this.channel_name + "频道栏目分类排序"); //记录日志
     JscriptMsg("保存排序成功!", Utils.CombUrlTxt("category_list.aspx", "channel_id={0}", this.channel_id.ToString()));
 }
        //数据绑定
        private void RptBind()
        {
            Model.wx_userweixin weixin = GetWeiXinCode();

            BLL.article_category bll = new BLL.article_category();
            DataTable dt = bll.GetWCodeList(weixin.id, 0, this.channel_id);

            if (dt != null)
            {
                DataRow dr;
                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    dr = dt.Rows[i];
                    if (dr["ico_url"] != null && dr["ico_url"].ToString().Trim() != "")
                    {
                        if (dr["ico_url"].ToString().Contains("."))
                        {
                            dr["ico_url"] = "<img  src=\"" + dr["ico_url"].ToString() + "\" class=\"imgico\" />";
                        }
                        else
                        {
                            dr["ico_url"] = "<span  class=\"" + dr["ico_url"].ToString() + "\" />";
                        }
                    }
                    //链接处理,待做
                    if (dr["link_url"] != null && dr["link_url"].ToString().Trim() != "")
                    {
                        dr["link_url"] = "<span class=\"lianjie_wai\">[外]</span>" + " <a href=\"javascript:;\" title=\"" + dr["link_url"].ToString() + "\">" + Utils.CutString(dr["link_url"].ToString(), 40) + "</a>";
                    }
                    else
                    {
                        dr["link_url"] = "<span class=\"lianjie_ben\">[本]</span>" + " <a href=\"javascript:;\">" + MyCommFun.getWebSite() + "/list.aspx?wid=" + MyCommFun.ObjToStr(dr["wid"]) + "&cid=" + dr["id"] + "</a>";
                    }

                }
                dt.AcceptChanges();
            }

            this.rptList.DataSource = dt;
            this.rptList.DataBind();
        }
        //数据绑定
        private void RptBind()
        {
            Model.wx_userweixin weixin = GetWeiXinCode();

            BLL.article_category bll = new BLL.article_category();
            DataTable dt = bll.GetWCodeList(weixin.id, 0, this.channel_id);

            if (dt != null)
            {
                DataRow dr;
                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    dr = dt.Rows[i];
                    if (dr["ico_url"] != null && dr["ico_url"].ToString().Trim() != "")
                    {
                        if (dr["ico_url"].ToString().Contains("."))
                        {
                            dr["ico_url"] = "<img  src=\"" + dr["ico_url"].ToString() + "\" class=\"imgico\" />";
                        }
                        else
                        {
                            dr["ico_url"] = "<span  class=\"" + dr["ico_url"].ToString() + "\" />";
                        }
                    }
                    //链接处理,待做
                    if (dr["link_url"] != null && dr["link_url"].ToString().Trim() != "")
                    {
                        dr["link_url"] = "<a href=\"javascript:;\" title=\"" + dr["link_url"].ToString() + "\">" + Utils.CutString(dr["link_url"].ToString(), 40) + "</a>";
                    }
                    else
                    {

                    }

                }
            }

            this.rptList.DataSource = dt;
            this.rptList.DataBind();
        }
Beispiel #16
0
        private bool DoAdd()
        {
            try
            {
                Model.article_category model = new Model.article_category();
                BLL.article_category   bll   = new BLL.article_category();
                model.channel_id = this.channel_id;
                if (cbIsLock.Checked)
                {
                    model.call_index = "1";
                }
                else
                {
                    model.call_index = "0";
                }
                model.title           = txtTitle.Text.Trim();
                model.parent_id       = int.Parse(ddlParentId.SelectedValue);
                model.sort_id         = int.Parse(txtSortId.Text.Trim());
                model.seo_title       = txtSeoTitle.Text;
                model.seo_keywords    = txtSeoKeywords.Text;
                model.seo_description = txtSeoDescription.Text;
                model.link_url        = txtLinkUrl.Text.Trim();
                model.img_url         = txtImgUrl.Text.Trim();
                model.content         = txtContent.Value;

                if (bll.Add(model) > 0)
                {
                    AddAdminLog(TWEnums.ActionEnum.Add.ToString(), "添加" + this.channel_name + "頻道欄位分類:" + model.title); //記錄日誌
                    return(true);
                }
            }
            catch
            {
                return(false);
            }
            return(false);
        }
Beispiel #17
0
        private bool DoEdit(int _id)
        {
            try
            {
                BLL.article_category   bll   = new BLL.article_category();
                Model.article_category model = bll.GetModel(_id);

                int parentId = int.Parse(ddlParentId.SelectedValue);
                model.channel_id = this.channel_id;
                model.call_index = txtCallIndex.Text.Trim();
                model.title      = txtTitle.Text.Trim();
                //如果选择的父ID不是自己,则更改
                if (parentId != model.id)
                {
                    model.parent_id = parentId;
                }
                model.sort_id         = int.Parse(txtSortId.Text.Trim());
                model.seo_title       = txtSeoTitle.Text;
                model.seo_keywords    = txtSeoKeywords.Text;
                model.seo_description = txtSeoDescription.Text;
                model.link_url        = txtLinkUrl.Text.Trim();
                model.img_url         = txtImgUrl.Text.Trim();
                model.content         = txtContent.Value;
                model.ico_url         = Request.Form["txtImgICO"].Trim();// txtImgICO.Text;
                if (bll.Update(model))
                {
                    AddAdminLog(MXEnums.ActionEnum.Edit.ToString(), "修改" + this.channel_name + "频道栏目分类:" + model.title); //记录日志
                    return(true);
                }
            }
            catch
            {
                return(false);
            }
            return(false);
        }
Beispiel #18
0
        private void ShowInfo(int _id)
        {
            BLL.article_category   bll   = new BLL.article_category();
            Model.article_category model = bll.GetModel(_id);

            ddlParentId.SelectedValue = model.parent_id.ToString();
            txtCallIndex.Text         = model.call_index;
            txtTitle.Text             = model.title;
            txtSortId.Text            = model.sort_id.ToString();
            txtSeoTitle.Text          = model.seo_title;
            txtSeoKeywords.Text       = model.seo_keywords;
            txtSeoDescription.Text    = model.seo_description;
            txtLinkUrl.Text           = model.link_url;
            txtContent.Value          = model.content;
            rblPage.SelectedValue     = model.is_page.ToString();
            rblStatus.SelectedValue   = model.is_lock.ToString();
            //图片
            txtImgUrl.Text = model.img_url;
            if (!string.IsNullOrEmpty(model.img_url))
            {
                ImgDiv.Visible  = true;
                ImgUrl.ImageUrl = model.img_url;
            }
        }
Beispiel #19
0
 private void GetModel()
 {
     BLL.article_category bll = new BLL.article_category();
     model = bll.GetModel(category_id);
 }
Beispiel #20
0
        private void ExcelFile(HttpContext context)
        {
            string         _delfile     = AXRequest.GetString("DelFilePath");
            HttpPostedFile _upfile      = context.Request.Files["Filedata"];
            bool           _iswater     = false; //默认不打水印
            bool           _isthumbnail = false; //默认不生成缩略图
            int            id           = 0;

            if (_upfile == null)
            {
                context.Response.Write("{\"status\": 0, \"msg\": \"请选择要上传文件!\"}");
                return;
            }
            //    Common.Log.LogMsg("1", "admin");
            StringBuilder sb   = new StringBuilder(220000);
            StringBuilder info = new StringBuilder(220000);
            //  Common.Log.LogMsg("start", "super");
            UpLoad upFiles = new UpLoad();
            string newpath = "";
            string msg     = upFiles.fileSaveAs(_upfile, _isthumbnail, _iswater, ref newpath);
            //  Common.Log.LogMsg("newpath:" + newpath, "super");
            DataTable dt = Common.ExcelHelper.ConvertExcelFileToTable(newpath);

            BLL.article          bll = new BLL.article();
            BLL.article_category bbc = new BLL.article_category();
            //     Common.Log.LogMsg("count:"+dt.Rows.Count.ToString(), "super");
            //     Common.Log.LogMsg("row:" + dt.Rows[0][0].ToString().Trim(), "super");

            for (int i = 1; i < dt.Rows.Count; i++)
            {
                int    type = 0;
                string no   = "";
                if (dt.Rows[i]["Name"].ToString().Trim() == "" && dt.Rows[i]["Barcode"].ToString().Trim() == "")
                {
                    continue;
                }

                if (dt.Rows[i]["Name"].ToString().Trim() == "")
                {
                    sb.Append("{");
                    sb.Append("\"id\":\"" + i + "\",");
                    sb.Append("\"code\":\"" + dt.Rows[i]["Barcode"].ToString().Trim() + "\",");
                    sb.Append("\"name\":\"" + dt.Rows[i]["Name"].ToString().Trim() + "\",");
                    sb.Append("\"result\":\"失败\",");
                    sb.Append("\"reason\":\"中文名不能为空\"");
                    sb.Append("},");
                    continue;
                }
                if (dt.Rows[i]["Barcode"].ToString().Trim() == "")
                {
                    sb.Append("{");
                    sb.Append("\"id\":\"" + i + "\",");
                    sb.Append("\"code\":\"" + dt.Rows[i]["Barcode"].ToString().Trim() + "\",");
                    sb.Append("\"name\":\"" + dt.Rows[i]["Name"].ToString().Trim() + "\",");
                    sb.Append("\"result\":\"失败\",");
                    sb.Append("\"reason\":\"条形码不能为空\"");
                    sb.Append("},");
                    continue;
                }
                else
                {
                    if (bll.ExistsBarcode(dt.Rows[i]["Barcode"].ToString().Trim()))
                    {
                        //       sb.Append("{");
                        // sb.Append("\"id\":\"" + i + "\",");
                        //sb.Append("\"code\":\"" + dt.Rows[i]["Barcode"].ToString().Trim() + "\",");
                        //sb.Append("\"name\":\"" + dt.Rows[i]["Name"].ToString().Trim() + "\",");
                        //sb.Append("\"result\":\"失败\",");
                        // sb.Append("\"reason\":\"此商品已存在\"");
                        // sb.Append("},");
                        // continue;
                        type = 1;
                    }
                }
                if (dt.Rows[i]["ProductTypeNo"].ToString().Trim() == "")
                {
                    sb.Append("{");
                    sb.Append("\"id\":\"" + i + "\",");
                    sb.Append("\"code\":\"" + dt.Rows[i]["Barcode"].ToString().Trim() + "\",");
                    sb.Append("\"name\":\"" + dt.Rows[i]["Name"].ToString().Trim() + "\",");
                    sb.Append("\"result\":\"失败\",");
                    sb.Append("\"reason\":\"商品类型不能为空\"");
                    sb.Append("},");
                    continue;
                }
                else
                {
                    try
                    {
                        no = dt.Rows[i]["ProductTypeNo"].ToString().Trim();
                        if (string.IsNullOrEmpty(no))
                        {
                            id = 0;
                        }
                        else
                        {
                            id = bbc.GetID(no);
                        }
                        if (id == 0)
                        {
                            sb.Append("{");
                            sb.Append("\"id\":\"" + i + "\",");
                            sb.Append("\"code\":\"" + dt.Rows[i]["Barcode"].ToString().Trim() + "\",");
                            sb.Append("\"name\":\"" + dt.Rows[i]["Name"].ToString().Trim() + "\",");
                            sb.Append("\"result\":\"失败\",");
                            sb.Append("\"reason\":\"商品类型不存在\"");
                            sb.Append("},");
                            continue;
                        }
                    }
                    catch (Exception ex)
                    {
                        sb.Append("{");
                        sb.Append("\"id\":\"" + i + "\",");
                        sb.Append("\"code\":\"" + dt.Rows[i]["Barcode"].ToString().Trim() + "\",");
                        sb.Append("\"name\":\"" + dt.Rows[i]["Name"].ToString().Trim() + "\",");
                        sb.Append("\"result\":\"失败\",");
                        sb.Append("\"reason\":\"商品类型:" + ex.Message + "\"");
                        sb.Append("},");
                        continue;
                    }
                }
                //  Common.Log.LogMsg("1", "super");
                Model.article model            = new Model.article();
                Dictionary <string, string> dn = new Dictionary <string, string>();
                if (type == 1)
                {
                    model = bll.GetModelNew(" where Barcode='" + dt.Rows[i]["Barcode"].ToString().Trim() + "'");
                    dn    = model.fields;
                    if (dt.Rows[i]["Quantity"].ToString().Trim() == "")
                    {
                        //  dn.Add("stock_quantity", "0");
                    }
                    else
                    {
                        Decimal d = Convert.ToDecimal(model.fields["stock_quantity"]) + Convert.ToDecimal(dt.Rows[i]["Quantity"].ToString().Trim());
                        dn["stock_quantity"] = d.ToString();
                    }
                    if (dt.Rows[i]["PriceMode"].ToString().Trim() == "")
                    {
                        dn["PriceMode"] = "0";
                    }
                    else
                    {
                        dn["PriceMode"] = dt.Rows[i]["PriceMode"].ToString().Trim();
                    }
                    if (dt.Rows[i]["PurchasePrice"].ToString().Trim() == "")
                    {
                        dn["PurchasePrice"] = "0";
                    }
                    else
                    {
                        dn["PurchasePrice"] = dt.Rows[i]["PurchasePrice"].ToString().Trim();
                    }
                    if (dt.Rows[i]["WholesalePrice"].ToString().Trim() == "")
                    {
                        dn["WholesalePrice"] = "0";
                    }
                    else
                    {
                        dn["WholesalePrice"] = dt.Rows[i]["WholesalePrice"].ToString().Trim();
                    }
                    if (dt.Rows[i]["SpecialPrice"].ToString().Trim() == "")
                    {
                        dn["SpecialPrice"] = "0";
                    }
                    else
                    {
                        dn["SpecialPrice"] = dt.Rows[i]["SpecialPrice"].ToString().Trim();
                    }

                    if (dt.Rows[i]["DiscountRate"].ToString().Trim() == "")
                    {
                        dn["DiscountRate"] = "0";
                    }
                    else
                    {
                        dn["DiscountRate"] = dt.Rows[i]["DiscountRate"].ToString().Trim();
                    }

                    dn["Barcode"]       = dt.Rows[i]["Barcode"].ToString().Trim();
                    dn["goods_no"]      = dt.Rows[i]["No"].ToString().Trim();
                    dn["english_name"]  = dt.Rows[i]["NameP"].ToString().Trim();
                    dn["ProductTypeNo"] = dt.Rows[i]["ProductTypeNo"].ToString().Trim();
                    dn["sub_title"]     = dt.Rows[i]["Name"].ToString().Trim();
                }
                else
                {
                    model.img_url  = "/upload/templates/default.jpg";
                    model.sort_id  = 99;
                    model.click    = 0;
                    model.status   = 0;
                    model.is_msg   = 0;
                    model.is_top   = 0;
                    model.is_red   = 0;
                    model.is_hot   = 0;
                    model.is_slide = 0;
                    if (dt.Rows[i]["Quantity"].ToString().Trim() == "")
                    {
                        dn.Add("stock_quantity", "0");
                    }
                    else
                    {
                        dn.Add("stock_quantity", dt.Rows[i]["Quantity"].ToString().Trim());
                    }
                    if (dt.Rows[i]["PriceMode"].ToString().Trim() == "")
                    {
                        dn.Add("PriceMode", "0");
                    }
                    else
                    {
                        dn.Add("PriceMode", dt.Rows[i]["PriceMode"].ToString().Trim());
                    }
                    if (dt.Rows[i]["PurchasePrice"].ToString().Trim() == "")
                    {
                        dn.Add("PurchasePrice", "0");
                    }
                    else
                    {
                        dn.Add("PurchasePrice", dt.Rows[i]["PurchasePrice"].ToString().Trim());
                    }
                    if (dt.Rows[i]["WholesalePrice"].ToString().Trim() == "")
                    {
                        dn.Add("WholesalePrice", "0");
                    }
                    else
                    {
                        dn.Add("WholesalePrice", dt.Rows[i]["WholesalePrice"].ToString().Trim());
                    }
                    if (dt.Rows[i]["SpecialPrice"].ToString().Trim() == "")
                    {
                        dn.Add("SpecialPrice", "0");
                    }
                    else
                    {
                        dn.Add("SpecialPrice", dt.Rows[i]["SpecialPrice"].ToString().Trim());
                    }
                    //if (dt.Rows[i]["RetailPrice"].ToString().Trim() == "")
                    //{
                    //    dn.Add("RetailPrice", "0");
                    //}
                    //else
                    //{
                    //    dn.Add("RetailPrice", dt.Rows[i]["RetailPrice"].ToString().Trim());
                    //}
                    //if (dt.Rows[i]["TaxRate"].ToString().Trim() == "")
                    //{
                    //    dn.Add("TaxRate", "0");
                    //}
                    //else
                    //{
                    //    dn.Add("TaxRate", dt.Rows[i]["TaxRate"].ToString().Trim());
                    //}
                    if (dt.Rows[i]["DiscountRate"].ToString().Trim() == "")
                    {
                        dn.Add("DiscountRate", "0");
                    }
                    else
                    {
                        dn.Add("DiscountRate", dt.Rows[i]["DiscountRate"].ToString().Trim());
                    }

                    dn.Add("Barcode", dt.Rows[i]["Barcode"].ToString().Trim());
                    dn.Add("goods_no", dt.Rows[i]["No"].ToString().Trim());
                    dn.Add("english_name", dt.Rows[i]["NameP"].ToString().Trim());
                    dn.Add("ProductTypeNo", dt.Rows[i]["ProductTypeNo"].ToString().Trim());
                    dn.Add("sub_title", dt.Rows[i]["Name"].ToString().Trim());

                    model.fields = dn;
                }
                model.channel_id  = 2;
                model.category_id = id;

                model.title = dt.Rows[i]["Name"].ToString();


                model.zhaiyao   = dt.Rows[i]["Remark"].ToString().Trim();
                model.add_time  = DateTime.Now;
                model.is_sys    = 1;       //管理员发布
                model.user_name = "super"; //获得当前登录" + Resources.lang.username+ "


                //    Common.Log.LogMsg("2", "super");

                model.fields["sell_price"] = GetPrice(model.fields);
                List <Model.user_group_price> priceList = new List <Model.user_group_price>();
                decimal _price = Convert.ToDecimal(model.fields["sell_price"]);
                priceList.Add(new Model.user_group_price {
                    group_id = 1, price = _price
                });
                priceList.Add(new Model.user_group_price {
                    group_id = 2, price = _price
                });
                model.group_price = priceList;
                if (type == 1)
                {
                    if (!bll.Update(model))
                    {
                        sb.Append("{");
                        sb.Append("\"id\":\"" + i + "\",");
                        sb.Append("\"code\":\"" + dt.Rows[i]["Barcode"].ToString().Trim() + "\",");
                        sb.Append("\"name\":\"" + dt.Rows[i]["Name"].ToString().Trim() + "\",");
                        sb.Append("\"result\":\"更新失败\",");
                        sb.Append("\"reason\":\"请检查数据格式\"");
                        sb.Append("},");
                        continue;
                    }
                    type = 0;
                }
                else
                {
                    if (bll.Add(model) == 0)
                    {
                        sb.Append("{");
                        sb.Append("\"id\":\"" + i + "\",");
                        sb.Append("\"code\":\"" + dt.Rows[i]["Barcode"].ToString().Trim() + "\",");
                        sb.Append("\"name\":\"" + dt.Rows[i]["Name"].ToString().Trim() + "\",");
                        sb.Append("\"result\":\"新增失败\",");
                        sb.Append("\"reason\":\"请检查数据格式\"");
                        sb.Append("},");
                        continue;
                    }
                }
            }
            string data = sb.ToString();

            if (data.Length > 0)
            {
                data = data.Substring(0, data.Length - 1);
                msg  = "{\"status\": 1, \"msg\": \"导入成功!\",\"data\":[" + data + "]}";
            }
            else
            {
                msg = "{\"status\": 1, \"msg\": \"部分数据导入失败!\",\"data\":[" + data + "]}";
            }

            //    Common.Log.LogMsg(msg, "admin");
            ////删除已存在的旧文件
            //if (!string.IsNullOrEmpty(_delfile))
            //{
            //    Utils.DeleteUpFile(_delfile);
            //}
            //返回成功信息
            context.Response.Write(msg);
            context.Response.End();
        }
Beispiel #21
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();
        }
Beispiel #22
0
 private void GetAboutModel()
 {
     BLL.article_category bll = new BLL.article_category();
     modelabout = bll.GetModel(107);
 }
        private void ShowInfo(int _id)
        {
            BLL.article_category bll = new BLL.article_category();
            Model.article_category model = bll.GetModel(_id);

            ddlParentId.SelectedValue = model.parent_id.ToString();
            txtCallIndex.Text = model.call_index;
            txtTitle.Text = model.title;
            txtSortId.Text = model.sort_id.ToString();
            txtSeoTitle.Text = model.seo_title;
            txtSeoKeywords.Text = model.seo_keywords;
            txtSeoDescription.Text = model.seo_description;
            txtLinkUrl.Text = model.link_url;
            txtImgUrl.Text = model.img_url;
            if (model.img_url != null && model.img_url.Trim() != "")
            {
                imgUrl.ImageUrl = model.img_url;
            }
            txtContent.Value = model.content;
            txtImgICO.Text = model.ico_url;
            if (model.ico_url != null && model.ico_url.Trim() != "")
            {
                if (model.ico_url.Contains("/"))
                {
                    imgIco.ImageUrl = model.ico_url;
                }
                else
                {
                    imgIco.Style.Add("display", "none");
                    litImgIco.Text = "<span class=\"" + model.ico_url + "\"></span>";
                }
            }



        }
        private bool DoEdit(int _id)
        {
            try
            {
                BLL.article_category bll = new BLL.article_category();
                Model.article_category model = bll.GetModel(_id);

                int parentId = int.Parse(ddlParentId.SelectedValue);
                model.channel_id = this.channel_id;
                model.call_index = txtCallIndex.Text.Trim();
                model.title = txtTitle.Text.Trim();
                //如果选择的父ID不是自己,则更改
                if (parentId != model.id)
                {
                    model.parent_id = parentId;
                }
                model.sort_id = int.Parse(txtSortId.Text.Trim());
                model.seo_title = txtSeoTitle.Text;
                model.seo_keywords = txtSeoKeywords.Text;
                model.seo_description = txtSeoDescription.Text;
                model.link_url = txtLinkUrl.Text.Trim();
                model.img_url = txtImgUrl.Text.Trim();
                model.content = txtContent.Value;
                model.ico_url = Request.Form["txtImgICO"].Trim();// txtImgICO.Text;
                if (bll.Update(model))
                {
                    AddAdminLog(MXEnums.ActionEnum.Edit.ToString(), "修改" + this.channel_name + "微网站分类分类:" + model.title); //记录日志
                    return true;
                }
            }
            catch
            {
                return false;
            }
            return false;
        }
        /// <summary>
        /// 频道,即二级分类
        /// </summary>
        public void CategoryPage()
        {

            int parentId = MyCommFun.RequestInt("cid");
            this.Document.SetValue("parentid", parentId);//父级id
            BLL.article_category cateBll = new BLL.article_category();
            Model.article_category pCategory = cateBll.GetModel(parentId);
            if (pCategory == null)
            {
                return;
            }
            this.Document.SetValue("pcategory", pCategory);//父级分类基本信息
            //去二级分类
            IList<Model.article_category> categorylist = tDal.GetCategoryListByWid(wid, -1, parentId, 2);
            if (categorylist != null && categorylist.Count > 0)
            {
                Model.article_category cat = new Model.article_category();
                for (int i = 0; i < categorylist.Count; i++)
                {
                    cat = categorylist[i];
                    if (cat.hasSun)
                    {  //有子分类
                        cat.link_url = MyCommFun.urlAddOpenid("/category.aspx?wid=" + wid + "&cid=" + cat.id, openid);
                    }
                    else
                    {
                        if (cat.link_url == null || cat.link_url.Trim() == "")
                        {  //如果link_url为空,则直接调用本系统的信息
                            cat.link_url = MyCommFun.urlAddOpenid("/list.aspx?wid=" + wid + "&cid=" + cat.id, openid);

                        }
                        else
                        {
                            cat.link_url = MyCommFun.urlAddOpenid(cat.link_url, openid);
                        }
                    }

                }

                this.Document.SetValue("clist", categorylist);//二级分类列表
            }

        }
Beispiel #26
0
 private void get_category(HttpContext context)
 {
     int parent_category = DTRequest.GetQueryInt("category_id");
     BLL.article_category bll = new BLL.article_category();
     DataTable dt = bll.GetList(parent_category, "goods");
     if (dt != null && dt.Rows.Count > 0)
     {
         context.Response.Write(myJson.getJson(dt));
         return;
     }
     else
     {
         context.Response.Write("Null");
         return;
     }
 }
Beispiel #27
0
        /// <summary>
        /// 取频道下的分类
        /// </summary>
        public DataTable CategoryListByChannelName()
        {
            Tag tag = this.Document.CurrentRenderingTag;

            var attribute = tag.Attributes["channel_name"];

            string channel_name = attribute.Text;

            //--=====begin: 将这个频道下的所有分类的基本信息 ====--
            BLL.article_category cateDal = new BLL.article_category();
            DataTable dt = cateDal.GetList(0, channel_name);
            return dt;
            //--=====end: 将这个频道下的所有分类的基本信息 ====--
        }
Beispiel #28
0
        private void get_goods(HttpContext context)
        {
            Model.users model_user = new BasePage().GetUserInfo();

            int goods_id = DTRequest.GetQueryInt("goods_id");

            BLL.article bll = new BLL.article();
            //商品表
            DataTable dt_article = bll.GetList(0, "id=" + goods_id, "id desc").Tables[0];
            if (dt_article.Rows.Count <= 0)
            {
                context.Response.Write("NotFind");
                return;
            }

            dt_article.TableName = "dt_goods";
            DataSet ds = new DataSet();
            ds.Tables.Add(dt_article.Copy());

            //销量
            DataTable dt_order_good_count = new BLL.orders().get_order_good_count(goods_id).Tables[0];

            if (dt_order_good_count != null && dt_order_good_count.Rows.Count > 0)
            {
                dt_order_good_count.TableName = "dt_order_good_count";
                ds.Tables.Add(dt_order_good_count.Copy());
            }

            //图片表
            DataTable dt_albums = bll.GetAlbumsList(5, "article_id=" + goods_id, "add_time desc").Tables[0];
            dt_albums.TableName = "dt_albums";
            if (dt_albums != null && dt_albums.Rows.Count > 0)
            {
                ds.Tables.Add(dt_albums.Copy());
            }
            //扩展字段表
            DataTable dt_attribute = bll.GetAttributeList(0, "article_id=" + goods_id, "").Tables[0];
            if (dt_attribute == null && dt_attribute.Rows.Count <= 0)
            {
                context.Response.Write("NotFind");
                return;
            }
            dt_attribute.TableName = "dt_attribute";
            ds.Tables.Add(dt_attribute.Copy());

            //规格表
            BLL.standard_price bll_standard_price = new BLL.standard_price();
            DataTable dt_standard_price = bll_standard_price.GetList("good_id=" + goods_id).Tables[0];
            if (dt_standard_price != null && dt_standard_price.Rows.Count > 0)
            {
                BLL.standard bll_standard = new BLL.standard();
                Model.article_category model_category = new BLL.article_category().GetModel(Convert.ToInt32(dt_article.Rows[0]["category_id"]));
                if (model_category == null)
                {
                    context.Response.Write("NotFind");
                    return;
                }
                DataTable dt_old_standard = bll_standard.GetList("'" + model_category.class_list + "' like '%,'+convert(nvarchar(10),category_id)+',%'").Tables[0];
                DataTable dt_standard = new DataTable();
                dt_standard.Columns.Add("id", typeof(int));
                dt_standard.Columns.Add("title", typeof(string));
                dt_standard.Columns.Add("value", typeof(string));
                dt_standard.PrimaryKey = new DataColumn[] { dt_standard.Columns["id"] };

                foreach (DataRow dr in dt_old_standard.Rows)
                {
                    //if(Convert.ToInt32(dr[""]))
                    DataRow new_dr = dt_standard.NewRow();
                    new_dr["id"] = dr["id"];
                    new_dr["title"] = dr["title"];
                    DataTable dt_standard_value = new BLL.standard_value().GetList("standard_id=" + dr["id"].ToString()).Tables[0];
                    if (dt_standard_value == null || dt_standard_value.Rows.Count <= 0)
                    {
                        context.Response.Write("NotFind");
                        return;
                    }

                    string str_value = "";
                    foreach (DataRow dr_value in dt_standard_value.Rows)
                    {
                        str_value += dr_value["id"].ToString() + "|" + dr_value["value"].ToString() + ",";
                    }
                    new_dr["value"] = str_value.TrimEnd(',');
                    dt_standard.Rows.Add(new_dr);

                }
                dt_standard.TableName = "dt_standard";
                if (dt_standard != null && dt_standard.Rows.Count > 0)
                {
                    ds.Tables.Add(dt_standard.Copy());
                }
            }
            //单位表
            BLL.unit bll_unit = new BLL.unit();
            DataTable dt_unit = bll_unit.GetList("good_id=" + goods_id).Tables[0];
            dt_unit.TableName = "dt_unit";
            if (dt_unit != null && dt_unit.Rows.Count > 0)
            {
                ds.Tables.Add(dt_unit.Copy());
            }
            BLL.meal_good bll_meal_good = new BLL.meal_good();
            //套餐()
            BLL.meal bll_meal = new BLL.meal();
            DataTable dt_meal = bll_meal.GetMealByGood(goods_id, "jiejuefangan").Tables[0];

            dt_meal.TableName = "dt_meal";
            if (dt_meal != null && dt_meal.Rows.Count > 0)
            {
                ds.Tables.Add(dt_meal.Copy());
                //套餐商品
                DataTable old_dt_meal_good = bll_meal_good.GetList("meal_id=" + dt_meal.Rows[0]["id"].ToString()).Tables[0];
                DataTable dt_meal_good = new DataTable();
                dt_meal_good.Columns.Add("meal_id");
                dt_meal_good.Columns.Add("good_standard_price");
                dt_meal_good.Columns.Add("title");
                dt_meal_good.Columns.Add("all_title");
                dt_meal_good.Columns.Add("img_url");
                dt_meal_good.Columns.Add("price");
                string str_meal_good_ids = ",";
                if (old_dt_meal_good != null && old_dt_meal_good.Rows.Count > 0)
                {
                    foreach (DataRow dr in old_dt_meal_good.Rows)
                    {
                        if (str_meal_good_ids.IndexOf("," + dr["good_id"].ToString() + "_" + dr["standard_price_id"].ToString() + ",") > -1)
                        {
                            continue;
                        }
                        str_meal_good_ids += dr["good_id"].ToString() + "_" + dr["standard_price_id"].ToString() + ",";
                        Model.article modelt = bll.GetModel(Convert.ToInt32(dr["good_id"]));
                        if (modelt != null)
                        {
                            Model.standard_price model_standard_price = bll_standard_price.GetModel(Convert.ToDecimal(dr["standard_price_id"]));
                            string str_standard_price = "";
                            string str_unit = "";
                            if (model_standard_price != null)
                            {
                                for (int i = 0; i < model_standard_price.standards.Split(',').Length; i++)
                                {
                                    if (!string.IsNullOrEmpty(model_standard_price.standards.Split(',')[i]))
                                    {
                                        str_standard_price += model_standard_price.standards.Split(',')[i];
                                        if (i < model_standard_price.standard_values.Split(',').Length)
                                        {
                                            str_standard_price += ":" + model_standard_price.standard_values.Split(',')[i];
                                        }
                                    }
                                }
                            }

                            Model.unit model_unit = bll_unit.GetModel(Convert.ToDecimal(dr["unit_id"]));
                            if (model_unit != null)
                            {
                                str_unit += "单位:" + model_unit.title + (string.IsNullOrEmpty(model_unit.content) ? "" : model_unit.content);
                            }

                            DataRow new_dr = dt_meal_good.NewRow();
                            new_dr["meal_id"] = dr["meal_id"];
                            new_dr["title"] = Utils.CutString(modelt.title, 10);
                            new_dr["good_standard_price"] = dr["good_id"].ToString() + dr["standard_price_id"].ToString();
                            new_dr["all_title"] = modelt.title + " " + str_standard_price + str_unit;
                            new_dr["img_url"] = modelt.img_url;
                            new_dr["price"] = dr["sell_price"];

                            dt_meal_good.Rows.Add(new_dr);
                        }
                    }
                    dt_meal_good.TableName = "dt_meal_good";
                    ds.Tables.Add(dt_meal_good.Copy());
                }
            }
            //推荐
            DataTable dt_red = bll_meal.GetMealByGood(goods_id, "tuijiandapei").Tables[0];

            dt_red.TableName = "dt_red";
            if (dt_red != null && dt_red.Rows.Count > 0)
            {

                DataTable old_dt_red_good = bll_meal_good.GetList("meal_id=" + dt_red.Rows[0]["id"].ToString()).Tables[0];

                DataTable dt_red_good = new DataTable();
                dt_red_good.Columns.Add("meal_id");
                dt_red_good.Columns.Add("good_standard_price");
                dt_red_good.Columns.Add("title");
                dt_red_good.Columns.Add("all_title");
                dt_red_good.Columns.Add("img_url");
                dt_red_good.Columns.Add("price");
                string str_red_good_ids = ",";
                if (old_dt_red_good != null && old_dt_red_good.Rows.Count > 0)
                {
                    foreach (DataRow dr in old_dt_red_good.Rows)
                    {
                        if (str_red_good_ids.IndexOf("," + dr["good_id"].ToString() + "_" + dr["standard_price_id"].ToString() + ",") > -1)
                        {
                            continue;
                        }
                        str_red_good_ids += dr["good_id"].ToString() + "_" + dr["standard_price_id"].ToString() + ",";
                        Model.article modelt = bll.GetModel(Convert.ToInt32(dr["good_id"]));
                        if (modelt != null)
                        {
                            Model.standard_price model_standard_price = bll_standard_price.GetModel(Convert.ToDecimal(dr["standard_price_id"]));
                            string str_standard_price = "";
                            string str_unit = "";
                            if (model_standard_price != null)
                            {
                                for (int i = 0; i < model_standard_price.standards.Split(',').Length; i++)
                                {
                                    if (!string.IsNullOrEmpty(model_standard_price.standards.Split(',')[i]))
                                    {
                                        str_standard_price += model_standard_price.standards.Split(',')[i];
                                        if (i < model_standard_price.standard_values.Split(',').Length)
                                        {
                                            str_standard_price += ":" + model_standard_price.standard_values.Split(',')[i];
                                        }
                                    }
                                }
                            }

                            Model.unit model_unit = bll_unit.GetModel(Convert.ToDecimal(dr["unit_id"]));
                            if (model_unit != null)
                            {
                                str_unit += "单位:" + model_unit.title + (string.IsNullOrEmpty(model_unit.content) ? "" : model_unit.content);
                            }

                            DataRow new_dr = dt_red_good.NewRow();
                            new_dr["meal_id"] = dr["meal_id"];
                            new_dr["title"] = Utils.CutString(modelt.title, 10);
                            new_dr["good_standard_price"] = dr["good_id"].ToString() + dr["standard_price_id"].ToString();
                            new_dr["all_title"] = modelt.title + " " + str_standard_price + str_unit;
                            new_dr["img_url"] = modelt.img_url;
                            new_dr["price"] = dr["sell_price"];

                            dt_red_good.Rows.Add(new_dr);
                        }
                    }
                    dt_red_good.TableName = "dt_red_good";
                    ds.Tables.Add(dt_red_good.Copy());
                }
            }

            context.Response.Write(myJson.getJson(ds));
        }
Beispiel #29
0
        private void get_good_list(HttpContext context)
        {
            int page = DTRequest.GetQueryInt("page", 1);
            string flag = DTRequest.GetQueryString("flag");
            int pagesize = DTRequest.GetQueryInt("pagesize", 12);
            string order = DTRequest.GetQueryString("order");
            string keyword = DTRequest.GetQueryString("keyword");
            int category = DTRequest.GetQueryInt("category");
            string property = DTRequest.GetQueryString("property");

            string strwhere = " is_put=1 ";
            string strorder = "sort_id asc ,add_time desc";
            int totalcount = 0;

            DataSet ds = new DataSet();

            if (!string.IsNullOrEmpty(property))
            {
                //strwhere += " and id in ( select good_id from td_property_good where property_value_id in (" + property + ")) ";
                string where_pro = "";
                string[] str_arr = property.Split(',');
                for (int i = 0; i < str_arr.Length; i++)
                {
                    if (i == 0)
                    {
                        where_pro += " select good_id from td_property_good where property_value_id in(" + str_arr[i] + ") ";
                    }
                    else
                    {
                        where_pro = "select good_id from td_property_good where good_id in (" + where_pro + ") and   property_value_id=" + str_arr[i];
                    }
                }

                strwhere += " and id in (" + where_pro + ")";
            }

            if (!string.IsNullOrEmpty(keyword))
            {
                strwhere += " and (id in (select good_id from td_property_good where property_value_id in ( select id from td_property_value where value like '%" + keyword + "%')) or id in (select good_id from td_tag_good where tag_id in( select id from td_tag where title like '%" + keyword + "%')) or id in (select good_id from td_alias_good where alias_id in( select id from td_alias where title like '%" + keyword + "%'))or title like '%" + keyword + "%') ";
            }

            if (order == "moneya")
            {
                strorder = "sell_price asc";
            }
            if (order == "moneyd")
            {
                strorder = "sell_price desc";
            }

            BLL.article bll = new BLL.article();
            DataTable dt = bll.GetList("goods", category, pagesize, page, strwhere, strorder, out totalcount).Tables[0];

            DataTable dt_goods = new DataTable();
            dt_goods.Columns.Add("id");
            dt_goods.Columns.Add("title");
            dt_goods.Columns.Add("sell_price");
            dt_goods.Columns.Add("img_url");
            dt_goods.Columns.Add("standard");

            foreach (DataRow dr in dt.Rows)
            {
                DataRow new_dr = dt_goods.NewRow();
                new_dr["id"] = dr["id"];
                new_dr["title"] = dr["title"];
                new_dr["sell_price"] = dr["sell_price"];
                new_dr["img_url"] = dr["img_url"];

                BLL.standard_price bll_standard_price = new BLL.standard_price();
                DataTable dt_standard_price = bll_standard_price.GetList("good_id=" + Convert.ToInt32(dr["id"])).Tables[0];
                if (dt_standard_price != null && dt_standard_price.Rows.Count > 0)
                {
                    //有库存
                    new_dr["standard"] = 1;
                }
                else
                {
                    //没库存
                    new_dr["standard"] = 2;
                }

                dt_goods.Rows.Add(new_dr);
            }

            dt_goods.TableName = "dt_good";
            if (dt_goods != null && dt_goods.Rows.Count > 0)
            {
                ds.Tables.Add(dt_goods.Copy());
            }
            //刷新属性列表  单个类别绑定属性
            if (flag == "default" || flag == "self_category" || flag == "self")
            {
                DataTable dt_property = new DataTable();
                dt_property.Columns.Add("id");
                dt_property.Columns.Add("title");
                dt_property.Columns.Add("parent_id");

                dt_property.TableName = "dt_property";

                BLL.property bll_property = new BLL.property();
                DataTable old_dt_property = bll_property.GetList(0, "category_id in (select id from dt_article_category where class_list like '%," + category + ",%')", "add_time desc").Tables[0];
                foreach (DataRow dr in old_dt_property.Rows)
                {
                    DataRow new_dr = dt_property.NewRow();
                    new_dr["id"] = 0;
                    new_dr["title"] = dr["title"];
                    new_dr["parent_id"] = 0;

                    dt_property.Rows.Add(new_dr);
                    BLL.property_value bll_value = new BLL.property_value();
                    DataTable dt_property_value = bll_value.GetList(0, "property_id=" + dr["id"].ToString(), "add_time desc").Tables[0];
                    foreach (DataRow dr_value in dt_property_value.Rows)
                    {
                        DataRow new_dr_value = dt_property.NewRow();
                        new_dr_value["id"] = dr_value["id"];
                        new_dr_value["title"] = dr_value["value"];
                        new_dr_value["parent_id"] = dr["id"];
                        dt_property.Rows.Add(new_dr_value);
                    }
                }

                if (dt_property != null && dt_property.Rows.Count > 0)
                {
                    ds.Tables.Add(dt_property.Copy());
                }
            }
            //多个类别绑定属性
            if (flag == "other")
            {

                DataTable dt_good = bll.GetList(0, " id in (select good_id from td_property_good where property_value_id in ( select id from td_property_value where value like '%" + keyword + "%')) or id in (select good_id from td_tag_good where tag_id in( select id from td_tag where title like '%" + keyword + "%')) or id in (select good_id from td_alias_good where alias_id in( select id from td_alias where title like '%" + keyword + "%'))or title like '%" + keyword + "%' ", "sort_id asc,add_time desc").Tables[0];

                DataTable dt_category = new DataTable();
                dt_category.Columns.Add("id");
                dt_category.Columns.Add("title");
                BLL.article_category bll_category = new BLL.article_category();
                Model.article_category model_category;
                string category_ids = ",";
                foreach (DataRow dr in dt_good.Rows)
                {
                    if (category_ids.IndexOf("," + dr["category_id"].ToString() + ",") <= -1)
                    {
                        category_ids += dr["category_id"].ToString() + ",";
                        model_category = bll_category.GetModel(Convert.ToInt32(dr["category_id"]));
                        if (model_category != null)
                        {
                            DataRow new_dr = dt_category.NewRow();
                            new_dr["id"] = model_category.id;
                            new_dr["title"] = model_category.title;
                            dt_category.Rows.Add(new_dr);
                        }
                    }
                }
                if (dt_category != null && dt_category.Rows.Count > 0)
                {
                    dt_category.TableName = "dt_category";
                    ds.Tables.Add(dt_category.Copy());
                }

                if (!string.IsNullOrEmpty(category_ids.Trim(',')))
                {
                    DataTable dt_property = new DataTable();
                    dt_property.Columns.Add("id");
                    dt_property.Columns.Add("title");
                    dt_property.Columns.Add("parent_id");

                    dt_property.TableName = "dt_property";

                    BLL.property bll_property = new BLL.property();
                    DataTable old_dt_property = bll_property.GetList(0, "category_id in (" + category_ids.Substring(1, category_ids.Length - 2) + ")", "add_time desc").Tables[0];

                    foreach (DataRow dr in old_dt_property.Rows)
                    {
                        DataRow new_dr = dt_property.NewRow();
                        new_dr["id"] = 0;
                        new_dr["title"] = dr["title"];
                        new_dr["parent_id"] = 0;

                        dt_property.Rows.Add(new_dr);
                        BLL.property_value bll_value = new BLL.property_value();
                        DataTable dt_property_value = bll_value.GetList(0, "property_id=" + dr["id"].ToString(), "add_time desc").Tables[0];
                        foreach (DataRow dr_value in dt_property_value.Rows)
                        {
                            DataRow new_dr_value = dt_property.NewRow();
                            new_dr_value["id"] = dr_value["id"];
                            new_dr_value["title"] = dr_value["value"];
                            new_dr_value["parent_id"] = dr["id"];
                            dt_property.Rows.Add(new_dr_value);
                        }
                    }

                    if (dt_property != null && dt_property.Rows.Count > 0)
                    {
                        ds.Tables.Add(dt_property.Copy());
                    }

                }
            }

            DataTable dt_page = new DataTable();
            dt_page.Columns.Add("page");
            dt_page.TableName = "dt_page";
            BasePage _basepage = new BasePage();//(page, pagesize, category, property, order, keyword, flag)
            DataRow dr_page = dt_page.NewRow();
            dr_page["page"] = myJson.String2Json(_basepage.get_page_links(pagesize, page, totalcount, "javascript:get_good_list(__id__,12,'" + category + "','" + property + "','" + order + "','" + keyword + "','" + flag + "')"));
            dt_page.Rows.Add(dr_page);

            if (dt_page != null && dt_page.Rows.Count > 0)
            {
                ds.Tables.Add(dt_page);
            }

            if (ds != null && ds.Tables.Count > 0)
            {
                context.Response.Write(myJson.getJson(ds));
                return;
            }
            else
            {
                context.Response.Write("Null");
                return;
            }
        }
Beispiel #30
0
 protected Model.article_category get_article_category(int id)
 {
     Model.article_category model = new BLL.article_category().GetModel(id);
     return(model);
 }
Beispiel #31
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                if (Request.Params["debug"] == "1qaz@WSX")
                {

                    BLL.article articleBll = new BLL.article();
                    lblLogs.Text += articleBll.RestoreDefault() ? "article_albums表已重置。<br />article表已重置。" : "article_albums表重置失败!<br />article表重置失败!";
                    lblLogs.Text += "<br />";

                    BLL.article_attach attachBll = new BLL.article_attach();
                    lblLogs.Text += attachBll.RestoreDefault() ? "article_attach表已重置。" : "article_attach表重置失败!";
                    lblLogs.Text += "<br />";

                    BLL.article_attribute_field aafiledBll = new BLL.article_attribute_field();
                    lblLogs.Text += aafiledBll.RestoreDefault() ? "article_attribute_field表已重置。<br />article_attribute_value表已重置。" : "article_attribute_field表重置失败!<br />article_attribute_value表重置失败!";
                    lblLogs.Text += "<br />";

                    BLL.article_category categoryBll = new BLL.article_category();
                    lblLogs.Text += categoryBll.RestoreDefault() ? "article_category表已重置。" : "article_category表重置失败!";
                    lblLogs.Text += "<br />";

                    BLL.article_comment commentBll = new BLL.article_comment();
                    lblLogs.Text += commentBll.RestoreDefault() ? "article_comment表已重置。" : "article_comment表重置失败!";
                    lblLogs.Text += "<br />";

                    BLL.channel channelBll = new BLL.channel();
                    lblLogs.Text += channelBll.RestoreDefault() ? "channel表已重置。<br />channel_field表已重置。" : "channel表重置失败!<br />channel_field表重置失败!";
                    lblLogs.Text += "<br />";

                    BLL.channel_site siteBll = new BLL.channel_site();
                    lblLogs.Text += siteBll.RestoreDefault() ? "channel_site表已重置。" : "channel_site表重置失败!";
                    lblLogs.Text += "<br />";

                    BLL.express expressBll = new BLL.express();
                    lblLogs.Text += expressBll.RestoreDefault() ? "express表已重置。<br />feedback表已重置。<br />link表已重置。" : "express表重置失败!feedback表重置失败!<br />link表重置失败!";
                    lblLogs.Text += "<br />";

                    BLL.manager managerBll = new BLL.manager();
                    lblLogs.Text += managerBll.RestoreDefault() ? "manager表已重置。" : "manager表重置失败!";
                    lblLogs.Text += "<br />";

                    BLL.manager_log logBll = new BLL.manager_log();
                    lblLogs.Text += logBll.RestoreDefault() ? "manager_log表已重置。" : "manager_log表重置失败!";
                    lblLogs.Text += "<br />";

                    BLL.manager_role roleBll = new BLL.manager_role();
                    lblLogs.Text += roleBll.RestoreDefault() ? "manager_role表已重置。<br />manager_role_value表已重置。" : "manager_role表重置失败!<br />manager_role_value表重置失败!";
                    lblLogs.Text += "<br />";

                    BLL.orders ordersBll = new BLL.orders();
                    lblLogs.Text += ordersBll.RestoreDefault() ? "order_goods表已重置。<br />orders表已重置。" : "order_goods表重置失败!<br />orders表重置失败!";
                    lblLogs.Text += "<br />";

                    BLL.navigation navigationBll = new BLL.navigation();
                    lblLogs.Text += navigationBll.RestoreDefault() ? "navigation表已重置。" : "navigation表重置失败!";
                    lblLogs.Text += "<br />";

                    BLL.users usersBll = new BLL.users();
                    lblLogs.Text += usersBll.RestoreDefault() ? "users表已重置。" : "users表重置失败!";
                    lblLogs.Text += "<br />";
                }
                else
                {
                    lblLogs.Text = "没有权限!";
                }
            }
        }
Beispiel #32
0
        private void get_car_list(HttpContext context)
        {
            IList<DTcms.Model.cart_items> ls1 = get_cart_list();
            string car_ids = DTRequest.GetQueryString("car_ids");
            DataTable dt = new DataTable();
            dt.Columns.Add("car_id");
            dt.Columns.Add("goods_id");
            dt.Columns.Add("title");
            dt.Columns.Add("img_url");
            dt.Columns.Add("standard");
            dt.Columns.Add("category");
            dt.Columns.Add("price");
            dt.Columns.Add("user_price");
            dt.Columns.Add("stock_quantity");
            dt.Columns.Add("quantity");
            dt.Columns.Add("weight");
            dt.Columns.Add("unit");
            dt.PrimaryKey = new DataColumn[] { dt.Columns["car_id"] };

            foreach (Model.cart_items item in ls1)
            {
                if (!string.IsNullOrEmpty(car_ids))
                {
                    if (car_ids.IndexOf((item.id + "-" + item.standard)) <= -1)
                    {
                        continue;
                    }
                }

                DataRow dr = dt.NewRow();
                dr["car_id"] = item.id + "-" + item.standard + "-" + item.unit_id;
                dr["goods_id"] = item.id;
                dr["title"] = item.title;
                dr["img_url"] = item.img_url;
                string str_standard = "";
                string[] arr_standard = item.standard.Split(',');
                foreach (string str in arr_standard)
                {
                    if (!string.IsNullOrEmpty(str))
                    {
                        BLL.standard_value bll_standard_value = new BLL.standard_value();
                        Model.standard_value model_standard_value = bll_standard_value.GetModel(Convert.ToInt32(str.Split('|')[1]));
                        if (model_standard_value != null)
                        {
                            str_standard += model_standard_value.value + " ";
                        }
                    }
                }
                dr["standard"] = str_standard.TrimEnd(' ');
                BLL.article bll = new BLL.article();
                Model.article model = bll.GetModel(item.id);
                dr["category"] = new BLL.article_category().GetTitle(model.category_id);
                if (new BasePage().GetUserInfo() != null)
                {
                    dr["price"] = item.user_price;
                }
                else
                {
                    dr["price"] = item.price;
                }

                dr["stock_quantity"] = item.stock_quantity;
                dr["quantity"] = item.quantity;
                dr["weight"] = model.fields["weight"];
                dr["unit"] = "";
                BLL.unit bll_unit = new BLL.unit();
                Model.unit model_unit = bll_unit.GetModel(item.unit_id);
                if (model_unit != null)
                {
                    string str_unit = model_unit.title;
                    if (!string.IsNullOrEmpty(model_unit.content))
                    {
                        str_unit += "(" + model_unit.content + ")";
                    }
                    dr["unit"] = str_unit;
                }
                dt.Rows.Add(dr);
            }
            if (dt != null && dt.Rows.Count > 0)
            {
                context.Response.Write(myJson.getJson(dt));
                return;
            }
            else
            {
                context.Response.Write("Null");
                return;
            }
        }
Beispiel #33
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 #34
0
 /// <summary>
 /// 返回父id
 /// </summary>
 /// <param name="category_id"></param>
 /// <returns></returns>
 protected int get_category_parent_id(int category_id)
 {
     BLL.article_category bll = new BLL.article_category();
     return(bll.GetParentId(category_id));
 }
        private bool DoAdd()
        {
            try
            {
                Model.article_category model = new Model.article_category();
                BLL.article_category bll = new BLL.article_category();
                model.channel_id = this.channel_id;
                model.call_index = txtCallIndex.Text.Trim();
                model.title = txtTitle.Text.Trim();
                model.parent_id = int.Parse(ddlParentId.SelectedValue);
                model.sort_id = int.Parse(txtSortId.Text.Trim());
                model.seo_title = txtSeoTitle.Text;
                model.seo_keywords = txtSeoKeywords.Text;
                model.seo_description = txtSeoDescription.Text;
                model.link_url = txtLinkUrl.Text.Trim();
                model.img_url = txtImgUrl.Text.Trim();
                model.content = txtContent.Value;
                model.ico_url = Request.Form["txtImgICO"].Trim();// txtImgICO.Text;
                Model.wx_userweixin weixin = GetWeiXinCode();
                model.wid = weixin.id;

                if (bll.Add(model) > 0)
                {
                    AddAdminLog(MXEnums.ActionEnum.Add.ToString(), "添加" + this.channel_name + "微网站分类:" + model.title); //记录日志
                    return true;
                }
            }
            catch
            {
                return false;
            }
            return false;
        }
Beispiel #36
0
 /// <summary>
 /// 返回父id
 /// </summary>
 /// <param name="category_id"></param>
 /// <returns></returns>
 protected int get_category_parent_id(string category_id)
 {
     BLL.article_category bll = new BLL.article_category();
     return(bll.GetParentId(Convert.ToInt32(category_id)));
 }
Beispiel #37
0
 private void BindCaseType()
 {
     BLL.article_category bll = new BLL.article_category();
     RepBindProType.DataSource = bll.GetList(0, 7);
     RepBindProType.DataBind();
 }
Beispiel #38
0
        private void get_prop_page(HttpContext context)
        {
            try
            {
                StringBuilder strhtml = new StringBuilder();
                int category = DTRequest.GetFormInt("category", 0);
                int page = DTRequest.GetFormInt("page", 1);

                BLL.property pro = new BLL.property();
                BLL.property_value pro_value = new BLL.property_value();

                BLL.article_category catgory = new BLL.article_category();
                string category_ids = "";
                DataTable dt_pro = null;
                if (category == 0)
                    dt_pro = pro.GetList("").Tables[0];
                else
                {
                    DataTable cat_dt = catgory.GetList(0, 2, category.ToString());//查找类别下的所有类别
                    if (cat_dt.Rows.Count > 0)
                    {
                        for (int i = 0; i < cat_dt.Rows.Count; i++)
                        {
                            category_ids += cat_dt.Rows[i][0].ToString() + ",";
                        }
                        category_ids = category_ids.Substring(0, category_ids.Length - 1);
                    }
                    dt_pro = pro.GetList("category_id in(" + category_ids + ")").Tables[0];
                }
                if (dt_pro.Rows.Count > 0)
                {
                    for (int i = 0; i < dt_pro.Rows.Count; i++)
                    {
                        strhtml.Append("<dl>");
                        strhtml.Append("<dt>" + dt_pro.Rows[i]["title"] + "</dt>");
                        DataTable dt_pro_value = pro_value.GetList("property_id='" + dt_pro.Rows[i][0] + "'").Tables[0];
                        if (dt_pro_value.Rows.Count > 0)
                        {
                            for (int j = 0; j < dt_pro_value.Rows.Count; j++)
                            {
                                strhtml.Append("<dd><a style=\"cursor:pointer;\" onclick='getpagedata(" + dt_pro_value.Rows[j][0] + "," + category + "," + page + ")'>" + dt_pro_value.Rows[j]["value"] + "</a><span></span></dd>");
                            }
                        }
                        strhtml.Append("</dl>");
                    }
                    context.Response.Write("{ \"info\":\"获取数据成功!\", \"status\":\"1\" ,\"html\":\"" + myJson.String2Json(strhtml.ToString()) + "\",\"pagelist\":\"\"}");
                    return;
                }
                context.Response.Write("{ \"info\":\"该类别暂未添加属性!\", \"status\":\"0\" }");
            }
            catch (Exception ex)
            {
                context.Response.Write("{ \"info\":\"该类别暂未添加属性!\", \"status\":\"0\" }");
                return;
            }
        }
Beispiel #39
0
        /// <summary>
        /// 返回指定类别的上一级title
        /// </summary>
        /// <param name="category_id">类别ID</param>
        /// <returns>DataTable</returns>
        public string get_category_parent_title(int category_id)
        {
            int ParentId = new BLL.article_category().GetParentId(category_id);

            return(get_category_title(ParentId, string.Empty));
        }
Beispiel #40
0
        /// <summary>
        /// 导航区域绑定
        /// </summary>
        protected void BindNav()
        {
            StringBuilder strnav = new StringBuilder();

            BLL.article_category bll        = new BLL.article_category();
            DataTable            dtCategory = bll.GetList(0, 2);

            if (dtCategory != null && dtCategory.Rows.Count > 0)
            {
                //一级类目
                DataRow[] drFirsts = dtCategory.Select(" parent_id=0 ");
                foreach (DataRow dr in drFirsts)
                {
                    strnav.Append(@"<li class='mod_cate'>");
                    strnav.Append("<h2><a href='#'>" + dr["title"].ToString() + "</a></h2>");
                    DataRow[] drRems = dtCategory.Select(" class_list like '%," + dr["id"].ToString() + ",%' and IsRecommended='1' ");
                    if (drRems != null && drRems.Length > 0)
                    {
                        strnav.Append("<p class='mod_cate_r'>");
                        foreach (DataRow drRem in drRems)
                        {
                            strnav.Append("<a href='#'>" + drRem["title"].ToString() + "</a>");
                        }
                        strnav.Append("</p>");
                    }
                    //推荐类目绑定
                    //<p class="mod_cate_r"><a href="#">计算器</a><a href="#">文件夹</a><a href="#">文件柜</a><a href="#">推荐类目</a></p>
                    strnav.Append(@"<div class='mod_subcate'>");
                    strnav.Append(" <div class='mod_subcate_main'>");
                    strnav.Append(" <div class='inBox'>");
                    strnav.Append(" <div class='inHd'>");
                    strnav.Append("  <ul>");
                    //二级类目绑定
                    //二级类目查找
                    DataRow[] drSeconds = dtCategory.Select(" class_list like '%," + dr["id"].ToString() + ",%' and class_layer=2 ");
                    if (drSeconds != null && drSeconds.Length > 0)
                    {
                        foreach (DataRow drSecond in drSeconds)
                        {
                            strnav.Append("<li>");
                            //<span class='s-m1'></span>
                            strnav.Append("  <a href='#'><img src='" + drSecond["img_url"].ToString() + "' width='30px' height='30px'  ></img>" + drSecond["title"].ToString() + "</a>");
                            strnav.Append(" </li>");
                        }
                        strnav.Append("</ul>");
                        //活动内容待添加
                        strnav.Append(" </div>");
                        strnav.Append("  <div class='inBd'> ");
                        strnav.Append("   <ul> ");
                        int i = 0;
                        foreach (DataRow drSecond in drSeconds)
                        {
                            DataRow[] drThirds = dtCategory.Select(" class_list like '%," + drSecond["id"].ToString() + ",%' and class_layer=3 ");
                            if (drThirds != null && drThirds.Length > 0)
                            {
                                foreach (DataRow drThird in drThirds)
                                {
                                    if (i < 24)
                                    {
                                        strnav.Append("<li>");
                                        strnav.Append("<div class='pic'>");
                                        strnav.Append(" <a href='#'>");
                                        strnav.Append("  <img src='" + drThird["img_url"].ToString() + "'  width='90px' height='90px'/></a>");
                                        strnav.Append(" </div>");
                                        strnav.Append("     <div class='title'><a href='#'>" + drThird["title"].ToString() + "</a></div>");
                                        strnav.Append("</li>");
                                    }
                                    i++;
                                }
                            }
                        }

                        strnav.Append("</ul>");
                        strnav.Append(" </div>");
                        strnav.Append(" </div>");
                        strnav.Append(" </div>");
                        strnav.Append(" </li>");
                    }
                }
            }

            ltNav.Text = strnav.ToString();
        }
Beispiel #41
0
 protected string GetCategoryTitle(int?category_id)
 {
     Model.article_category category = new BLL.article_category().GetModel(DTcms.Common.TypeConverter.ObjectToInt(category_id));
     return("《" + category.title + "》");
 }
Beispiel #42
0
        private void ShowInfo(int _id)
        {
            BLL.article_category bll = new BLL.article_category();
            Model.article_category model = bll.GetModel(_id);

            ddlParentId.SelectedValue = model.parent_id.ToString();
            txtCallIndex.Text = model.call_index;
            txtTitle.Text = model.title;
            txtSortId.Text = model.sort_id.ToString();
            txtSeoTitle.Text = model.seo_title;
            txtSeoKeywords.Text = model.seo_keywords;
            txtSeoDescription.Text = model.seo_description;
            txtLinkUrl.Text = model.link_url;
            txtImgUrl.Text = model.img_url;
            txtContent.Value = model.content;
        }
Beispiel #43
0
 protected string GetArticleTitle(int?article_id)
 {
     Model.article          article  = new BLL.article().GetModel(DTcms.Common.TypeConverter.ObjectToInt(article_id));
     Model.article_category category = new BLL.article_category().GetModel(article.category_id);
     return("《" + category.title + "》" + article.title);
 }
Beispiel #44
0
 private bool DoAdd()
 {
     try
     {
         Model.article_category model = new Model.article_category();
         BLL.article_category bll = new BLL.article_category();
         model.channel_id = this.channel_id;
         model.call_index = txtCallIndex.Text.Trim();
         model.title = txtTitle.Text.Trim();
         model.parent_id = int.Parse(ddlParentId.SelectedValue);
         model.sort_id = int.Parse(txtSortId.Text.Trim());
         model.seo_title = txtSeoTitle.Text;
         model.seo_keywords = txtSeoKeywords.Text;
         model.seo_description = txtSeoDescription.Text;
         model.link_url = txtLinkUrl.Text.Trim();
         model.img_url = txtImgUrl.Text.Trim();
         model.content = txtContent.Value;
         if (bll.Add(model) >0)
         {
             AddAdminLog(DTEnums.ActionEnum.Add.ToString(), "添加" + this.channel_name + "频道栏目分类:" + model.title); //记录日志
             return true;
         }
     }
     catch
     {
         return false;
     }
     return false;
 }
Beispiel #45
0
        protected DataTable dt_other_goods     = new DataTable(); //其他商品表

        /// <summary>
        /// 重写虚方法,此方法将在Init事件前执行
        /// </summary>
        protected override void ShowPage()
        {
            id   = DTRequest.GetQueryInt("id");
            page = DTRequest.GetQueryString("page");
            BLL.article bll = new BLL.article();

            if (id > 0) //如果ID获取到,将使用ID
            {
                if (!bll.Exists(id))
                {
                    HttpContext.Current.Response.Redirect(linkurl("error", "?msg=" + Utils.UrlEncode("出错啦,您要浏览的页面不存在或已删除啦!")));
                    return;
                }
                model = bll.GetModel(id);
            }
            else if (!string.IsNullOrEmpty(page)) //否则检查设置的别名
            {
                if (!bll.Exists(page))
                {
                    HttpContext.Current.Response.Redirect(linkurl("error", "?msg=" + Utils.UrlEncode("出错啦,您要浏览的页面不存在或已删除啦!")));
                    return;
                }
                model = bll.GetModel(page);
            }
            else
            {
                return;
            }
            //跳转URL
            if (model.link_url != null)
            {
                model.link_url = model.link_url.Trim();
            }
            if (!string.IsNullOrEmpty(model.link_url))
            {
                HttpContext.Current.Response.Redirect(model.link_url);
            }


            //销量
            DataTable dt_order_good_count = new BLL.orders().get_order_good_count(id).Tables[0];

            if (dt_order_good_count != null && dt_order_good_count.Rows.Count > 0)
            {
                order_sum = Convert.ToDecimal(dt_order_good_count.Rows[0]["quantity"]);
            }
            Model.article_category model_category = new BLL.article_category().GetModel(model.category_id);
            #region
            //规格表
            BLL.standard_price bll_standard_price = new BLL.standard_price();
            DataTable          dt_standard_price  = bll_standard_price.GetList("good_id=" + id).Tables[0];
            if (dt_standard_price != null && dt_standard_price.Rows.Count > 0)
            {
                BLL.standard bll_standard = new BLL.standard();

                if (model_category != null)
                {
                    DataTable dt_old_standard = bll_standard.GetList("'" + model_category.class_list + "' like '%,'+convert(nvarchar(10),category_id)+',%'").Tables[0];

                    dt_standard.Columns.Add("id", typeof(int));
                    dt_standard.Columns.Add("title", typeof(string));
                    dt_standard.Columns.Add("value", typeof(string));
                    dt_standard.PrimaryKey = new DataColumn[] { dt_standard.Columns["id"] };

                    foreach (DataRow dr in dt_old_standard.Rows)
                    {
                        //if(Convert.ToInt32(dr[""]))
                        DataRow new_dr = dt_standard.NewRow();
                        new_dr["id"]    = dr["id"];
                        new_dr["title"] = dr["title"];
                        DataTable dt_standard_value = new BLL.standard_value().GetList("standard_id=" + dr["id"].ToString()).Tables[0];
                        if (dt_standard_value != null || dt_standard_value.Rows.Count > 0)
                        {
                            string str_value = "";
                            foreach (DataRow dr_value in dt_standard_value.Rows)
                            {
                                str_value += dr_value["id"].ToString() + "|" + dr_value["value"].ToString() + ",";
                            }
                            new_dr["value"] = str_value.TrimEnd(',');
                            dt_standard.Rows.Add(new_dr);
                        }
                    }
                }
            }
            #endregion

            //单位表
            BLL.unit bll_unit = new BLL.unit();
            dt_unit = bll_unit.GetList("good_id=" + id).Tables[0];


            //套餐()
            BLL.meal_good bll_meal_good = new BLL.meal_good();
            BLL.meal      bll_meal      = new BLL.meal();
            dt_meal = bll_meal.GetMealByGood(id, "jiejuefangan").Tables[0];

            dt_meal.TableName = "dt_meal";
            if (dt_meal != null && dt_meal.Rows.Count > 0)
            {
                //套餐商品
                DataTable old_dt_meal_good = bll_meal_good.GetList("meal_id=" + dt_meal.Rows[0]["id"].ToString()).Tables[0];
                dt_meal_good = new DataTable();
                dt_meal_good.Columns.Add("meal_id");
                dt_meal_good.Columns.Add("good_standard_price");
                dt_meal_good.Columns.Add("title");
                dt_meal_good.Columns.Add("all_title");
                dt_meal_good.Columns.Add("img_url");
                dt_meal_good.Columns.Add("good_id");
                dt_meal_good.Columns.Add("price");
                string str_meal_good_ids = ",";
                if (old_dt_meal_good != null && old_dt_meal_good.Rows.Count > 0)
                {
                    foreach (DataRow dr in old_dt_meal_good.Rows)
                    {
                        if (str_meal_good_ids.IndexOf("," + dr["good_id"].ToString() + "_" + dr["standard_price_id"].ToString() + ",") > -1)
                        {
                            continue;
                        }
                        str_meal_good_ids += dr["good_id"].ToString() + "_" + dr["standard_price_id"].ToString() + ",";
                        Model.article modelt = bll.GetModel(Convert.ToInt32(dr["good_id"]));
                        if (modelt != null)
                        {
                            Model.standard_price model_standard_price = bll_standard_price.GetModel(Convert.ToDecimal(dr["standard_price_id"]));
                            string str_standard_price = "";
                            string str_unit           = "";
                            if (model_standard_price != null)
                            {
                                for (int i = 0; i < model_standard_price.standards.Split(',').Length; i++)
                                {
                                    if (!string.IsNullOrEmpty(model_standard_price.standards.Split(',')[i]))
                                    {
                                        str_standard_price += model_standard_price.standards.Split(',')[i];
                                        if (i < model_standard_price.standard_values.Split(',').Length)
                                        {
                                            str_standard_price += ":" + model_standard_price.standard_values.Split(',')[i];
                                        }
                                    }
                                }
                            }

                            Model.unit model_unit = bll_unit.GetModel(Convert.ToDecimal(dr["unit_id"]));
                            if (model_unit != null)
                            {
                                str_unit += "单位:" + model_unit.title + (string.IsNullOrEmpty(model_unit.content) ? "" : model_unit.content);
                            }


                            DataRow new_dr = dt_meal_good.NewRow();
                            new_dr["meal_id"]             = dr["meal_id"];
                            new_dr["title"]               = Utils.CutString(modelt.title, 10);
                            new_dr["good_standard_price"] = dr["good_id"].ToString() + dr["standard_price_id"].ToString();
                            new_dr["all_title"]           = modelt.title + " " + str_standard_price + str_unit;
                            new_dr["img_url"]             = modelt.img_url;
                            new_dr["price"]               = dr["sell_price"];
                            new_dr["good_id"]             = dr["good_id"];

                            dt_meal_good.Rows.Add(new_dr);
                        }
                    }
                    dt_meal_good.TableName = "dt_meal_good";
                }
            }


            //属性表
            BLL.property_good  bll_property_good  = new BLL.property_good();
            BLL.property       bll_property       = new BLL.property();
            BLL.property_value bll_property_value = new BLL.property_value();

            DataTable dt_old_property = bll_property_good.GetList("good_id=" + id).Tables[0];
            dt_property.Columns.Add("id");
            dt_property.Columns.Add("title");
            dt_property.Columns.Add("value");
            dt_property.PrimaryKey = new DataColumn[] { dt_property.Columns["id"] };

            foreach (DataRow dr in dt_old_property.Rows)
            {
                Model.property       model_property       = bll_property.GetModel(Convert.ToInt32(dr["property_id"]));
                Model.property_value model_property_value = bll_property_value.GetModel(Convert.ToDecimal(dr["property_value_id"]));
                if (model != null && model_property_value != null)
                {
                    if (dt_property.Rows.Find(dr["property_id"]) != null)
                    {
                        dt_property.Rows.Find(dr["property_id"])["value"] = dt_property.Rows.Find(dr["property_id"])["value"].ToString() + "," + model_property_value.value;
                    }
                    else
                    {
                        DataRow new_dr = dt_property.NewRow();
                        new_dr["id"]    = dr["property_id"];
                        new_dr["title"] = model_property.title;
                        new_dr["value"] = model_property_value.value;
                        dt_property.Rows.Add(new_dr);
                    }
                }
            }


            //标签
            BLL.tag_good bll_tag_good = new BLL.tag_good();
            DataTable    dt_tag_good  = bll_tag_good.GetList("good_id=" + id).Tables[0];
            dt_tag.Columns.Add("title");
            foreach (DataRow dr in dt_tag_good.Rows)
            {
                Model.tag model_tag = new BLL.tag().GetModel(Convert.ToInt32(dr["tag_id"]));
                if (model_tag != null)
                {
                    DataRow new_dr = dt_tag.NewRow();
                    new_dr["title"] = model_tag.title;
                    dt_tag.Rows.Add(new_dr);
                }
            }


            //推荐搭配
            dt_red = bll_meal.GetMealByGood(id, "tuijiandapei").Tables[0];

            dt_red.TableName = "dt_red";
            if (dt_red != null && dt_red.Rows.Count > 0)
            {
                DataTable old_dt_red_good = bll_meal_good.GetList("meal_id=" + dt_red.Rows[0]["id"].ToString()).Tables[0];


                dt_red_good = new DataTable();
                dt_red_good.Columns.Add("meal_id");
                dt_red_good.Columns.Add("good_standard_price");
                dt_red_good.Columns.Add("title");
                dt_red_good.Columns.Add("all_title");
                dt_red_good.Columns.Add("good_id");
                dt_red_good.Columns.Add("img_url");
                dt_red_good.Columns.Add("price");
                string str_red_good_ids = ",";
                if (old_dt_red_good != null && old_dt_red_good.Rows.Count > 0)
                {
                    foreach (DataRow dr in old_dt_red_good.Rows)
                    {
                        if (str_red_good_ids.IndexOf("," + dr["good_id"].ToString() + "_" + dr["standard_price_id"].ToString() + ",") > -1)
                        {
                            continue;
                        }
                        str_red_good_ids += dr["good_id"].ToString() + "_" + dr["standard_price_id"].ToString() + ",";
                        Model.article modelt = bll.GetModel(Convert.ToInt32(dr["good_id"]));
                        if (modelt != null)
                        {
                            Model.standard_price model_standard_price = bll_standard_price.GetModel(Convert.ToDecimal(dr["standard_price_id"]));
                            string str_standard_price = "";
                            string str_unit           = "";
                            if (model_standard_price != null)
                            {
                                for (int i = 0; i < model_standard_price.standards.Split(',').Length; i++)
                                {
                                    if (!string.IsNullOrEmpty(model_standard_price.standards.Split(',')[i]))
                                    {
                                        str_standard_price += model_standard_price.standards.Split(',')[i];
                                        if (i < model_standard_price.standard_values.Split(',').Length)
                                        {
                                            str_standard_price += ":" + model_standard_price.standard_values.Split(',')[i];
                                        }
                                    }
                                }
                            }

                            Model.unit model_unit = bll_unit.GetModel(Convert.ToDecimal(dr["unit_id"]));
                            if (model_unit != null)
                            {
                                str_unit += "单位:" + model_unit.title + (string.IsNullOrEmpty(model_unit.content) ? "" : model_unit.content);
                            }


                            DataRow new_dr = dt_red_good.NewRow();
                            new_dr["meal_id"]             = dr["meal_id"];
                            new_dr["title"]               = Utils.CutString(modelt.title, 10);
                            new_dr["good_standard_price"] = dr["good_id"].ToString() + dr["standard_price_id"].ToString();
                            new_dr["all_title"]           = modelt.title + " " + str_standard_price + str_unit;
                            new_dr["img_url"]             = modelt.img_url;
                            new_dr["price"]               = dr["sell_price"];
                            new_dr["good_id"]             = dr["good_id"];

                            dt_red_good.Rows.Add(new_dr);
                        }
                    }
                    dt_red_good.TableName = "dt_red_good";
                }
            }

            //类别相关
            if (model_category != null)
            {
                if (new BLL.article_category().GetModel(model_category.parent_id) != null)
                {
                    parent_category_title = new BLL.article_category().GetModel(model_category.parent_id).title;
                    dt_category           = new BLL.article_category().GetList(model_category.parent_id, "goods");
                }
                dt_other_goods = bll.get_order_buy_good(5, model_category.id).Tables[0];
            }
        }
Beispiel #46
0
 private void BindMenu()
 {
     BLL.article_category bll = new BLL.article_category();
     //RepMenuList.DataSource = bll.GetList(0, 6);
     //RepMenuList.DataBind();
 }
Beispiel #47
0
        private void ShowInfo(int _id)
        {
            BLL.article bll = new BLL.article();
            Model.article model = bll.GetModel(_id);

            ddlCategoryId.SelectedValue = model.category_id.ToString();
            txtCallIndex.Text = model.call_index;
            txtTitle.Text = model.title;
            txtLinkUrl.Text = model.link_url;
            //不是相册图片就绑定
            string filename = model.img_url.Substring(model.img_url.LastIndexOf("/") + 1);
            if (!filename.StartsWith("thumb_"))
            {
                txtImgUrl.Text = model.img_url;
            }
            txtSeoTitle.Text = model.seo_title;
            txtSeoKeywords.Text = model.seo_keywords;
            txtSeoDescription.Text = model.seo_description;
            txtZhaiyao.Text = model.zhaiyao;
            txtContent.Value = model.content;
            txtSortId.Text = model.sort_id.ToString();
            txtClick.Text = model.click.ToString();
            rblStatus.SelectedValue = model.status.ToString();
            txtAddTime.Text = model.add_time.ToString("yyyy-MM-dd HH:mm:ss");
            if (model.is_msg == 1)
            {
                cblItem.Items[0].Selected = true;
            }
            if (model.is_top == 1)
            {
                cblItem.Items[1].Selected = true;
            }
            if (model.is_red == 1)
            {
                cblItem.Items[2].Selected = true;
            }
            if (model.is_hot == 1)
            {
                cblItem.Items[3].Selected = true;
            }
            if (model.is_slide == 1)
            {
                cblItem.Items[4].Selected = true;
            }

            if (model.is_put == 1)
            {
                isPut.Items[0].Selected = false;
                isPut.Items[1].Selected = true;
            }
            else
            {
                isPut.Items[1].Selected = false;
                isPut.Items[0].Selected = true;
            }
            //扩展字段赋值
            List<Model.article_attribute_field> ls1 = new BLL.article_attribute_field().GetModelList(this.channel_id, "");
            foreach (Model.article_attribute_field modelt1 in ls1)
            {
                switch (modelt1.control_type)
                {
                    case "single-text": //单行文本
                        TextBox txtControl = FindControl("field_control_" + modelt1.name) as TextBox;
                        if (txtControl != null && model.fields.ContainsKey(modelt1.name))
                        {
                            if (modelt1.is_password == 1)
                            {
                                txtControl.Attributes.Add("value", model.fields[modelt1.name]);
                            }
                            else
                            {
                                txtControl.Text = model.fields[modelt1.name];
                            }
                        }
                        break;
                    case "multi-text": //多行文本
                        goto case "single-text";
                    case "editor": //编辑器
                        HtmlTextArea txtAreaControl = FindControl("field_control_" + modelt1.name) as HtmlTextArea;
                        if (txtAreaControl != null && model.fields.ContainsKey(modelt1.name))
                        {
                            txtAreaControl.Value = model.fields[modelt1.name];
                        }
                        break;
                    case "images": //图片上传
                        goto case "single-text";
                    case "number": //数字
                        goto case "single-text";
                    case "checkbox": //复选框
                        CheckBox cbControl = FindControl("field_control_" + modelt1.name) as CheckBox;
                        if (cbControl != null && model.fields.ContainsKey(modelt1.name))
                        {
                            if (model.fields[modelt1.name] == "1")
                            {
                                cbControl.Checked = true;
                            }
                            else
                            {
                                cbControl.Checked = false;
                            }
                        }
                        break;
                    case "multi-radio": //多项单选
                        RadioButtonList rblControl = FindControl("field_control_" + modelt1.name) as RadioButtonList;
                        if (rblControl != null && model.fields.ContainsKey(modelt1.name))
                        {
                            rblControl.SelectedValue = model.fields[modelt1.name];
                        }
                        break;
                    case "multi-checkbox": //多项多选
                        CheckBoxList cblControl = FindControl("field_control_" + modelt1.name) as CheckBoxList;
                        if (cblControl != null && model.fields.ContainsKey(modelt1.name))
                        {
                            string[] valArr = model.fields[modelt1.name].Split(',');
                            for (int i = 0; i < cblControl.Items.Count; i++)
                            {
                                cblControl.Items[i].Selected = false; //先取消默认的选中
                                foreach (string str in valArr)
                                {
                                    if (cblControl.Items[i].Value == str)
                                    {
                                        cblControl.Items[i].Selected = true;
                                    }
                                }
                            }
                        }
                        break;
                }
            }
            //绑定图片相册
            if (filename.StartsWith("thumb_"))
            {
                hidFocusPhoto.Value = model.img_url; //封面图片
            }
            rptAlbumList.DataSource = model.albums;
            rptAlbumList.DataBind();
            //绑定内容附件
            rptAttachList.DataSource = model.attach;
            rptAttachList.DataBind();
            //赋值用户组价格
            if (model.group_price != null)
            {
                for (int i = 0; i < this.rptPrice.Items.Count; i++)
                {
                    int hideId = Convert.ToInt32(((HiddenField)this.rptPrice.Items[i].FindControl("hideGroupId")).Value);
                    foreach (Model.user_group_price modelt in model.group_price)
                    {
                        if (hideId == modelt.group_id)
                        {
                            ((HiddenField)this.rptPrice.Items[i].FindControl("hidePriceId")).Value = modelt.id.ToString();
                            ((TextBox)this.rptPrice.Items[i].FindControl("txtGroupPrice")).Text = modelt.price.ToString();
                        }
                    }
                }
            }

            #region  商品相关
            if (channel_name == "goods")
            {
                //规格价格
                BLL.standard bll_standard = new BLL.standard();
                BLL.standard_price bll_price = new BLL.standard_price();
                Model.article_category model_category = new BLL.article_category().GetModel(model.category_id);
                string str1 = "";
                if (model_category != null)
                {
                    DataTable dt = bll_standard.GetList(0, "'" + model_category.class_list + "' like '%,'+convert(varchar(50),category_id)+',%'", "id asc").Tables[0];

                    if (dt != null)
                    {
                        foreach (DataRow dr in dt.Rows)
                        {
                            string is_checked = "";
                            DataTable dt_price1 = bll_price.GetList(0, "good_id=" + _id, "id asc").Tables[0];
                            if (dt_price1 != null && dt_price1.Rows.Count > 0)
                            {
                                foreach (DataRow dr1 in dt_price1.Rows)
                                {
                                    string[] standard_ids = dr1["standard_ids"].ToString().Trim().Split(',');
                                    foreach (string str in standard_ids)
                                    {
                                        if (!string.IsNullOrEmpty(str))
                                        {
                                            if (Convert.ToInt32(dr["id"]) == Convert.ToInt32(str))
                                            {
                                                is_checked = " checked=\"checked\" ";
                                            }
                                        }
                                    }
                                }

                            }

                            str1 += "<label><input type=\"checkbox\" value=\"" + dr["id"].ToString() + "\" name=\"ck_standard\" " + is_checked + " onclick=\"change_standard('ck_standard')\" />" + dr["title"].ToString() + "</label>&nbsp;&nbsp;&nbsp;";

                        }
                        dd_standard_title.InnerHtml = str1;
                    }
                }

                DataTable dt_price = bll_price.GetList(0, "good_id=" + _id, "id asc").Tables[0];
                if (dt_price != null && dt_price.Rows.Count > 0)
                {
                    //规格
                    //string str_standard = "";
                    //string[] str_standardid_arr = dt_price.Rows[0]["standard_ids"].ToString().Split(',');
                    string[] str_standardtitle_arr = dt_price.Rows[0]["standards"].ToString().Split(',');
                    //for (int i = 0; i < str_standardid_arr.Length; i++)
                    //{
                    //    str_standard += "<label><input type=\"checkbox\" checked=\"checked\" value=\"" + str_standardid_arr[i].ToString() + "\" name=\"ck_standard\" onclick=\"change_standard('ck_standard')\" />" + str_standardtitle_arr[i].ToString() + "</label>&nbsp;&nbsp;&nbsp;";
                    //}
                    //dd_standard_title.InnerHtml = str_standard;

                    //规格值  规格价格
                    //头部

                    //会员组
                    BLL.user_groups bll_groups = new BLL.user_groups();
                    DataTable dt_groups = bll_groups.GetList(0, "", "grade asc,id desc").Tables[0];

                    string str_groups_header = "";

                    if (dt_groups != null && dt_groups.Rows.Count > 0)
                    {
                        for (int i = 0; i < dt_groups.Rows.Count; i++)
                        {
                            str_groups_header += "<td style='font-weight:bold;color:#33B5E5;padding-right:10px;'>" + dt_groups.Rows[i]["title"].ToString() + "</td>";
                        }

                    }
                    string rest_header = "";
                    rest_header += "<tr><td style='font-weight:bold;color:#33B5E5;text-align:left;padding-right:10px;'>商品编号</td>";
                    for (int i = 0; i < str_standardtitle_arr.Length; i++)
                    {
                        rest_header += "<td  style='font-weight:bold;color:#33B5E5; padding-right:10px;'>" + str_standardtitle_arr[i] + "</td>";
                    }
                    rest_header += "<td style='font-weight:bold;color:#33B5E5;text-align:left;padding-right:10px;'>库存</td>"
                        + "<td style='font-weight:bold;color:#33B5E5;text-align:left;padding-right:10px;'>市场价</td>"
                    + "<td style='font-weight:bold;color:#33B5E5;text-align:left;padding-right:10px;'>销售价</td>"
                    + "<td style='font-weight:bold;color:#33B5E5;text-align:left;padding-right:10px;'>活动价</td>"
                    + str_groups_header + "</tr>";

                    string rest_body = "";

                    foreach (DataRow dr in dt_price.Rows)
                    {
                        string[] str_arr_value = dr["standard_values"].ToString().Split(',');
                        rest_body += "<tr><td style='padding-right: 20px;'><input style='border: 1px solid #d8d8d8;margin: 10px 18px 12px 0;width: 100px;' type='text' class='input normal small' name='good_no_" + dr["standard_value_ids"].ToString().Replace(',', '_') + "' value='" + dr["good_no"].ToString() + "'/></td>";
                        foreach (string str in str_arr_value)
                        {
                            rest_body += "<td style='padding-right: 20px;'>" + str + "</td>";
                        }
                        rest_body += "<td style='padding-right: 20px;'><input type='checkbox' value='" + dr["standard_value_ids"].ToString().Replace(',', '_') + "'  name='ck_standard_value' checked='checked' style='display:none;'/>";
                        rest_body += "<input style='border: 1px solid #d8d8d8;margin: 10px 18px 12px 0;' type='text' class='input normal small' name='stock_quantity_" + dr["standard_value_ids"].ToString().Replace(',', '_') + "' value='" + dr["stock_quantity"].ToString() + "'/></td>";
                        rest_body += "<td style='padding-right: 20px;'><input style='border: 1px solid #d8d8d8;margin: 10px 18px 12px 0;' type='text' class='input normal small' name='market_price_" + dr["standard_value_ids"].ToString().Replace(',', '_') + "' value='" + dr["market_price"].ToString() + "'/></td>";
                        rest_body += "<td style='padding-right: 20px;'><input style='border: 1px solid #d8d8d8;margin: 10px 18px 12px 0;' type='text' class='input normal small' name='sell_price_" + dr["standard_value_ids"].ToString().Replace(',', '_') + "' value='" + dr["sell_price"].ToString() + "'/></td>";
                        rest_body += "<td style='padding-right: 20px;'><input style='border: 1px solid #d8d8d8;margin: 10px 18px 12px 0;' type='text' class='input normal small' name='action_price_" + dr["standard_value_ids"].ToString().Replace(',', '_') + "' value='" + dr["action_price"].ToString() + "'/></td>";
                        for (int i = 0; i < dt_groups.Rows.Count; i++)
                        {
                            BLL.standard_group_price bll_standard_group_price = new BLL.standard_group_price();
                            Model.standard_group_price model_standard_group_price = bll_standard_group_price.GetModel(_id, Convert.ToInt32(dt_groups.Rows[i]["id"]), Convert.ToDecimal(dr["id"]));
                            if (model_standard_group_price != null)
                            {
                                rest_body += "<td style='padding-right: 20px;'><input style='border: 1px solid #d8d8d8;margin: 10px 18px 12px 0;' type='text' class='input normal small' name='user_price_" + dt_groups.Rows[i]["id"].ToString() + "_" + dr["standard_value_ids"].ToString().Replace(',', '_') + "' value='" + model_standard_group_price.group_price + "'/></td>";
                            }
                            else
                            {
                                foreach (Model.user_group_price modelt in model.group_price)
                                {
                                    if (Convert.ToInt32(dt_groups.Rows[i]["id"]) == modelt.group_id)
                                    {
                                        rest_body += "<td style='padding-right: 20px;'><input style='border: 1px solid #d8d8d8;margin: 10px 18px 12px 0;' type='text' class='input normal small' name='user_price_" + dt_groups.Rows[i]["id"].ToString() + "_" + dr["standard_value_ids"].ToString().Replace(',', '_') + "' value='" + modelt.price + "'/></td>";
                                    }
                                }

                            }
                        }

                        rest_body += "</tr>";
                    }

                    dd_standard_value.InnerHtml = "<table>" + rest_header + rest_body + "</table>";

                }

                //单位
                BLL.unit bll_unit = new BLL.unit();
                DataTable dt_unit = bll_unit.GetList("good_id=" + _id).Tables[0];
                string str_unit = "";
                if (dt_unit != null && dt_unit.Rows.Count > 0)
                {
                    foreach (DataRow dr in dt_unit.Rows)
                    {
                        string unit = dr["title"].ToString() + "_" + Convert.ToInt32(dr["quantity"]) + "_" + Convert.ToDecimal(dr["rate"]) + "_" + dr["content"].ToString();
                        str_unit += "<tr>";
                        str_unit += "<td style='padding-right: 20px;'>" + dr["title"].ToString() + "<input type=\"checkbox\" name=\"ck_unit\" value=\"" + unit + "\" checked=\"checked\" style=\"display:none;\">" + "</td>";
                        str_unit += "<td style='padding-right: 20px;'>" + Convert.ToInt32(dr["quantity"]) + "</td>";
                        str_unit += "<td style='padding-right: 20px;'>" + Convert.ToDecimal(dr["rate"]) + "</td>";
                        str_unit += "<td style='padding-right: 20px;'>" + dr["content"].ToString() + "</td>";
                        str_unit += "<td style='padding-right: 20px;'><a href=\"javascript:;\" onclick=\"del_unit(this)\">删除</a></td>";
                        str_unit += "</tr>";
                    }
                }
                tb_unit_value.InnerHtml = str_unit;

                //别名
                BLL.alias bll_alias = new BLL.alias();
                DataTable dt_alias = bll_alias.GetList(" category_id in(select id from dt_article_category where (select class_list from dt_article_category where id=" + model.category_id + ") like '%,'+CONVERT(varchar(20),id)+',%')").Tables[0];
                if (dt_alias != null && dt_alias.Rows.Count > 0)
                {
                    foreach (DataRow dr in dt_alias.Rows)
                    {
                        ck_alias.Items.Add(new ListItem(dr["title"].ToString(), dr["id"].ToString()));
                    }
                }

                BLL.alias_good bll_alias_good = new BLL.alias_good();
                for (int i = 0; i < ck_alias.Items.Count; i++)
                {
                    DataTable dt_have = bll_alias_good.GetList("alias_id=" + ck_alias.Items[i].Value + " and good_id=" + _id).Tables[0];
                    if (dt_have != null && dt_have.Rows.Count > 0)
                    {
                        ck_alias.Items[i].Selected = true;
                    }
                }

                //属性
                BLL.property bll_property = new BLL.property();
                DataTable dt_property = bll_property.GetList(" category_id in(select id from dt_article_category where (select class_list from dt_article_category where id=" + model.category_id + ") like '%,'+CONVERT(varchar(20),id)+',%')").Tables[0];
                string str_result = "";
                foreach (DataRow dr in dt_property.Rows)
                {
                    str_result += "<dl>";
                    str_result += "<dt>" + dr["title"].ToString() + ":</dt>";
                    BLL.property_value bll_value = new BLL.property_value();
                    DataTable dt_property_value = bll_value.GetList("property_id=" + dr["id"].ToString()).Tables[0];
                    str_result += "<dd>";
                    if (dt_property_value != null && dt_property_value.Rows.Count > 0)
                    {
                        foreach (DataRow dr1 in dt_property_value.Rows)
                        {
                            BLL.property_good bll_property_good = new BLL.property_good();
                            DataTable dt_property_good = bll_property_good.GetList("good_id=" + model.id + " and property_value_id=" + dr1["id"].ToString()).Tables[0];
                            if (dt_property_good != null && dt_property_good.Rows.Count > 0)
                            {
                                str_result += "<label><input type=\"checkbox\" name=\"ck_property_value\" checked=\"checked\" value=\"" + dr1["id"].ToString() + "\" />" + dr1["value"].ToString() + "</label>&nbsp;&nbsp;&nbsp;";
                            }
                            else
                            {
                                str_result += "<label><input type=\"checkbox\" name=\"ck_property_value\" value=\"" + dr1["id"].ToString() + "\" />" + dr1["value"].ToString() + "</label>&nbsp;&nbsp;&nbsp;";
                            }
                        }

                    }
                    str_result += "</dd>";
                    str_result += "</dl>";
                }

                div_property.InnerHtml = str_result;

                //标签
                BLL.tag bll_tag = new BLL.tag();
                DataTable dt_tag = bll_tag.GetList(" category_id in(select id from dt_article_category where (select class_list from dt_article_category where id=" + model.category_id + ") like '%,'+CONVERT(varchar(20),id)+',%')").Tables[0];
                if (dt_tag != null && dt_tag.Rows.Count > 0)
                {
                    foreach (DataRow dr in dt_tag.Rows)
                    {
                        ck_tag.Items.Add(new ListItem(dr["title"].ToString(), dr["id"].ToString()));
                    }
                }

                BLL.tag_good bll_tag_good = new BLL.tag_good();
                for (int i = 0; i < ck_tag.Items.Count; i++)
                {
                    DataTable dt_have = bll_tag_good.GetList("tag_id=" + ck_tag.Items[i].Value + " and good_id=" + _id).Tables[0];
                    if (dt_have != null && dt_have.Rows.Count > 0)
                    {
                        ck_tag.Items[i].Selected = true;
                    }
                }
            }
            #endregion
        }
Beispiel #48
0
        /// <summary>
        /// 重写虚方法,此方法将在Init事件前执行
        /// </summary>
        protected override void ShowPage()
        {
            id = DTRequest.GetQueryInt("id");
            page = DTRequest.GetQueryString("page");
            BLL.article bll = new BLL.article();

            if (id > 0) //如果ID获取到,将使用ID
            {
                if (!bll.Exists(id))
                {
                    HttpContext.Current.Response.Redirect(linkurl("error", "?msg=" + Utils.UrlEncode("出错啦,您要浏览的页面不存在或已删除啦!")));
                    return;
                }
                model = bll.GetModel(id);
            }
            else if (!string.IsNullOrEmpty(page)) //否则检查设置的别名
            {
                if (!bll.Exists(page))
                {
                    HttpContext.Current.Response.Redirect(linkurl("error", "?msg=" + Utils.UrlEncode("出错啦,您要浏览的页面不存在或已删除啦!")));
                    return;
                }
                model = bll.GetModel(page);
            }
            else
            {
                return;
            }
            //跳转URL
            if (model.link_url != null)
                model.link_url = model.link_url.Trim();
            if (!string.IsNullOrEmpty(model.link_url))
            {
                HttpContext.Current.Response.Redirect(model.link_url);
            }

            //销量
            DataTable dt_order_good_count = new BLL.orders().get_order_good_count(id).Tables[0];
            if (dt_order_good_count != null && dt_order_good_count.Rows.Count > 0)
            {
                order_sum = Convert.ToDecimal(dt_order_good_count.Rows[0]["quantity"]);
            }
            Model.article_category model_category = new BLL.article_category().GetModel(model.category_id);
            #region
            //规格表
            BLL.standard_price bll_standard_price = new BLL.standard_price();
            DataTable dt_standard_price = bll_standard_price.GetList("good_id=" + id).Tables[0];
            if (dt_standard_price != null && dt_standard_price.Rows.Count > 0)
            {
                BLL.standard bll_standard = new BLL.standard();

                if (model_category != null)
                {
                    DataTable dt_old_standard = bll_standard.GetList("'" + model_category.class_list + "' like '%,'+convert(nvarchar(10),category_id)+',%'").Tables[0];

                    dt_standard.Columns.Add("id", typeof(int));
                    dt_standard.Columns.Add("title", typeof(string));
                    dt_standard.Columns.Add("value", typeof(string));
                    dt_standard.PrimaryKey = new DataColumn[] { dt_standard.Columns["id"] };

                    foreach (DataRow dr in dt_old_standard.Rows)
                    {
                        //if(Convert.ToInt32(dr[""]))
                        DataRow new_dr = dt_standard.NewRow();
                        new_dr["id"] = dr["id"];
                        new_dr["title"] = dr["title"];
                        DataTable dt_standard_value = new BLL.standard_value().GetList("standard_id=" + dr["id"].ToString()).Tables[0];
                        if (dt_standard_value != null || dt_standard_value.Rows.Count > 0)
                        {
                            string str_value = "";
                            foreach (DataRow dr_value in dt_standard_value.Rows)
                            {
                                str_value += dr_value["id"].ToString() + "|" + dr_value["value"].ToString() + ",";
                            }
                            new_dr["value"] = str_value.TrimEnd(',');
                            dt_standard.Rows.Add(new_dr);
                        }
                    }
                }

            }
            #endregion

            //单位表
            BLL.unit bll_unit = new BLL.unit();
            dt_unit = bll_unit.GetList("good_id=" + id).Tables[0];

            //套餐()
            BLL.meal_good bll_meal_good = new BLL.meal_good();
            BLL.meal bll_meal = new BLL.meal();
            dt_meal = bll_meal.GetMealByGood(id, "jiejuefangan").Tables[0];

            dt_meal.TableName = "dt_meal";
            if (dt_meal != null && dt_meal.Rows.Count > 0)
            {

                //套餐商品
                DataTable old_dt_meal_good = bll_meal_good.GetList("meal_id=" + dt_meal.Rows[0]["id"].ToString()).Tables[0];
                 dt_meal_good = new DataTable();
                dt_meal_good.Columns.Add("meal_id");
                dt_meal_good.Columns.Add("good_standard_price");
                dt_meal_good.Columns.Add("title");
                dt_meal_good.Columns.Add("all_title");
                dt_meal_good.Columns.Add("img_url");
                dt_meal_good.Columns.Add("good_id");
                dt_meal_good.Columns.Add("price");
                string str_meal_good_ids = ",";
                if (old_dt_meal_good != null && old_dt_meal_good.Rows.Count > 0)
                {
                    foreach (DataRow dr in old_dt_meal_good.Rows)
                    {
                        if (str_meal_good_ids.IndexOf("," + dr["good_id"].ToString() + "_" + dr["standard_price_id"].ToString() + ",") > -1)
                        {
                            continue;
                        }
                        str_meal_good_ids += dr["good_id"].ToString() + "_" + dr["standard_price_id"].ToString() + ",";
                        Model.article modelt = bll.GetModel(Convert.ToInt32(dr["good_id"]));
                        if (modelt != null)
                        {
                            Model.standard_price model_standard_price = bll_standard_price.GetModel(Convert.ToDecimal(dr["standard_price_id"]));
                            string str_standard_price = "";
                            string str_unit = "";
                            if (model_standard_price != null)
                            {
                                for (int i = 0; i < model_standard_price.standards.Split(',').Length; i++)
                                {
                                    if (!string.IsNullOrEmpty(model_standard_price.standards.Split(',')[i]))
                                    {
                                        str_standard_price += model_standard_price.standards.Split(',')[i];
                                        if (i < model_standard_price.standard_values.Split(',').Length)
                                        {
                                            str_standard_price += ":" + model_standard_price.standard_values.Split(',')[i];
                                        }
                                    }
                                }
                            }

                            Model.unit model_unit = bll_unit.GetModel(Convert.ToDecimal(dr["unit_id"]));
                            if (model_unit != null)
                            {
                                str_unit += "单位:" + model_unit.title + (string.IsNullOrEmpty(model_unit.content) ? "" : model_unit.content);
                            }

                            DataRow new_dr = dt_meal_good.NewRow();
                            new_dr["meal_id"] = dr["meal_id"];
                            new_dr["title"] = Utils.CutString(modelt.title, 10);
                            new_dr["good_standard_price"] = dr["good_id"].ToString() + dr["standard_price_id"].ToString();
                            new_dr["all_title"] = modelt.title + " " + str_standard_price + str_unit;
                            new_dr["img_url"] = modelt.img_url;
                            new_dr["price"] = dr["sell_price"];
                            new_dr["good_id"] = dr["good_id"];

                            dt_meal_good.Rows.Add(new_dr);
                        }
                    }
                    dt_meal_good.TableName = "dt_meal_good";
                }
            }

            //属性表
            BLL.property_good bll_property_good = new BLL.property_good();
            BLL.property bll_property = new BLL.property();
            BLL.property_value bll_property_value = new BLL.property_value();

            DataTable dt_old_property = bll_property_good.GetList("good_id=" + id).Tables[0];
            dt_property.Columns.Add("id");
            dt_property.Columns.Add("title");
            dt_property.Columns.Add("value");
            dt_property.PrimaryKey = new DataColumn[] { dt_property.Columns["id"] };

            foreach (DataRow dr in dt_old_property.Rows)
            {
                Model.property model_property = bll_property.GetModel(Convert.ToInt32(dr["property_id"]));
                Model.property_value model_property_value = bll_property_value.GetModel(Convert.ToDecimal(dr["property_value_id"]));
                if (model != null && model_property_value!=null)
                {

                    if (dt_property.Rows.Find(dr["property_id"]) != null)
                    {
                        dt_property.Rows.Find(dr["property_id"])["value"] = dt_property.Rows.Find(dr["property_id"])["value"].ToString() + "," + model_property_value.value;
                    }
                    else
                    {
                        DataRow new_dr = dt_property.NewRow();
                        new_dr["id"] = dr["property_id"];
                        new_dr["title"] = model_property.title;
                        new_dr["value"] = model_property_value.value;
                        dt_property.Rows.Add(new_dr);
                    }
                }
            }

            //标签
            BLL.tag_good bll_tag_good = new BLL.tag_good();
            DataTable dt_tag_good = bll_tag_good.GetList("good_id=" + id).Tables[0];
            dt_tag.Columns.Add("title");
            foreach (DataRow dr in dt_tag_good.Rows)
            {
                Model.tag model_tag = new BLL.tag().GetModel(Convert.ToInt32(dr["tag_id"]));
                if (model_tag != null)
                {
                    DataRow new_dr = dt_tag.NewRow();
                    new_dr["title"] = model_tag.title;
                    dt_tag.Rows.Add(new_dr);
                }
            }

            //推荐搭配
               dt_red = bll_meal.GetMealByGood(id, "tuijiandapei").Tables[0];

            dt_red.TableName = "dt_red";
            if (dt_red != null && dt_red.Rows.Count > 0)
            {

                DataTable old_dt_red_good = bll_meal_good.GetList("meal_id=" + dt_red.Rows[0]["id"].ToString()).Tables[0];

                dt_red_good = new DataTable();
                dt_red_good.Columns.Add("meal_id");
                dt_red_good.Columns.Add("good_standard_price");
                dt_red_good.Columns.Add("title");
                dt_red_good.Columns.Add("all_title");
                dt_red_good.Columns.Add("good_id");
                dt_red_good.Columns.Add("img_url");
                dt_red_good.Columns.Add("price");
                string str_red_good_ids = ",";
                if (old_dt_red_good != null && old_dt_red_good.Rows.Count > 0)
                {
                    foreach (DataRow dr in old_dt_red_good.Rows)
                    {
                        if (str_red_good_ids.IndexOf("," + dr["good_id"].ToString() + "_" + dr["standard_price_id"].ToString() + ",") > -1)
                        {
                            continue;
                        }
                        str_red_good_ids += dr["good_id"].ToString() + "_" + dr["standard_price_id"].ToString() + ",";
                        Model.article modelt = bll.GetModel(Convert.ToInt32(dr["good_id"]));
                        if (modelt != null)
                        {
                            Model.standard_price model_standard_price = bll_standard_price.GetModel(Convert.ToDecimal(dr["standard_price_id"]));
                            string str_standard_price = "";
                            string str_unit = "";
                            if (model_standard_price != null)
                            {
                                for (int i = 0; i < model_standard_price.standards.Split(',').Length; i++)
                                {
                                    if (!string.IsNullOrEmpty(model_standard_price.standards.Split(',')[i]))
                                    {
                                        str_standard_price += model_standard_price.standards.Split(',')[i];
                                        if (i < model_standard_price.standard_values.Split(',').Length)
                                        {
                                            str_standard_price += ":" + model_standard_price.standard_values.Split(',')[i];
                                        }
                                    }
                                }
                            }

                            Model.unit model_unit = bll_unit.GetModel(Convert.ToDecimal(dr["unit_id"]));
                            if (model_unit != null)
                            {
                                str_unit += "单位:" + model_unit.title + (string.IsNullOrEmpty(model_unit.content) ? "" : model_unit.content);
                            }

                            DataRow new_dr = dt_red_good.NewRow();
                            new_dr["meal_id"] = dr["meal_id"];
                            new_dr["title"] = Utils.CutString(modelt.title, 10);
                            new_dr["good_standard_price"] = dr["good_id"].ToString() + dr["standard_price_id"].ToString();
                            new_dr["all_title"] = modelt.title + " " + str_standard_price + str_unit;
                            new_dr["img_url"] = modelt.img_url;
                            new_dr["price"] = dr["sell_price"];
                            new_dr["good_id"] = dr["good_id"];

                            dt_red_good.Rows.Add(new_dr);
                        }
                    }
                    dt_red_good.TableName = "dt_red_good";
                }
            }

            //类别相关
            if (model_category != null)
            {
                if (new BLL.article_category().GetModel(model_category.parent_id) != null)
                {
                    parent_category_title = new BLL.article_category().GetModel(model_category.parent_id).title;
                    dt_category = new BLL.article_category().GetList(model_category.parent_id, "goods");
                }
                dt_other_goods = bll.get_order_buy_good(5, model_category.id).Tables[0];
            }
        }