예제 #1
0
        /// <summary>
        /// 获取类别
        /// </summary>
        void getinfo()
        {
            ddlbigcategorylist.Items.Clear();
            MSProductCategoryDAL categoryDal = new MSProductCategoryDAL();
            DataSet ds = new DataSet();

            ds = categoryDal.GetSecHandCategoryList(" and UpID='' and CsecHand=" + ishand);
            DataTable dt = ds.Tables[0];
            DataRow   dr = ds.Tables[0].NewRow();

            dr["ID"]    = "";
            dr["Cname"] = "--请选择类别--";
            dt.Rows.InsertAt(dr, 0);
            ddlbigcategorylist.DataSource     = ds.Tables[0].DefaultView;
            ddlbigcategorylist.DataTextField  = "Cname";
            ddlbigcategorylist.DataValueField = "ID";
            ddlbigcategorylist.DataBind();
            MSCustomersDAL customerDal = new MSCustomersDAL();

            if (Session["customerID"] != null && Session["customerID"].ToString() != "")
            {
                phone = customerDal.GetCustomerValueByID("Phone", Session["customerID"].ToString()).ToString();
            }
            UserPhone.Value = phone;
        }
예제 #2
0
        void GetOptionList()
        {
            string subid = string.Empty;

            if (Request["subid"] != null && Request["subid"] != "")
            {
                subid = Common.Common.NoHtml(Request["subid"]);
            }
            else
            {
                return;
            }
            if (subid.Trim() != null && subid.Trim() != "")
            {
                MSProductCategoryDAL CateDal = new MSProductCategoryDAL();
                DataSet optionds;
                optionds = CateDal.GetMSPCList(" and a.[SID]='" + subid + "' ");
                Response.Write(Dataset2Json(optionds));
            }
            else
            {
                Response.Write("{\"success\":\"操作失败\"}");
            }
            Response.End();
        }
예제 #3
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();
        }
예제 #4
0
        /// <summary>
        /// 获取二级导航
        /// </summary>
        void GetOptionList()
        {
            string subid = string.Empty;

            if (Request["subid"] != null && Request["subid"] != "")
            {
                subid = Common.Common.NoHtml(Request["subid"]);
            }
            else
            {
                return;
            }
            if (subid.Trim() != null && subid.Trim() != "")
            {
                MSProductCategoryDAL categoryDal = new MSProductCategoryDAL();
                DataSet ds = new DataSet();
                ds = categoryDal.GetSecHandCategoryList(" and UpID='" + subid + "' ");
                Response.Write(Dataset2Json(ds));
            }
            else
            {
                Response.Write("{\"success\":\"操作失败\"}");
            }
            Response.End();
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (null != Common.Common.NoHtml(Request.QueryString["action"]))
            {
                strAction = Common.Common.NoHtml(Request.QueryString["action"]);
            }
            if (null != Common.Common.NoHtml(Request.QueryString["id"]))
            {
                strID = Common.Common.NoHtml(Request.QueryString["id"]);
            }

            MSProductCategoryDAL dal = new MSProductCategoryDAL();

            switch (strAction)
            {
            case "del":
                if (dal.UpdateMSPCState(strID))
                {
                    strMessage = "操作成功!";
                }
                else
                {
                    strMessage = "操作失败!";
                }
                break;
            }
            Response.Write(strMessage);
            Response.End();
        }
