public int pcount = 0; //总条数

        #endregion Fields

        #region Methods

        public void RptBind()
        {
            string strWhere = "";
            if (Session["strWhereProduct"] != null && Session["strWhereProduct"].ToString() != "")
            {
                strWhere += Session["strWhereProduct"].ToString();
            }

            Cms.DAL.ProductInfo dal = new Cms.DAL.ProductInfo();
            DataSet ds = dal.GetProductList(strWhere);
            DataView dv = ds.Tables[0].DefaultView;
            //利用PAGEDDAGASOURCE类来分页
            PagedDataSource pds = new PagedDataSource();
            AspNetPager1.RecordCount = dv.Count;
            pcount = dv.Count;
            pds.DataSource = dv;
            pds.AllowPaging = true;
            pds.CurrentPageIndex = AspNetPager1.CurrentPageIndex - 1;
            pds.PageSize = AspNetPager1.PageSize;
            //获得总条数
            pcount = dv.Count;
            //绑定数据
            rptList.DataSource = pds;
            rptList.DataBind();
        }
Esempio n. 2
0
        protected void lbtnDel_Click(object sender, EventArgs e)
        {
            Cms.DAL.ProductInfo dal = new Cms.DAL.ProductInfo();
            bool hasDeleted         = false;

            //批量删除
            for (int i = 0; i < rptList.Items.Count; i++)
            {
                int      id = Convert.ToInt32(((Label)rptList.Items[i].FindControl("lb_id")).Text);
                CheckBox cb = (CheckBox)rptList.Items[i].FindControl("cb_id");
                if (cb.Checked)
                {
                    //删除记录
                    hasDeleted = true;
                    dal.Delete(id);
                }
            }
            if (hasDeleted)
            {
                MessageBox.Show(this, "批量删除成功!");
            }
            else
            {
                MessageBox.Show(this, "没有选中记录!");
            }
            RptBind();
        }
        protected void btnSave_Click(object sender, EventArgs e)
        {
            if (model == null)
                return;

            string strErr = "";
            if (!PageValidate.IsDateTime(txtPubTime.Text))
            {
                strErr += "发布时间格式错误!\\n";
            }

            if (strErr != "")
            {
                MessageBox.Show(this, strErr);
                return;
            }
            if (this.ddlTypeId.SelectedValue == "")
            {
                MessageBox.Show(this, "请选择商品类型!");
                return;
            }
            if (this.ddlBrandId.SelectedValue == "")
            {
                MessageBox.Show(this, "请选择商品品牌!");
                return;
            }
            if (this.ddlNameId.SelectedValue == "")
            {
                MessageBox.Show(this, "请选择商品名称!");
                return;
            }

            Cms.DAL.ProductInfo dal = new Cms.DAL.ProductInfo();
            model.Specifications = txtSpec.Text.Trim();
            model.ImgUrl = txtImgUrl.Text.Trim();
            model.SmallImgUrl = txtImgUrl.Text.Trim();
            model.Description = Cms.Common.Utils.ToHtml(ProductDetail.Text);
            model.Click = int.Parse(txtClick.Text.Trim());
            model.PubTime = DateTime.Parse(txtPubTime.Text);
            model.IsTop = 0;
            if (cblItem.Items[0].Selected == true)
            {
                model.IsTop = 1;
            }
            model.TypeId = int.Parse(this.ddlTypeId.SelectedValue.Trim());
            model.BrandId = int.Parse(this.ddlBrandId.SelectedValue.Trim());
            model.NameId = int.Parse(this.ddlNameId.SelectedValue.Trim());

            bool rel = dal.Update(model);
            if (rel)
            {
                MessageBox.Show(this, "产品型号信息修改成功!");
                //Coolite.Ext.Web.Ext.MessageBox.Alert("提示", "产品型号信息修改成功").Show();
            }
            else
            {
                MessageBox.Show(this, "发布过程中发生错误!");
                //Coolite.Ext.Web.Ext.MessageBox.Alert("提示", "发布过程中发生错误").Show();
            }
        }
