示例#1
0
        /// <summary>
        /// 获取二级列表
        /// </summary>
        void LoadData(string where)
        {
            MSProductCategoryDAL categoryDal = new MSProductCategoryDAL();

            cname = Common.Common.NoHtml(Request["scid"]);
            try
            {
                cname = categoryDal.GetMSPCategoryValueByID("Cname", cname).ToString();
            }
            catch (Exception)
            {
            }

            MSProductDAL pruductDal = new MSProductDAL();
            DataSet      ds         = pruductDal.GetSecHandProduct(where);
            DataView     dv         = ds.Tables[0].DefaultView;

            AspNetPager1.RecordCount = dv.Count;
            PagedDataSource pds = new PagedDataSource();

            pds.DataSource       = dv;
            pds.AllowPaging      = true;
            pds.CurrentPageIndex = AspNetPager1.CurrentPageIndex - 1;
            pds.PageSize         = AspNetPager1.PageSize;
            Repeater1.DataSource = pds;
            Repeater1.DataBind();
        }
示例#2
0
        /// <summary>
        /// 输出到页面
        /// </summary>
        void GetHtmlInfo()
        {
            MSProduct            ProductModel = new MSProduct();
            MSProductDAL         ProductDal = new MSProductDAL();
            MSProductCategory    categoryModel = new MSProductCategory();
            MSProductCategoryDAL categoryDal = new MSProductCategoryDAL();
            DataSet detailds = null; string cid = string.Empty; string bigcid = string.Empty;

            #region ------------------产品详细-------------------------
            if (pid.Trim() != null && pid.Trim() != "")
            {
                detailds = ProductDal.GetProductDetail(pid);
                if (detailds != null && detailds.Tables.Count > 0 && detailds.Tables[0].Rows.Count > 0)
                {
                    ProductModel = DataConvert.DataRowToModel <MSProduct>(detailds.Tables[0].Rows[0]);
                    cid          = ProductModel.Cid;
                }
            }
            #endregion
            #region -----------类别绑定---------------
            if (cid != null && cid != "")
            {
                string upid = string.Empty;
                try
                {
                    upid = categoryDal.GetMSPCategoryValueByID("UpID", cid).ToString();
                }
                catch (Exception)
                {
                }
                if (upid != null && upid != "")
                {
                    bigcid = upid;
                }
                else
                {
                    bigcid = cid;
                }
            }
            #endregion
            #region -------------获取图集---------------
            MSProductAtlasDAL atlasDal = new MSProductAtlasDAL();
            DataSet           atlasDs  = atlasDal.GetProductAtlasByPID(pid);
            int rowcount = 0; atlaslist = "";
            if (atlasDs != null && atlasDs.Tables.Count > 0 && atlasDs.Tables[0].Rows.Count > 0)
            {
                rowcount = atlasDs.Tables[0].Rows.Count;
                for (int i = 0; i < rowcount; i++)
                {
                    string imgurl  = atlasDs.Tables[0].Rows[i]["PimgUrl"].ToString();
                    string imgid   = atlasDs.Tables[0].Rows[i]["ID"].ToString();
                    string datarow = string.Empty;
                    atlaslist += "\r\n<dd type=\"image\">\r\n" +
                                 "<input type=\"file\" accept=\"image/jpg, image/jpeg, image/png\" " +
                                 "onchange=\"form_pics.addImg(this);\" name=\"pics" + i + "\"><img dataid=\"" + imgid +
                                 "\" src=\"" + imgurl + "\">" +
                                 "\r\n<span onclick=\"form_pics.removeImg(this);\">&nbsp;</span>\r\n" +
                                 "</dd>";
                }
            }
            if (rowcount < 8)
            {
                atlaslist += "\r\n<dd>\r\n" +
                             "<input type=\"file\" accept=\"image/jpg, image/jpeg, image/png\" " +
                             "onchange=\"form_pics.addImg(this);\" name=\"pics" + rowcount + "\"><img src=\"images/upload.png\">" +
                             "\r\n<span onclick=\"form_pics.removeImg(this);\">&nbsp;</span>\r\n" +
                             "</dd>";
            }
            altascount = rowcount;
            #endregion
            #region ------------------绑定型号------------------
            List <MSProductPara> paralistmodel = new List <MSProductPara>();
            MSProductParaDAL     paraDal       = new MSProductParaDAL();
            DataSet parads = paraDal.GetProductParamByPID(pid);
            if (parads != null && parads.Tables.Count > 0 && parads.Tables[0].Rows.Count > 0)
            {
                foreach (DataRow row in parads.Tables[0].Rows)
                {
                    MSProductPara paramodel = DataConvert.DataRowToModel <MSProductPara>(row);
                    paralistmodel.Add(paramodel);
                }
            }
            #endregion

            string text = System.IO.File.ReadAllText(Server.MapPath("../ShopPage/EditeProduct.html"));
            JinianNet.JNTemplate.TemplateContext context = new JinianNet.JNTemplate.TemplateContext();

            context.TempData["customid"]    = customerid;
            context.TempData["atlaslist"]   = atlaslist;
            context.TempData["altascount"]  = altascount;
            context.TempData["cid"]         = cid;
            context.TempData["bigcid"]      = bigcid;
            context.TempData["pdetail"]     = ProductModel;
            context.TempData["paralist"]    = paralistmodel;
            context.TempData["footer"]      = "奥琦微商易";
            context.TempData["errorscript"] = errorscript;

            JinianNet.JNTemplate.Template t = new JinianNet.JNTemplate.Template(context, text);
            t.Render(Response.Output);
        }
 /// <summary>
 /// 获取类别
 /// </summary>
 void getinfo()
 {
     #region -----------一级导航绑定-----------
     ddlbigcategorylist.Items.Clear();
     MSProductCategoryDAL categoryDal = new MSProductCategoryDAL();
     DataSet ds = new DataSet();
     ds = categoryDal.GetSecHandCategoryList(" and UpID='' and CsecHand=" + ishand);
     ddlbigcategorylist.DataSource     = ds.Tables[0].DefaultView;
     ddlbigcategorylist.DataTextField  = "Cname";
     ddlbigcategorylist.DataValueField = "ID";
     ddlbigcategorylist.DataBind();
     #endregion
     string cid = string.Empty; string bigcid = string.Empty;
     if (pid.Trim() != null && pid.Trim() != "")
     {
         MSProductDAL productDal   = new MSProductDAL();
         DataSet      productds    = productDal.GetProductDetail(pid);
         MSProduct    productModel = DataConvert.DataRowToModel <MSProduct>(productds.Tables[0].Rows[0]);
         cid          = productModel.Cid;
         ptitle.Value = productModel.Ptitle;
         pdesc.Value  = productModel.Pcontent;
         price.Value  = productModel.Price.ToString();
         Review       = productModel.Review;
         #region -----------获取一级类别编号------------
         if (cid != null && cid != "")
         {
             string upid = string.Empty;
             try
             {
                 upid = categoryDal.GetMSPCategoryValueByID("UpID", cid).ToString();
             }
             catch (Exception)
             {
             }
             if (upid != null && upid != "")
             {
                 bigcid = upid;
             }
             else
             {
                 bigcid = cid;
             }
             setpvalue.Value = cid;
         }
         #endregion
         ddlbigcategorylist.SelectedIndex =
             ddlbigcategorylist.Items.IndexOf(ddlbigcategorylist.Items.FindByValue(bigcid));
         #region ------------二级导航绑定------------------
         if (bigcid != null && bigcid != "")
         {
             ddlsmallcategorylist.Items.Clear();
             ds = categoryDal.GetSecHandCategoryList(" and UpID='" + bigcid + "' ");
             ddlsmallcategorylist.DataSource     = ds.Tables[0].DefaultView;
             ddlsmallcategorylist.DataTextField  = "Cname";
             ddlsmallcategorylist.DataValueField = "ID";
             ddlsmallcategorylist.DataBind();
             if (cid != null && cid != "")
             {
                 ddlsmallcategorylist.SelectedIndex =
                     ddlsmallcategorylist.Items.IndexOf(ddlsmallcategorylist.Items.FindByValue(cid));
             }
         }
         #endregion
         #region -------------获取图集---------------
         MSProductAtlasDAL atlasDal = new MSProductAtlasDAL();
         DataSet           atlasDs  = atlasDal.GetProductAtlasByPID(pid);
         int rowcount = 0; atlaslist = "";
         if (atlasDs != null && atlasDs.Tables.Count > 0 && atlasDs.Tables[0].Rows.Count > 0)
         {
             rowcount = atlasDs.Tables[0].Rows.Count;
             for (int i = 0; i < rowcount; i++)
             {
                 string imgurl  = atlasDs.Tables[0].Rows[i]["PimgUrl"].ToString();
                 string imgid   = atlasDs.Tables[0].Rows[i]["ID"].ToString();
                 string datarow = string.Empty;
                 atlaslist += "\r\n<dd type=\"image\">\r\n" +
                              "<input type=\"file\" accept=\"image/jpg, image/jpeg, image/png\" " +
                              "onchange=\"form_pics.addImg(this);\" name=\"pics" + i + "\"><img dataid=\"" + imgid +
                              "\" src=\"" + imgurl + "\">" +
                              "\r\n<span onclick=\"form_pics.removeImg(this);\">&nbsp;</span>\r\n" +
                              "</dd>";
             }
         }
         if (rowcount < 8)
         {
             atlaslist += "\r\n<dd datacount=\"" + rowcount + "\">\r\n" +
                          "<input type=\"file\" accept=\"image/jpg, image/jpeg, image/png\" " +
                          "onchange=\"form_pics.addImg(this);\" name=\"pics" + rowcount + "\"><img src=\"images/upload.png\">" +
                          "\r\n<span onclick=\"form_pics.removeImg(this);\">&nbsp;</span>\r\n" +
                          "</dd>";
         }
         altascount = rowcount;
         #endregion
         #region ----------------根据产品编号获取联系方式--------------------
         MSShopContactsDAL contactDal = new MSShopContactsDAL();
         DataSet           contactDs  = contactDal.GetContactDetailByPID(pid);
         if (contactDs != null && contactDs.Tables.Count > 0 && contactDs.Tables[0].Rows.Count > 0)
         {
             string uphone = string.Empty; string uname = string.Empty;
             uphone          = contactDs.Tables[0].Rows[0]["Phone"].ToString();
             uname           = contactDs.Tables[0].Rows[0]["NickName"].ToString();
             contactID       = contactDs.Tables[0].Rows[0]["ID"].ToString();
             UserPhone.Value = uphone;
             UserName.Value  = uname;
         }
         #endregion
     }
 }