예제 #6
0
 protected void btnSave_Click(object sender, EventArgs e)
 {
     if (Session["strLoginName"].ToString() != null && Session["strLoginName"].ToString() != "")
     {
         if (ddlcategorylist.SelectedValue.Trim() != null && ddlcategorylist.SelectedValue.Trim() != "")
         {
             if (cname.Text.Trim() != null && cname.Text.Trim() != "")
             {
                 MSProductCategoryDAL categoryDal = new MSProductCategoryDAL();
                 if (categoryDal.ExistMSPC("", ddlcategorylist.SelectedValue.Trim(), cname.Text))
                 {
                     MessageBox.Show(this, "该类别已经存在!");
                 }
                 else
                 {
                     MSProductCategory categoryModel = new MSProductCategory();
                     string parm = "";
                     categoryModel.SID = parm;
                     if (sch != null && sch != "")
                     {
                         categoryModel.CsecHand = Convert.ToInt32(sch);
                     }
                     if (ddlcategorylist.SelectedValue.Trim() != "0")
                     {
                         parm = ddlcategorylist.SelectedValue;
                     }
                     categoryModel.UpID = parm;
                     if (sortin.Text.Trim() != null && sortin.Text.Trim() != "")
                     {
                         categoryModel.Sortin = Convert.ToInt32(sortin.Text);
                     }
                     categoryModel.Cname = cname.Text;
                     categoryModel.Cstate = 0;
                     categoryModel.ID = Guid.NewGuid().ToString("N").ToUpper();
                     if (categoryDal.AddMSPCategory(categoryModel))
                     {
                         MessageBox.Show(this, "操作成功!");
                     }
                     else
                     {
                         MessageBox.Show(this, "操作失败!");
                     }
                 }
             }
             else
             {
                 MessageBox.Show(this, "请输入相应名称!");
             }
         }
         else
         {
             MessageBox.Show(this, "请选择相应的类别!");
         }
     }
     else
     {
         return;
     }
 }
예제 #7
0
        /// <summary>
        /// 页面加载事件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                if (Session["strLoginName"].ToString() != null && Session["strLoginName"].ToString() != "")
                {
                    if (Request["sch"] != null && Request["sch"] != "")
                    {
                        sch =Request["sch"];
                    }
                    else
                    {
                        sch = "";
                    }

                    ddlcategorylist.Items.Clear();
                    MSProductCategoryDAL categoryDal = new MSProductCategoryDAL();
                    DataSet ds = new DataSet();
                    ds = categoryDal.GetSecHandCategoryList(" and UpID='' and CsecHand="+sch+" ");
                    DataTable dt = ds.Tables[0];
                    DataRow dr = ds.Tables[0].NewRow();
                    dr["ID"] = "";
                    dr["Cname"] = "--请选择类别--";
                    dt.Rows.InsertAt(dr, 0);
                    DataRow firstdr = ds.Tables[0].NewRow();
                    firstdr["ID"] = "0";
                    firstdr["Cname"] = "--添加顶级导航--";
                    dt.Rows.InsertAt(firstdr, 1);
                    ddlcategorylist.DataSource = ds.Tables[0].DefaultView;
                    ddlcategorylist.DataTextField = "Cname";
                    ddlcategorylist.DataValueField = "ID";
                    ddlcategorylist.DataBind();

                    #region 初始化界面
                    if (null != Common.Common.NoHtml(Request.QueryString["action"]))
                    {
                        strAction = Common.Common.NoHtml(Request.QueryString["action"]);
                    }
                    if (null != Common.Common.NoHtml(Request.QueryString["id"]))
                    {
                        strID = Common.Common.NoHtml(Request.QueryString["id"]);
                    }
                    #endregion
                }
                else
                {
                    return;
                }
            }
        }