Esempio n. 4
0
        public static string adviseProductList()
        {
            Cms.DAL.ProductInfo dal = new Cms.DAL.ProductInfo();
            Cms.DAL.Channel chnDal = new Cms.DAL.Channel();
            StringBuilder strTxt = new StringBuilder();
            DataSet proSpecDS = dal.GetTopProductList(5, "", " order by Click desc");
            DataTable proSpecTBL = proSpecDS.Tables[0];

            if (proSpecTBL.Rows.Count > 0)
            {
                strTxt.Append("<dl>");
                for (int j = 0; j < proSpecTBL.Rows.Count; j++)
                {
                    DataRow proRow = proSpecTBL.Rows[j];
                    int brandId = int.Parse(proRow["BrandID"].ToString());
                    string title = chnDal.GetProductBrandTitle(brandId) + " " + proRow["Specifications"].ToString();
                    strTxt.Append("<dd style=\"height: 22px;\">");
                    strTxt.Append("<a class=\"productClass02\" href=\"productView.aspx?specID=" + proRow["SpecificationsId"].ToString() + "\" style=\"position: relative; top: 5px; left: 15px;\">" + title + "</a>");
                    strTxt.Append("</dd>");
                }
                strTxt.Append("</dl>");
            }
            else
                strTxt.Append("暂无推荐产品!");

            return strTxt.ToString();
        }
Esempio n. 5
0
        public static string adviseProductList()
        {
            Cms.DAL.ProductInfo dal        = new Cms.DAL.ProductInfo();
            Cms.DAL.Channel     chnDal     = new Cms.DAL.Channel();
            StringBuilder       strTxt     = new StringBuilder();
            DataSet             proSpecDS  = dal.GetTopProductList(5, "", " order by Click desc");
            DataTable           proSpecTBL = proSpecDS.Tables[0];

            if (proSpecTBL.Rows.Count > 0)
            {
                strTxt.Append("<dl>");
                for (int j = 0; j < proSpecTBL.Rows.Count; j++)
                {
                    DataRow proRow  = proSpecTBL.Rows[j];
                    int     brandId = int.Parse(proRow["BrandID"].ToString());
                    string  title   = chnDal.GetProductBrandTitle(brandId) + " " + proRow["Specifications"].ToString();
                    strTxt.Append("<dd style=\"height: 22px;\">");
                    strTxt.Append("<a class=\"productClass02\" href=\"productView.aspx?specID=" + proRow["SpecificationsId"].ToString() + "\" style=\"position: relative; top: 5px; left: 15px;\">" + title + "</a>");
                    strTxt.Append("</dd>");
                }
                strTxt.Append("</dl>");
            }
            else
            {
                strTxt.Append("暂无推荐产品!");
            }

            return(strTxt.ToString());
        }
Esempio n. 6
0
        public void RptBind()
        {
            string strWhere = "";

            if (Session["strWhereProduct"] != null && Session["strWhereProduct"].ToString() != "")
            {
                strWhere += Session["strWhereProduct"].ToString();
            }

            Cms.DAL.ProductInfo dal = new Cms.DAL.ProductInfo();
            DataSet             ds  = dal.GetProductList(strWhere);
            DataView            dv  = ds.Tables[0].DefaultView;
            //利用PAGEDDAGASOURCE类来分页
            PagedDataSource pds = new PagedDataSource();

            AspNetPager1.RecordCount = dv.Count;
            pcount               = dv.Count;
            pds.DataSource       = dv;
            pds.AllowPaging      = true;
            pds.CurrentPageIndex = AspNetPager1.CurrentPageIndex - 1;
            pds.PageSize         = AspNetPager1.PageSize;
            //获得总条数
            pcount = dv.Count;
            //绑定数据
            rptList.DataSource = pds;
            rptList.DataBind();
        }
 protected string getImgUrl()
 {
     if (!String.IsNullOrEmpty(strid))
     {
         int Id = (Convert.ToInt32(strid));
         Cms.DAL.ProductInfo dal = new Cms.DAL.ProductInfo();
         Cms.Model.ProductInfo model = dal.GetModel(Id);
         if (model != null)
             return model.ImgUrl;
         else
             return "";
     }
     return "";
 }
