Пример #1
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);
 }
Пример #2
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;
 }
Пример #3
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>");
 }
Пример #4
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("<a href=\"" + linkurl(urlKey, category_id, 1) + "\">" + bll.GetTitle(category_id) + "</a>");
        }
Пример #5
0
        /// <summary>
        /// 获取可合成的列表
        /// </summary>
        /// <param name="user_id"></param>
        /// <returns></returns>
        protected List <ComposeList> get_user_compose_list(int user_id)
        {
            List <Model.ComposeList> composeLists     = new List <ComposeList>();
            List <ArticleCategory>   category_id_list = new BLL.UserReadLog().ReadCategory(user_id);

            BLL.article_category categoryBLL = new BLL.article_category();
            foreach (ArticleCategory category in category_id_list)
            {
                int count = new BLL.UserReadLog().CategoryComposeCount(user_id, category.category_id);
                if (count > 0)
                {
                    Model.ComposeList compose = new ComposeList();
                    compose.count          = count;
                    compose.category_id    = category.category_id;
                    compose.category_title = categoryBLL.GetTitle(category.category_id);
                    composeLists.Add(compose);
                }
            }
            return(composeLists);
        }
Пример #6
0
        /// <summary>
        /// 递归找到父节点
        /// </summary>
        private void LoopChannelMenu(StringBuilder strTxt, string urlKey, int category_id)
        {
            BLL.article_category   bll   = new BLL.article_category();
            Model.article_category model = bll.GetModel(category_id);
            int parentId = model.parent_id;

            if (parentId > 0)
            {
                this.LoopChannelMenu(strTxt, urlKey, parentId);
            }
            string url = null;

            if (model.call_index != "")
            {
                url = linkurl(urlKey, model.call_index);
            }
            else
            {
                url = linkurl(urlKey, category_id);
            }
            strTxt.Append("&nbsp;&gt;&nbsp;<a href=\"" + url + "\">" + bll.GetTitle(category_id) + "</a>");
        }
Пример #7
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();
        }
Пример #8
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);
            }
            HttpCookie cookie = HttpContext.Current.Request.Cookies["lang"];
            string     lang   = cookie != null ? cookie.Value : "pl-PL";

            if ("pl-PL".Equals(lang))
            {
                strTxt.Append("&nbsp;&gt;&nbsp;<a href=\"" + linkurl(urlKey, category_id, 1) + "\">" + bll.GetSeoTitle(category_id) + "</a>");
            }
            else
            {
                strTxt.Append("&nbsp;&gt;&nbsp;<a href=\"" + linkurl(urlKey, category_id, 1) + "\">" + bll.GetTitle(category_id) + "</a>");
            }
        }