예제 #8
0
        /// <summary>
        /// 获取二级列表
        /// </summary>
        void LoadData(string where)
        {
            MSProductCategoryDAL categoryDal = new MSProductCategoryDAL();
            MSProductDAL         pruductDal  = new MSProductDAL();
            DataSet  ds = pruductDal.GetProductByTop(0, 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();
        }
 protected void btnSave_Click(object sender, EventArgs e)
 {
     if (Session["strLoginName"].ToString() != null && Session["strLoginName"].ToString() != "")
     {
         if (cname.Text.Trim() != null && cname.Text.Trim() != "")
         {
             MSProductCategoryDAL categoryDal   = new MSProductCategoryDAL();
             MSProductCategory    categoryModel = new MSProductCategory();
             categoryModel.Cname = cname.Text;
             string parm = "";
             categoryModel.SID = parm;
             if (ddlcategorylist.SelectedValue.Trim() != "0")
             {
                 parm = ddlcategorylist.SelectedValue;
             }
             categoryModel.UpID = parm;
             if (sortin.Text.Trim() != null && sortin.Text.Trim() != "")
             {
                 categoryModel.Sortin = Convert.ToInt32(sortin.Text);
             }
             categoryModel.Cstate = 0;
             categoryModel.ID     = strID;
             if (sch != null && sch != "")
             {
                 categoryModel.CsecHand = Convert.ToInt32(sch);
             }
             if (categoryDal.UpdateMSPCategory(categoryModel))
             {
                 MessageBox.Show(this, "操作成功!");
             }
             else
             {
                 MessageBox.Show(this, "操作失败!");
             }
         }
         else
         {
             MessageBox.Show(this, "请输入相应名称或店铺!");
         }
     }
     else
     {
         return;
     }
 }
예제 #10
0
        void showdetailinfo()
        {
            ddlcategorylist.Items.Clear();
            MSProductCategoryDAL selectcategoryDal = new MSProductCategoryDAL();
            DataSet ds = new DataSet();

            ds = selectcategoryDal.GetCategoryList(" and UpID='' and [SID]!='' ");
            DataTable dt      = ds.Tables[0];
            DataRow   dr      = ds.Tables[0].NewRow();
            DataRow   firstdr = ds.Tables[0].NewRow();

            firstdr["ID"]    = "0";
            firstdr["Cname"] = "顶级导航";
            dt.Rows.InsertAt(firstdr, 0);
            ddlcategorylist.DataSource     = ds.Tables[0].DefaultView;
            ddlcategorylist.DataTextField  = "Cname";
            ddlcategorylist.DataValueField = "ID";
            ddlcategorylist.DataBind();

            MSProductCategoryDAL categoryDal = new MSProductCategoryDAL();
            DataSet           categoryDs     = categoryDal.GetCategoryDetail(strID);
            MSProductCategory categoryModel  = DataConvert.DataRowToModel <MSProductCategory>(categoryDs.Tables[0].Rows[0]);

            cname.Text = categoryModel.Cname;
            string parm = string.Empty;

            if (categoryModel.UpID.Trim() != null && categoryModel.UpID.Trim() != "")
            {
                parm = categoryModel.UpID;
            }
            else
            {
                parm = "0";
            }
            ddlcategorylist.SelectedIndex =
                ddlcategorylist.Items.IndexOf(ddlcategorylist.Items.FindByValue(parm));
            sortin.Text = categoryModel.Sortin.ToString();
            if (strAction == "show")
            {
                this.btnReset.Visible = false;
                this.btnSave.Visible  = false;
            }
        }
예제 #11
0
        /// <summary>
        /// 页面加载事件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                if (Session["strLoginName"].ToString() != null && Session["strLoginName"].ToString() != "")
                {
                    if (Request["sid"] != null && Request["sid"] != "")
                    {
                        sid = " and [SID]=" + Request["sid"] + " ";
                    }
                    else
                    {
                        sid = " and [SID]!='' ";
                    }
                    ddlcategorylist.Items.Clear();
                    MSProductCategoryDAL categoryDal = new MSProductCategoryDAL();
                    DataSet ds = new DataSet();
                    ds = categoryDal.GetCategoryList(" and UpID='' " + sid);
                    DataTable dt = ds.Tables[0];
                    DataRow   dr = ds.Tables[0].NewRow();
                    dr["ID"]    = "";
                    dr["Cname"] = "--全部--";
                    dt.Rows.InsertAt(dr, 0);
                    DataRow firstdr = ds.Tables[0].NewRow();
                    firstdr["ID"]    = "0";
                    firstdr["Cname"] = "顶级导航";
                    dt.Rows.InsertAt(firstdr, 1);
                    ddlcategorylist.DataSource     = ds.Tables[0].DefaultView;
                    ddlcategorylist.DataTextField  = "Cname";
                    ddlcategorylist.DataValueField = "ID";
                    ddlcategorylist.DataBind();

                    AspNetPager1.CurrentPageIndex = 1;
                    string s = " and UpID='' " + sid;
                    ViewState[vsKey] = s;
                    LoadData(s);
                }
                else
                {
                    return;
                }
            }
        }
예제 #12
0
        /// <summary>
        /// 获取类别列表
        /// </summary>
        void GetOptionList()
        {
            string subid = string.Empty;

            if (Request["subid"] != null && Request["subid"] != "")
            {
                subid = Common.Common.NoHtml(Request["subid"]);
                subid = " and UpID='" + subid + "' ";
            }
            if (sid != null && sid != "")
            {
                sid = " and [SID]='" + sid + "' ";
            }
            MSProductCategoryDAL categoryDal = new MSProductCategoryDAL();
            DataSet ds = new DataSet();

            ds = categoryDal.GetCategoryList(subid + sid + " and CsecHand=0 ");
            if (ds != null && ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0)
            {
                Response.Write(Dataset2Json(ds));
            }
            Response.End();
        }