Esempio n. 8
0
        //赋值
        private void ShowInfo(int Id)
        {
            Cms.DAL.ProductInfo   dal    = new Cms.DAL.ProductInfo();
            Cms.Model.ProductInfo model  = dal.GetModel(Id);
            Cms.DAL.Channel       chnDal = new Cms.DAL.Channel();

            this.lblId.Text      = model.SpecId.ToString();
            this.lblType.Text    = chnDal.GetProductTypeTitle(model.TypeId);
            this.lblBrand.Text   = chnDal.GetProductBrandTitle(model.BrandId);
            this.lblName.Text    = chnDal.GetProductNameTitle(model.NameId);
            this.lblSpec.Text    = model.Specifications;
            this.lblContent.Text = Cms.Common.Utils.ToTxt(model.Description);
            this.lblClick.Text   = model.Click.ToString();
            this.lblIsTop.Text   = model.IsTop.ToString();
            this.lblPubTime.Text = model.PubTime.ToString();
        }
        //赋值
        private void ShowInfo(int Id)
        {
            Cms.DAL.ProductInfo dal = new Cms.DAL.ProductInfo();
            Cms.Model.ProductInfo model = dal.GetModel(Id);
            Cms.DAL.Channel chnDal = new Cms.DAL.Channel();

            this.lblId.Text = model.SpecId.ToString();
            this.lblType.Text = chnDal.GetProductTypeTitle(model.TypeId);
            this.lblBrand.Text = chnDal.GetProductBrandTitle(model.BrandId);
            this.lblName.Text = chnDal.GetProductNameTitle(model.NameId);
            this.lblSpec.Text = model.Specifications;
            this.lblContent.Text =Cms.Common.Utils.ToTxt(model.Description);
            this.lblClick.Text = model.Click.ToString();
            this.lblIsTop.Text = model.IsTop.ToString();
            this.lblPubTime.Text = model.PubTime.ToString();
        }
Esempio n. 10
0
 protected string getImgUrl()
 {
     if (!String.IsNullOrEmpty(strid))
     {
         int Id = (Convert.ToInt32(strid));
         Cms.DAL.ProductInfo   dal   = new Cms.DAL.ProductInfo();
         Cms.Model.ProductInfo model = dal.GetModel(Id);
         if (model != null)
         {
             return(model.ImgUrl);
         }
         else
         {
             return("");
         }
     }
     return("");
 }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!int.TryParse(Request.Params["specId"] as string, out this.specId))
            {
                Response.Write("<script>alert('您要查看的信息参数不正确或不存在!'),location.href='ProductList.aspx';</script>");
                return;
            }

            Cms.DAL.ProductInfo dal = new Cms.DAL.ProductInfo();
            model = dal.GetModel(this.specId);//获得Id
            if (model == null)
            {
                Response.Write("<script>alert('您要查看的信息参数不正确或不存在!'),location.href='ProductList.aspx';</script>");
                return;
            }
            //浏览数+1
            dal.UpdateField(this.specId, "Click=Click+1");
            ClientScript.RegisterStartupScript(this.GetType(), "", "<script type='text/javascript'>menuEnable(2);</script>");
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!int.TryParse(Request.Params["specId"] as string, out this.specId))
            {
                Response.Write("<script>alert('您要查看的信息参数不正确或不存在!'),location.href='ProductList.aspx';</script>");
                return;
            }

            Cms.DAL.ProductInfo dal = new Cms.DAL.ProductInfo();
            model = dal.GetModel(this.specId);//获得Id
            if (model == null)
            {
                Response.Write("<script>alert('您要查看的信息参数不正确或不存在!'),location.href='ProductList.aspx';</script>");
                return;
            }
            //浏览数+1
            dal.UpdateField(this.specId, "Click=Click+1");
            ClientScript.RegisterStartupScript(this.GetType(), "", "<script type='text/javascript'>menuEnable(2);</script>");
        }
Esempio n. 13
0
        protected void rptList_ItemCommand(object source, RepeaterCommandEventArgs e)
        {
            int id = Convert.ToInt32(((Label)e.Item.FindControl("lb_id")).Text);

            Cms.DAL.ProductInfo   dal   = new Cms.DAL.ProductInfo();
            Cms.Model.ProductInfo model = dal.GetModel(id);
            switch (e.CommandName.ToLower())
            {
            case "ibtntop":
                if (model.IsTop == 1)
                {
                    dal.UpdateField(id, "IsTop=0");
                }
                else
                {
                    dal.UpdateField(id, "IsTop=1");
                }
                break;
            }
            RptBind();
        }