예제 #13
0
        /// <summary>
        /// 获取店铺商品信息
        /// </summary>
        void GetInfo()
        {
            #region 获取店铺详细
            MSShopDAL shopdal   = new MSShopDAL();
            DataSet   shopds    = shopdal.GetMSShopDetail(shopid);
            MSShop    shopmodel = new MSShop();
            string    pagetitle = string.Empty;
            if (null != shopds && shopds.Tables.Count > 0 && shopds.Tables[0].Rows.Count > 0)
            {
                shopmodel = DataConvert.DataRowToModel <MSShop>(shopds.Tables[0].Rows[0]);
                pagetitle = shopmodel.ShopName;
            }
            #endregion

            List <MSProduct> ProductModel = new List <MSProduct>();
            MSProductDAL     productdal   = new MSProductDAL();

            MSProductAtlasDAL     atlasDal   = new MSProductAtlasDAL();
            List <MSProductAtlas> AtlasModel = new List <MSProductAtlas>();

            List <ProductPara> ParaListModel = new List <ProductPara>();
            MSProductParaDAL   paraDal       = new MSProductParaDAL();

            string thpid = string.Empty;
            #region 获取产品列表
            DataSet productds = null; string cid = string.Empty; string like = string.Empty;
            if (Request["cid"] != null && Request["cid"] != "")
            {
                cid = Common.Common.NoHtml(Request["cid"]);
            }
            if (cid.Trim() != null && cid.Trim() != "")
            {
                cid = " and a.[CID]='" + cid + "' ";
            }
            if (Request["like"] != null && Request["like"] != "")
            {
                like = Common.Common.NoHtml(Request["like"]);
            }
            if (like.Trim() != null && like.Trim() != "")
            {
                like = " and a.Ptitle like '%" + like + "%' ";
            }
            productds = productdal.GetProductList(" and a.[SID]='" + shopid + "' " + cid + like);
            DataSet atlasDs = null;
            foreach (DataRow row in productds.Tables[0].Rows)
            {
                MSProduct model = DataConvert.DataRowToModel <MSProduct>(row);
                string    pdesc = model.Pcontent;
                pdesc = JQDialog.GetTextFromHTML(pdesc);
                if (pdesc.Length > 50)
                {
                    pdesc = pdesc.ToString().Substring(0, 50) + "...";
                }
                model.Pcontent = pdesc;
                ProductModel.Add(model);
                thpid = model.ID;

                #region 获取产品默认展示图
                atlasDs = atlasDal.GetDefaultAtlasByPid(thpid);
                foreach (DataRow atlasrow in atlasDs.Tables[0].Rows)
                {
                    MSProductAtlas atlasdetailmodel = DataConvert.DataRowToModel <MSProductAtlas>(atlasrow);
                    AtlasModel.Add(atlasdetailmodel);
                }
                #endregion

                #region -------获取产品型号及价格------------
                DataSet parads = paraDal.GetMaxMinPrice(thpid);
                if (parads != null && parads.Tables.Count > 0 && parads.Tables[0].Rows.Count > 0)
                {
                    foreach (DataRow pararow in parads.Tables[0].Rows)
                    {
                        ProductPara paramodel = DataConvert.DataRowToModel <ProductPara>(pararow);
                        ParaListModel.Add(paramodel);
                    }
                }
                #endregion
            }
            #endregion

            #region 获取产品类别
            List <MSProductCategory> CategoryModel = new List <MSProductCategory>();
            MSProductCategoryDAL     categorydal   = new MSProductCategoryDAL();
            DataSet categoryds = categorydal.GetMSPCList(" and a.[SID]='" + shopid + "' ");
            foreach (DataRow row in categoryds.Tables[0].Rows)
            {
                MSProductCategory model = DataConvert.DataRowToModel <MSProductCategory>(row);
                CategoryModel.Add(model);
            }
            #endregion

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

            context.TempData["title"]        = pagetitle;
            context.TempData["ShopDetail"]   = shopmodel;
            context.TempData["shopid"]       = shopid;
            context.TempData["productlist"]  = ProductModel;
            context.TempData["defaultatlas"] = AtlasModel;
            context.TempData["categorylist"] = CategoryModel;
            context.TempData["paralist"]     = ParaListModel;
            context.TempData["errormsg"]     = errormsg;
            context.TempData["customerid"]   = customerid;
            if (Session["customerID"] != null && Session["customerID"].ToString() != "")
            {
                context.TempData["uid"] = Session["customerID"].ToString();
            }
            context.TempData["footer"] = "奥琦微商易";

            JinianNet.JNTemplate.Template t = new JinianNet.JNTemplate.Template(context, text);
            t.Render(Response.Output);
        }