Esempio n. 14
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!int.TryParse(Request.Params["specId"] as string, out this.specId))
            {
                Response.Write("<script>alert('您要查看的信息参数不正确或不存在!');history.go(-1);</script>");
                return;
            }

            Cms.DAL.ProductInfo dal = new Cms.DAL.ProductInfo();
            model = dal.GetModel(this.specId);//获得Id
            if (model == null)
            {
                Response.Write("<script>alert('您要查看的信息参数不正确或不存在!');history.go(-1);</script>");
                return;
            }
            if (!Page.IsPostBack)
            {
                //赋值
                showInfo();
            }
        }
 private void RptBind(string strWhere)
 {
     Cms.DAL.ProductInfo dal = new Cms.DAL.ProductInfo();
     DataSet ds = dal.GetProductList(strWhere);
     DataView dv = ds.Tables[0].DefaultView;
     //利用PAGEDDAGASOURCE类来分页
     PagedDataSource pds = new PagedDataSource();
     AspNetPager1.RecordCount = dv.Count;
     pds.DataSource = dv;
     pds.AllowPaging = true;
     pds.CurrentPageIndex = AspNetPager1.CurrentPageIndex - 1;
     pds.PageSize = AspNetPager1.PageSize;
     //获得总条数
     pcount = dv.Count;
     if (this.pcount < 0)
     {
         this.lbmsg.Visible = true;
         this.lbmsg.Text = "暂时没有产品";
     }
     //绑定数据
     rptList.DataSource = pds;
     rptList.DataBind();
 }
        private void RptBind(string strWhere)
        {
            Cms.DAL.ProductInfo dal = new Cms.DAL.ProductInfo();
            DataSet             ds  = dal.GetProductList(strWhere);
            DataView            dv  = ds.Tables[0].DefaultView;
            //利用PAGEDDAGASOURCE类来分页
            PagedDataSource pds = new PagedDataSource();

            AspNetPager1.RecordCount = dv.Count;
            pds.DataSource           = dv;
            pds.AllowPaging          = true;
            pds.CurrentPageIndex     = AspNetPager1.CurrentPageIndex - 1;
            pds.PageSize             = AspNetPager1.PageSize;
            //获得总条数
            pcount = dv.Count;
            if (this.pcount < 0)
            {
                this.lbmsg.Visible = true;
                this.lbmsg.Text    = "暂时没有产品";
            }
            //绑定数据
            rptList.DataSource = pds;
            rptList.DataBind();
        }
Esempio n. 17
0
 protected void rptList_ItemCommand(object source, RepeaterCommandEventArgs e)
 {
     int id = Convert.ToInt32(((Label)e.Item.FindControl("lb_id")).Text);
     Cms.DAL.ProductInfo dal = new Cms.DAL.ProductInfo();
     Cms.Model.ProductInfo model = dal.GetModel(id);
     switch (e.CommandName.ToLower())
     {
         case "ibtntop":
             if (model.IsTop == 1)
                 dal.UpdateField(id, "IsTop=0");
             else
                 dal.UpdateField(id, "IsTop=1");
             break;
     }
     RptBind();
 }
        protected void lbtnImport_Click(object sender, EventArgs e)
        {
            string fullPath = HttpContext.Current.Server.MapPath(importFilePath.Text);
            if (!File.Exists(fullPath))
            {
                //保存日志
                MessageBox.Show(this, "请上传导入文件!");
                return;
            }

            DataSet ds = ExcelToDS( fullPath );
            DataTable tb = ds.Tables[0];
            if (tb.Rows.Count > 0)
            {
                Cms.DAL.Channel dal = new Cms.DAL.Channel();
                Cms.DAL.ProductInfo proDAL = new Cms.DAL.ProductInfo();
                for (int i = 0; i < tb.Rows.Count; i++)
                {
                    DataRow proRow = tb.Rows[i];
                    string type = proRow["商品类型"].ToString();
                    string brand = proRow["商品品牌"].ToString();
                    string name = proRow["商品名称"].ToString();
                    string spec = proRow["商品型号"].ToString();
                    int procNum = int.Parse(proRow["数量"].ToString());

                    int typeID = dal.GetProductTypeID(type);
                    if (typeID == -1)
                        typeID = dal.AddProductType(type);

                    int brandID = dal.GetProductBrandID(brand, typeID);
                    if (brandID == -1)
                        brandID = dal.AddProductBrand(brand, typeID);

                    int nameID = dal.GetProductNameID(name, typeID, brandID);
                    if (nameID == -1)
                        nameID = dal.AddProductName(name, typeID, brandID);

                    int specID = 0;
                    if (!proDAL.Exists(spec, typeID, brandID, nameID))
                    {
                        Cms.Model.ProductInfo model = new Cms.Model.ProductInfo();
                        model.Specifications = spec;
                        model.ImgUrl = "";
                        model.SmallImgUrl = "";
                        model.Description = "";
                        model.Click = 0;
                        model.PubTime = DateTime.Now;
                        model.IsTop = 0;
                        model.TypeId = typeID;
                        model.BrandId = brandID;
                        model.NameId = nameID;

                        specID = proDAL.Add(model);
                    }

                    if (specID > 0)
                    {
                        proDAL.AddStock(typeID, brandID, nameID, specID, procNum, procNum);
                    }
                }
            }
            File.Delete( fullPath );

            //保存日志
            MessageBox.Show(this, "数据导入成功!");
        }
Esempio n. 19
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            if (model == null)
            {
                return;
            }

            string strErr = "";

            if (!PageValidate.IsDateTime(txtPubTime.Text))
            {
                strErr += "发布时间格式错误!\\n";
            }

            if (strErr != "")
            {
                MessageBox.Show(this, strErr);
                return;
            }
            if (this.ddlTypeId.SelectedValue == "")
            {
                MessageBox.Show(this, "请选择商品类型!");
                return;
            }
            if (this.ddlBrandId.SelectedValue == "")
            {
                MessageBox.Show(this, "请选择商品品牌!");
                return;
            }
            if (this.ddlNameId.SelectedValue == "")
            {
                MessageBox.Show(this, "请选择商品名称!");
                return;
            }

            Cms.DAL.ProductInfo dal = new Cms.DAL.ProductInfo();
            model.Specifications = txtSpec.Text.Trim();
            model.ImgUrl         = txtImgUrl.Text.Trim();
            model.SmallImgUrl    = txtImgUrl.Text.Trim();
            model.Description    = Cms.Common.Utils.ToHtml(ProductDetail.Text);
            model.Click          = int.Parse(txtClick.Text.Trim());
            model.PubTime        = DateTime.Parse(txtPubTime.Text);
            model.IsTop          = 0;
            if (cblItem.Items[0].Selected == true)
            {
                model.IsTop = 1;
            }
            model.TypeId  = int.Parse(this.ddlTypeId.SelectedValue.Trim());
            model.BrandId = int.Parse(this.ddlBrandId.SelectedValue.Trim());
            model.NameId  = int.Parse(this.ddlNameId.SelectedValue.Trim());

            bool rel = dal.Update(model);

            if (rel)
            {
                MessageBox.Show(this, "产品型号信息修改成功!");
                //Coolite.Ext.Web.Ext.MessageBox.Alert("提示", "产品型号信息修改成功").Show();
            }
            else
            {
                MessageBox.Show(this, "发布过程中发生错误!");
                //Coolite.Ext.Web.Ext.MessageBox.Alert("提示", "发布过程中发生错误").Show();
            }
        }
Esempio n. 20
0
        /// <summary>
        /// 热卖产品图片列表
        /// </summary>
        /// <returns></returns>
        public static string hotProdcutList()
        {
            Cms.DAL.ProductInfo dal = new Cms.DAL.ProductInfo();
            Cms.DAL.Channel chnDal = new Cms.DAL.Channel();
            StringBuilder strTxt = new StringBuilder();
            DataSet proSpecDS = dal.GetTopProductList(6, "IsTop > 0", " order by SpecificationsOrder");
            DataTable proSpecTBL = proSpecDS.Tables[0];
            if (proSpecTBL.Rows.Count > 0)
            {
                int colum = 1;
                for (int i = 0; i < proSpecTBL.Rows.Count; i++)
                {
                    DataRow proRow = proSpecTBL.Rows[i];
                    //标题
                    int brandId = int.Parse(proRow["BrandID"].ToString());
                    string title = chnDal.GetProductBrandTitle(brandId) + " " + proRow["Specifications"].ToString();
                    //内容
                    int nameId = int.Parse(proRow["ComoditiesNameId"].ToString());
                    string content = "商品名字:" + chnDal.GetProductNameTitle(nameId) + "<BR/>";

                    if (colum == 1)
                    {
                        strTxt.Append("<tr>");
                    }
                    strTxt.Append("<td width=\"310\" height=\"60\">");
                    strTxt.Append("<table cellpadding=\"1\" cellspacing=\"1\">");
                    strTxt.Append("<td>");
                    strTxt.Append("<a href=\"productView.aspx?specId=" + proRow["SpecificationsId"].ToString() + "\">");
                    strTxt.Append("<img src=\"Tools/Http_ImgLoad.ashx?w=80&h=60&gurl=" + proRow["SmallImgUrl"].ToString() + "\" height=\"60\" width=\"80\" border=\"1\"/>");
                    strTxt.Append("</a>");
                    strTxt.Append("</td>");
                    strTxt.Append("<td width=\"220\">");
                    strTxt.Append("<table cellpadding=\"1\" cellspacing=\"1\" style=\"position:relative;left:10px; width:210px; top: 0px;\">");
                    strTxt.Append("<tr>");
                    strTxt.Append("");
                    strTxt.Append("<td style=\"height:15px;\">");
                    strTxt.Append("<strong>" + title + "</strong>");
                    strTxt.Append("</td>");
                    strTxt.Append("</tr>");
                    strTxt.Append("<tr>");
                    strTxt.Append("<td align=\"left\" valign=\"top\">");
                    strTxt.Append(content + "[<a href=\"productView.aspx?specId=" + proRow["SpecificationsId"].ToString() + "\"><U>详细</U></a>]");
                    strTxt.Append("</td>");
                    strTxt.Append("</tr>");
                    strTxt.Append("</table>");
                    strTxt.Append("</td>");
                    strTxt.Append("</table>");
                    strTxt.Append("</td>");
                    if (colum == 2)
                    {
                        strTxt.Append("</tr>");
                        colum = 1;
                    }
                    else
                        ++colum;
                }
                if (colum == 2)
                {
                    strTxt.Append("</tr>");
                    colum = 1;
                }
            }
            else
                strTxt.Append("暂无热卖产品。");
            return strTxt.ToString();
        }