예제 #14
0
        void GetCategoryList()
        {
            #region -------------------获取类别---------------------
            MSProductCategory    CategoryModel = new MSProductCategory();
            MSProductCategoryDAL CategoryDal   = new MSProductCategoryDAL();
            DataSet BigCategoryds   = CategoryDal.GetSecHandCategoryList(" and UpID='' and CsecHand=1 ");
            DataSet SmallCategoryds = null;
            if (BigCategoryds != null && BigCategoryds.Tables.Count > 0 && BigCategoryds.Tables[0].Rows.Count > 0)
            {
                categoryhtml = "";
                for (int i = 0; i < BigCategoryds.Tables[0].Rows.Count; i++)
                {
                    string bigcname = BigCategoryds.Tables[0].Rows[i]["cname"].ToString();
                    string bigID    = BigCategoryds.Tables[0].Rows[i]["ID"].ToString();

                    categoryhtml += "<ul class=\"list-unstyled pro_list\">";
                    categoryhtml += "\r\n<h4 class=\"col-lg-12\">" + bigcname + "</h4>";

                    SmallCategoryds = CategoryDal.GetSecHandCategoryList(" and UpID='" + bigID + "' ");
                    if (SmallCategoryds != null && SmallCategoryds.Tables.Count > 0 &&
                        SmallCategoryds.Tables[0].Rows.Count > 0)
                    {
                        for (int j = 0; j < SmallCategoryds.Tables[0].Rows.Count; j++)
                        {
                            string smallcname = SmallCategoryds.Tables[0].Rows[j]["cname"].ToString();
                            string smallID    = SmallCategoryds.Tables[0].Rows[j]["ID"].ToString();
                            categoryhtml += "\r\n<li class=\"col-lg-4 col-md-4 col-sm-4 col-xs-4 text-center\">\r\n" +
                                            "<a href=\"SecHandList.aspx?scid=" + smallID + "\">" + smallcname + "</a>\r\n" +
                                            "</li>";
                        }
                        categoryhtml += "</ul>";
                    }
                }
            }
            #endregion

            #region -----------------获取最新发布的产品列表-------------
            MSProductDAL productDal = new MSProductDAL();
            DataSet      productds  = productDal.GetProductByTop(30, " and a.IsSecHand=1  ");
            if (productds != null && productds.Tables.Count > 0 && productds.Tables[0].Rows.Count > 0)
            {
                string newpubpid = string.Empty; string newpubpname = string.Empty;
                string newpubdate;
                newpublist = "";
                for (int i = 0; i < productds.Tables[0].Rows.Count; i++)
                {
                    newpubpid   = newpubpname = newpubdate = "";
                    newpubpid   = productds.Tables[0].Rows[i]["ID"].ToString();
                    newpubpname = productds.Tables[0].Rows[i]["Ptitle"].ToString();
                    newpubdate  = productds.Tables[0].Rows[i]["AddTime"].ToString();
                    newpubdate  = Convert.ToDateTime(newpubdate).ToString("yy-MM-dd mm:ss");
                    newpubpname = Common.Common.NoHtml(newpubpname);
                    if (newpubpname.ToString().Length > 15)
                    {
                        newpubpname = newpubpname.ToString().Substring(0, 13) + "...";
                    }
                    newpublist +=
                        "<li title=\"" + newpubpname + "\">\r\n<a href=\"Product_detail.aspx?pid=" + newpubpid + "\">" +
                        newpubpname + "<span>" + newpubdate + "</span></a>\r\n</li>\r\n";
                }
            }
            #endregion
        }
예제 #15
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);
        }
예제 #16
0
 /// <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
     }
 }