Esempio n. 21
0
 protected void lbtnDel_Click(object sender, EventArgs e)
 {
     Cms.DAL.ProductInfo dal = new Cms.DAL.ProductInfo();
     bool hasDeleted = false;
     //批量删除
     for (int i = 0; i < rptList.Items.Count; i++)
     {
         int id = Convert.ToInt32(((Label)rptList.Items[i].FindControl("lb_id")).Text);
         CheckBox cb = (CheckBox)rptList.Items[i].FindControl("cb_id");
         if (cb.Checked)
         {
             //删除记录
             hasDeleted = true;
             dal.Delete(id);
         }
     }
     if (hasDeleted)
         MessageBox.Show(this, "批量删除成功!");
     else
         MessageBox.Show(this, "没有选中记录!");
     RptBind();
 }
        protected void lbtnImport_Click(object sender, EventArgs e)
        {
            string fullPath = HttpContext.Current.Server.MapPath(importFilePath.Text);

            if (!File.Exists(fullPath))
            {
                //保存日志
                MessageBox.Show(this, "请上传导入文件!");
                return;
            }

            DataSet   ds = ExcelToDS(fullPath);
            DataTable tb = ds.Tables[0];

            if (tb.Rows.Count > 0)
            {
                Cms.DAL.Channel     dal    = new Cms.DAL.Channel();
                Cms.DAL.ProductInfo proDAL = new Cms.DAL.ProductInfo();
                for (int i = 0; i < tb.Rows.Count; i++)
                {
                    DataRow proRow  = tb.Rows[i];
                    string  type    = proRow["商品类型"].ToString();
                    string  brand   = proRow["商品品牌"].ToString();
                    string  name    = proRow["商品名称"].ToString();
                    string  spec    = proRow["商品型号"].ToString();
                    int     procNum = int.Parse(proRow["数量"].ToString());

                    int typeID = dal.GetProductTypeID(type);
                    if (typeID == -1)
                    {
                        typeID = dal.AddProductType(type);
                    }

                    int brandID = dal.GetProductBrandID(brand, typeID);
                    if (brandID == -1)
                    {
                        brandID = dal.AddProductBrand(brand, typeID);
                    }

                    int nameID = dal.GetProductNameID(name, typeID, brandID);
                    if (nameID == -1)
                    {
                        nameID = dal.AddProductName(name, typeID, brandID);
                    }

                    int specID = 0;
                    if (!proDAL.Exists(spec, typeID, brandID, nameID))
                    {
                        Cms.Model.ProductInfo model = new Cms.Model.ProductInfo();
                        model.Specifications = spec;
                        model.ImgUrl         = "";
                        model.SmallImgUrl    = "";
                        model.Description    = "";
                        model.Click          = 0;
                        model.PubTime        = DateTime.Now;
                        model.IsTop          = 0;
                        model.TypeId         = typeID;
                        model.BrandId        = brandID;
                        model.NameId         = nameID;

                        specID = proDAL.Add(model);
                    }

                    if (specID > 0)
                    {
                        proDAL.AddStock(typeID, brandID, nameID, specID, procNum, procNum);
                    }
                }
            }
            File.Delete(fullPath);

            //保存日志
            MessageBox.Show(this, "数据导入成功!");
        }
Esempio n. 23
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!int.TryParse(Request.Params["specId"] as string, out this.specId))
            {
                Response.Write("<script>alert('您要查看的信息参数不正确或不存在!');history.go(-1);</script>");
                return;
            }

            Cms.DAL.ProductInfo dal = new Cms.DAL.ProductInfo();
            model = dal.GetModel(this.specId);//获得Id
            if (model == null)
            {
                Response.Write("<script>alert('您要查看的信息参数不正确或不存在!');history.go(-1);</script>");
                return;
            }
            if (!Page.IsPostBack)
            {
                //赋值
                showInfo();
            }
        }
Esempio n. 24
0
        /// <summary>
        /// 热卖产品图片列表
        /// </summary>
        /// <returns></returns>
        public static string hotProdcutList()
        {
            Cms.DAL.ProductInfo dal        = new Cms.DAL.ProductInfo();
            Cms.DAL.Channel     chnDal     = new Cms.DAL.Channel();
            StringBuilder       strTxt     = new StringBuilder();
            DataSet             proSpecDS  = dal.GetTopProductList(6, "IsTop > 0", " order by SpecificationsOrder");
            DataTable           proSpecTBL = proSpecDS.Tables[0];

            if (proSpecTBL.Rows.Count > 0)
            {
                int colum = 1;
                for (int i = 0; i < proSpecTBL.Rows.Count; i++)
                {
                    DataRow proRow = proSpecTBL.Rows[i];
                    //标题
                    int    brandId = int.Parse(proRow["BrandID"].ToString());
                    string title   = chnDal.GetProductBrandTitle(brandId) + " " + proRow["Specifications"].ToString();
                    //内容
                    int    nameId  = int.Parse(proRow["ComoditiesNameId"].ToString());
                    string content = "商品名字:" + chnDal.GetProductNameTitle(nameId) + "<BR/>";

                    if (colum == 1)
                    {
                        strTxt.Append("<tr>");
                    }
                    strTxt.Append("<td width=\"310\" height=\"60\">");
                    strTxt.Append("<table cellpadding=\"1\" cellspacing=\"1\">");
                    strTxt.Append("<td>");
                    strTxt.Append("<a href=\"productView.aspx?specId=" + proRow["SpecificationsId"].ToString() + "\">");
                    strTxt.Append("<img src=\"Tools/Http_ImgLoad.ashx?w=80&h=60&gurl=" + proRow["SmallImgUrl"].ToString() + "\" height=\"60\" width=\"80\" border=\"1\"/>");
                    strTxt.Append("</a>");
                    strTxt.Append("</td>");
                    strTxt.Append("<td width=\"220\">");
                    strTxt.Append("<table cellpadding=\"1\" cellspacing=\"1\" style=\"position:relative;left:10px; width:210px; top: 0px;\">");
                    strTxt.Append("<tr>");
                    strTxt.Append("");
                    strTxt.Append("<td style=\"height:15px;\">");
                    strTxt.Append("<strong>" + title + "</strong>");
                    strTxt.Append("</td>");
                    strTxt.Append("</tr>");
                    strTxt.Append("<tr>");
                    strTxt.Append("<td align=\"left\" valign=\"top\">");
                    strTxt.Append(content + "[<a href=\"productView.aspx?specId=" + proRow["SpecificationsId"].ToString() + "\"><U>详细</U></a>]");
                    strTxt.Append("</td>");
                    strTxt.Append("</tr>");
                    strTxt.Append("</table>");
                    strTxt.Append("</td>");
                    strTxt.Append("</table>");
                    strTxt.Append("</td>");
                    if (colum == 2)
                    {
                        strTxt.Append("</tr>");
                        colum = 1;
                    }
                    else
                    {
                        ++colum;
                    }
                }
                if (colum == 2)
                {
                    strTxt.Append("</tr>");
                    colum = 1;
                }
            }
            else
            {
                strTxt.Append("暂无热卖产品。");
            }
            return(strTxt.ToString());
        }