protected void btnSave_Click(object sender, EventArgs e)
 {
     if (Session["strLoginName"].ToString() != null && Session["strLoginName"].ToString() != "")
     {
         if (pname.Text.Trim() != null && pname.Text.Trim() != "" &&
             price.Text.Trim() != null && price.Text.Trim() != "")
         {
             MSProductDAL productdal   = new MSProductDAL();
             MSProduct    productmodel = new MSProduct();
             productmodel.Pstate    = 0;
             productmodel.ID        = strID;
             productmodel.Ptitle    = pname.Text;
             productmodel.Price     = decimal.Parse(price.Text);
             productmodel.Pcontent  = hd_content.Value;
             productmodel.IsSecHand = isstateno.Checked ? 0 : 1;
             if (productdal.UpdateMSProduct(productmodel))
             {
                 MessageBox.Show(this, "操作成功!");
             }
             else
             {
                 MessageBox.Show(this, "操作失败!");
             }
         }
         else
         {
             MessageBox.Show(this, "请输入相应标题或价格!");
         }
     }
     else
     {
         return;
     }
 }
示例#2
0
        void GetCatOptionList()
        {
            string subid = string.Empty; string catid = string.Empty;

            if (Request["subid"] != null && Request["subid"] != "")
            {
                subid = Common.Common.NoHtml(Request["subid"]);
            }
            else
            {
                return;
            }
            if (Request["catid"] != null && Request["catid"] != "")
            {
                catid = Common.Common.NoHtml(Request["catid"]);
            }
            else
            {
                return;
            }
            if (subid.Trim() != null && subid.Trim() != "" && catid.Trim() != null && catid.Trim() != "")
            {
                MSProductDAL productDal = new MSProductDAL();
                DataSet      optionds;
                optionds = productDal.GetMSProductList(" and a.[SID]='" + subid + "' and a.[CID]='" + catid + "' ");
                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();
        }
 protected void btnSave_Click(object sender, EventArgs e)
 {
     if (Session["strLoginName"].ToString() != null && Session["strLoginName"].ToString() != "")
     {
         if (ddlshoplist.SelectedValue.Trim() != null && ddlshoplist.SelectedValue.Trim() != "" &&
             setoptionvalue.Value.Trim() != null && setoptionvalue.Value.Trim() != "")
         {
             if (pname.Text.Trim() != null && pname.Text.Trim() != "" &&
                 price.Text.Trim() != null && price.Text.Trim() != "")
             {
                 MSProductDAL productdal = new MSProductDAL();
                 if (productdal.ExistMSProduct(pname.Text, setoptionvalue.Value, ddlshoplist.SelectedValue))
                 {
                     MessageBox.Show(this, "该商品已经存在!");
                 }
                 else
                 {
                     MSProduct productmodel = new MSProduct();
                     productmodel.Pstate    = 0;
                     productmodel.ID        = Guid.NewGuid().ToString("N").ToUpper();
                     productmodel.Ptitle    = pname.Text;
                     productmodel.Price     = decimal.Parse(price.Text);
                     productmodel.SID       = ddlshoplist.SelectedValue;
                     productmodel.Pcontent  = hd_content.Value;
                     productmodel.Cid       = setoptionvalue.Value;
                     productmodel.IsSecHand = isstateno.Checked ? 0 : 1;
                     if (productdal.AddMSProduct(productmodel))
                     {
                         MessageBox.Show(this, "操作成功!");
                     }
                     else
                     {
                         MessageBox.Show(this, "操作失败!");
                     }
                 }
             }
             else
             {
                 MessageBox.Show(this, "请输入相应标题或价格!");
             }
         }
         else
         {
             MessageBox.Show(this, "请选择相应店铺和类别!");
         }
     }
     else
     {
         return;
     }
 }
示例#5
0
        void showdetailinfo()
        {
            MSProductAtlasDAL AtlasDal   = new MSProductAtlasDAL();
            DataSet           AtlasDs    = AtlasDal.GetAtlasDetail(strID);
            MSProductAtlas    AtlasModel = DataConvert.DataRowToModel <MSProductAtlas>(AtlasDs.Tables[0].Rows[0]);

            atlasname.Text = AtlasModel.AtlasName;
            string img = string.Empty; string sid = string.Empty;

            img = AtlasModel.PimgUrl;
            pid = AtlasModel.PID;
            MSProductDAL productDal = new MSProductDAL();
            MSShopDAL    shopDal    = new MSShopDAL();

            if (AtlasModel.IsDefault == 0)
            {
                isno.Checked = true;
            }
            else
            {
                isyes.Checked = true;
            }
            if (pid.Trim() != null && pid.Trim() != "")
            {
                sid = productDal.GetMSProductVaueByID("[SID]", pid).ToString();
            }
            if (sid.Trim() != null && sid.Trim() != "")
            {
                ShopPhone = shopDal.GetMSShopValueByID("Phone", sid).ToString();
            }
            else
            {
                ShopPhone = pid;
            }
            if (ShopPhone.Trim() == null || ShopPhone.Trim() == "")
            {
                ShopPhone = AtlasModel.ID;
            }
            if (img.Trim() != null && img.Trim() != "")
            {
                img0.Src = "../../PalmShop/ShopCode/" + img;
                oldimg   = img;
            }
            if (strAction == "show")
            {
                this.btnReset.Visible = false;
                this.btnSave.Visible  = false;
            }
        }
        /// <summary>
        /// 加载数据
        /// </summary>
        /// <param name="strWhere">条件</param>
        void LoadData(string strWhere)
        {
            MSProductDAL shopdal = new MSProductDAL();
            DataSet      ds      = shopdal.GetSecHandProduct(strWhere);
            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();
        }
        void showdetailinfo()
        {
            MSProductDAL productDal   = new MSProductDAL();
            DataSet      productDs    = productDal.GetProductDetail(strID);
            MSProduct    productModel = DataConvert.DataRowToModel <MSProduct>(productDs.Tables[0].Rows[0]);

            price.Text       = productModel.Price.ToString();
            pname.Text       = productModel.Ptitle;
            hd_content.Value = productModel.Pcontent;
            if (productModel.IsSecHand == 0)
            {
                isstateno.Checked = true;
            }
            else
            {
                isstateyes.Checked = true;
            }
            if (strAction == "show")
            {
                this.btnReset.Visible = false;
                this.btnSave.Visible  = false;
            }
            MSProductAtlasDAL atlasDal = new MSProductAtlasDAL();
            DataSet           atlasds  = atlasDal.GetProductAtlasByPID(strID);

            if (atlasds != null && atlasds.Tables.Count > 0 && atlasds.Tables[0].Rows.Count > 0)
            {
                atlaslist = ""; string atlasimg = string.Empty;
                for (int i = 0; i < atlasds.Tables[0].Rows.Count; i++)
                {
                    atlasimg   = atlasds.Tables[0].Rows[i]["PimgUrl"].ToString();
                    atlaslist += "<img src=\"../../PalmShop/ShopCode/" + atlasimg + "\" />";
                }
            }
            MSShopContactsDAL contactDal = new MSShopContactsDAL();
            DataSet           contactDs  = contactDal.GetContactDetailByPID(strID);

            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();
                UserContact.Text = "联系电话:" + uphone + " &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;" +
                                   "联系人:" + uname;
            }
        }
        /// <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();
        }
示例#9
0
        void showdetailinfo()
        {
            sizeorcolor.Items.Clear();
            sizeorcolor.Items.Insert(0, new ListItem("尺寸", "1"));
            sizeorcolor.Items.Insert(1, new ListItem("颜色", "-1"));
            sizeorcolor.Items.Insert(2, new ListItem("没有", "0"));
            MSSizeOrColorDAL sizeorcolorDal   = new MSSizeOrColorDAL();
            DataSet          sizeds           = sizeorcolorDal.GetSizeOrColorDetail(strID);
            MSSizeOrColor    sizeorcolorModel =
                DataConvert.DataRowToModel <MSSizeOrColor>(sizeds.Tables[0].Rows[0]);

            sizeorcolor.SelectedIndex =
                sizeorcolor.Items.IndexOf(sizeorcolor.Items.FindByValue(sizeorcolorModel.SizeColor.ToString()));
            scname.Text = sizeorcolorModel.Scname;
            if (sizeorcolorModel.Scimg != null && sizeorcolorModel.Scimg != "")
            {
                oldimg   = sizeorcolorModel.Scimg;
                img0.Src = "../../PalmShop/ShopCode/" + oldimg;
            }
            stock.Text = sizeorcolorModel.Stock.ToString();
            if (strAction == "show")
            {
                this.btnReset.Visible = false;
                this.btnSave.Visible  = false;
            }
            else
            {
                string       pid     = sizeorcolorModel.PID;
                string       sid     = string.Empty;
                MSProductDAL pDal    = new MSProductDAL();
                MSShopDAL    shopdal = new MSShopDAL();
                try
                {
                    sid       = pDal.GetMSProductVaueByID("[SID]", pid).ToString();
                    shopPhone = shopdal.GetMSShopValueByID("Phone", sid).ToString();
                }
                catch (Exception)
                {
                    shopPhone = "";
                }
            }
        }
        public string SecHandProductTip()
        {
            int          count = 0; string msg = string.Empty;
            MSProductDAL productDal = new MSProductDAL();

            try
            {
                count = productDal.GetNotPassProductCount(" and IsSecHand=1 and Review=0 ");
            }
            catch (Exception)
            {
                count = 0;
            }
            msg = "";
            if (count > 0)
            {
                msg = "共有" + count + "条产品信息待审核!";
            }
            return(msg);
        }
示例#11
0
 /// <summary>
 /// 产品删除
 /// </summary>
 void DelProduct()
 {
     if (pid != null && pid != "")
     {
         MSProductDAL productDal = new MSProductDAL();
         if (productDal.UpdateMSProductState(pid))
         {
             Response.Write("{\"success\":true}");
         }
         else
         {
             Response.Write("{\"error\":true}");
         }
     }
     else
     {
         Response.Write("{\"error\":true}");
     }
     Response.End();
 }
示例#12
0
        /// <summary>
        /// 更新信息状态
        /// </summary>
        void delProduct()
        {
            string pid = string.Empty;

            if (Request["pid"] != null && Request["pid"] != "")
            {
                pid = Common.Common.NoHtml(Request["pid"]);
            }
            if (pid.Trim() != null && pid.Trim() != "")
            {
                MSProductDAL      productDal = new MSProductDAL();
                MSProductAtlasDAL atlasDal   = new MSProductAtlasDAL();
                productDal.UpdateMSProductState(pid);
                atlasDal.UpdateAtlasByPID(pid);
                Response.Write("{\"success\":true}");
            }
            else
            {
                Response.Write("{\"error\":true,\"msg\":\"操作失败,请核对后再操作\"}");
            }
            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"]);
            }

            MSProductDAL dal = new MSProductDAL();
            switch (strAction)
            {
                case "del":
                    if (dal.UpdateMSProductState(strID))
                    {
                        strMessage = "操作成功!";
                    }
                    else
                    {
                        strMessage = "操作失败!";
                    }
                    break;
                case "pass":
                    if (dal.UpdateProductReview(strID))
                    {
                        strMessage = "操作成功!";
                    }
                    else
                    {
                        strMessage = "操作失败!";
                    }
                    break;
            }
            Response.Write(strMessage);
            Response.End();
        }
示例#14
0
        void GetInfo()
        {
            string like = string.Empty; string strwhere = string.Empty;

            strwhere = " and a.CustomerID='" + Session["customerID"] + "' ";
            if (Request["like"] != null && Request["like"] != "")
            {
                like = " and a.ptitle like '%" + Request["like"] + "%' ";
            }
            else
            {
                like = "";
            }
            strwhere = strwhere + like;
            MSProductDAL        productDal               = new MSProductDAL();
            List <SecHandModel> MySecHandModel           = new List <SecHandModel>();
            DataSet             sechandDs                = productDal.GetSecHandProduct(strwhere);

            if (sechandDs != null && sechandDs.Tables.Count > 0 && sechandDs.Tables[0].Rows.Count > 0)
            {
                foreach (DataRow row in sechandDs.Tables[0].Rows)
                {
                    SecHandModel sechandModel = DataConvert.DataRowToModel <SecHandModel>(row);
                    MySecHandModel.Add(sechandModel);
                }
            }
            string text = System.IO.File.ReadAllText(Server.MapPath("../ShopPage/MySecHand.html"));

            JinianNet.JNTemplate.TemplateContext context = new JinianNet.JNTemplate.TemplateContext();

            context.TempData["title"]       = "我的商品";
            context.TempData["errorscript"] = errorscript;
            context.TempData["productlist"] = MySecHandModel;
            context.TempData["footer"]      = "奥琦微商易";

            JinianNet.JNTemplate.Template t = new JinianNet.JNTemplate.Template(context, text);
            t.Render(Response.Output);
        }
示例#15
0
        void showdetailinfo()
        {
            MSProductDAL productDal   = new MSProductDAL();
            DataSet      productDs    = productDal.GetProductDetail(strID);
            MSProduct    productModel = DataConvert.DataRowToModel <MSProduct>(productDs.Tables[0].Rows[0]);

            price.Text       = productModel.Price.ToString();
            pname.Text       = productModel.Ptitle;
            hd_content.Value = productModel.Pcontent;
            if (productModel.IsSecHand == 0)
            {
                isstateno.Checked = true;
            }
            else
            {
                isstateyes.Checked = true;
            }
            if (strAction == "show")
            {
                this.btnReset.Visible = false;
                this.btnSave.Visible  = false;
            }

            MSProductAtlasDAL AtlasDal = new MSProductAtlasDAL();
            DataSet           atlasds  = AtlasDal.GetProductAtlasList(" AND PID='" + strID + "' ");

            if (atlasds != null && atlasds.Tables.Count > 0 && atlasds.Tables[0].Rows.Count > 0)
            {
                pataslist = ""; string atlasimg = "";
                for (int i = 0; i < atlasds.Tables[0].Rows.Count; i++)
                {
                    atlasimg   = atlasds.Tables[0].Rows[i]["PimgUrl"].ToString();
                    pataslist += "<img src=\"../../PalmShop/ShopCode/" + atlasimg + "\" />";
                }
            }
        }
示例#16
0
        /// <summary>
        /// 获取产品列表
        /// </summary>
        void GetProductList()
        {
            string plist = string.Empty;

            if (Request["sid"] != null && Request["sid"] != "")
            {
                DataSet productds = null; plist = "";
                sid = Common.Common.NoHtml(Request["sid"].ToString());
                if (sid != null && sid != "")
                {
                    MSProductDAL productDal = new MSProductDAL();
                    productds = productDal.GetProductListByTop(10, " and a.[SID]='" + sid + "' ");
                }
                if (productds != null && productds.Tables.Count > 0 && productds.Tables[0].Rows.Count > 0)
                {
                    string pid = string.Empty; string ptitle = string.Empty; string img = string.Empty;
                    string date = string.Empty;
                    for (int i = 0; i < productds.Tables[0].Rows.Count; i++)
                    {
                        pid    = productds.Tables[0].Rows[i]["ID"].ToString();
                        ptitle = productds.Tables[0].Rows[i]["Ptitle"].ToString();
                        img    = productds.Tables[0].Rows[i]["PimgUrl"].ToString();
                        date   = productds.Tables[0].Rows[i]["AddTime"].ToString();
                        if (ptitle.Length > 10)
                        {
                            ptitle = ptitle.ToString().Substring(0, 10) + "..";
                        }
                        plist += "<p><a href='Product_detail.aspx?pid=" + pid + "'>" +
                                 "<img src='" + img + "' alt='" + ptitle + "' onerror='ShopLogo/default.png' />" +
                                 ptitle + "<span>" + date + "</span></a></p>";
                    }
                }
            }
            Response.Write("{\"plist\":\"" + plist + "\"}");
            Response.End();
        }
 /// <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
     }
 }
示例#18
0
        /// <summary>
        /// 把购物车添加到订单
        /// </summary>
        void setAddOrder()
        {
            string uname = string.Empty; string uphone = string.Empty; string address = string.Empty;
            string payway = string.Empty; string carryway = string.Empty; string countcost = string.Empty;
            string leavemsg = string.Empty; string zipcode = string.Empty; string num = string.Empty;

            #region --------------获取请求信息---------------
            if (Request["num"] != null && Request["num"] != "")
            {
                num = Request["num"];
            }
            if (Request["uname"] != null && Request["uname"] != "")
            {
                uname = Common.Common.NoHtml(Request["uname"]);
            }
            if (Request["uphone"] != null && Request["uphone"] != "")
            {
                uphone = Common.Common.NoHtml(Request["uphone"]);
            }
            if (Request["address"] != null && Request["address"] != "")
            {
                address = Request["address"];
            }
            if (Request["payway"] != null && Request["payway"] != "")
            {
                payway = Common.Common.NoHtml(Request["payway"]);
            }
            if (Request["carryway"] != null && Request["carryway"] != "")
            {
                carryway = Common.Common.NoHtml(Request["carryway"]);
            }
            if (Request["countcost"] != null && Request["countcost"] != "")
            {
                countcost = Common.Common.NoHtml(Request["countcost"]);
            }
            if (Request["leavemsg"] != null && Request["leavemsg"] != "")
            {
                leavemsg = Common.Common.NoHtml(Request["leavemsg"]);
            }
            if (Request["zipcode"] != null && Request["zipcode"] != "")
            {
                zipcode = Common.Common.NoHtml(Request["zipcode"]);
            }
            #endregion
            if (customid.Trim() != null && customid.Trim() != "")
            {
                MSShoppingCartDAL cartDal  = new MSShoppingCartDAL();
                MSProductOrderDAL OrderDal = new MSProductOrderDAL();
                if (OrderDal.ExistOrderByUID(customid, strpid))
                {
                    Response.Write("{\"error\":true,\"exist\":true}");
                }
                else
                {
                    try
                    {
                        string strOrdernum = cartDal.SubOrder(customid, uname, uphone, leavemsg,
                                                              address, zipcode, strpid, countcost, num, mid);
                        if (strOrdernum != null && strOrdernum != "")
                        {
                            strSiteCode = "VYIGO";
                            MSOrderLogDAL.AddMSOrderLog("客户【" + customid + "】下单成功,订单号为【" + strOrdernum + "】");
                            MSProductDAL productDal = new MSProductDAL();
                            string       pnam       = string.Empty;
                            if (strpid != null && strpid != "")
                            {
                                pnam = productDal.GetMSProductVaueByID("Ptitle", strpid).ToString();
                            }

                            #region -发消息到店铺注册用户
                            string p_uid = string.Empty; string p_openid = string.Empty;
                            if (strpid != null && strpid != "")
                            {
                                try
                                {
                                    p_uid = productDal.GetMSProductVaueByID("CustomerID", strpid).ToString();
                                }
                                catch (Exception)
                                {
                                }
                            }
                            if (p_uid != null && p_uid != "")
                            {
                                MSCustomersDAL P_UDal = new MSCustomersDAL();
                                try
                                {
                                    p_openid = P_UDal.GetCustomerValueByID("OpenID", p_uid).ToString();
                                }
                                catch (Exception)
                                {
                                }
                            }
                            if (p_openid != null && p_openid != "" && strSiteCode != null && strSiteCode != "")
                            {
                                JQDialog.SendWeiXinMsg(strSiteCode, p_openid,
                                                       "亲爱的店长大人,您的宝贝【" + pnam + "】已于" +
                                                       DateTime.Now.ToString("yyyy年MM月dd日 HH:mm:ss") +
                                                       "被" + uname + "成功买下,单号【" + strOrdernum + "】赶紧去小店看看吧!");
                            }
                            MSOrderLogDAL.AddMSOrderLog("下单成功,通知到OpenID为【" + p_openid + "】的店长");
                            #endregion

                            #region -产品属性
                            MSProductParaDAL paraDal = new MSProductParaDAL();
                            int stock = 0;
                            if (paraDal.ExistMSPPara("", strpid) && mid != null && mid != "")
                            {
                                try
                                {
                                    stock = int.Parse(paraDal.GetMSPParaValueByID("Stock", mid).ToString());
                                }
                                catch (Exception)
                                {
                                }
                                if (stock > 0)
                                {
                                    int buynum = 0;
                                    try
                                    {
                                        buynum = Convert.ToInt32(quantity);
                                    }
                                    catch (Exception)
                                    {
                                    }
                                    if (buynum != 0 && buynum < stock)
                                    {
                                        stock = stock - buynum;
                                        paraDal.UpdateStock(stock, mid);
                                    }
                                }
                            }
                            #endregion
                            DataSet orderds     = cartDal.GetMyOrderDetail(strOrdernum);
                            string  payinfo     = string.Empty;
                            string  productname = string.Empty; //用户购买的商品名称
                            string  ordernum    = string.Empty; //订单号
                            if (orderds != null && orderds.Tables.Count > 0 && orderds.Tables[0].Rows.Count > 0)
                            {
                                productname = orderds.Tables[0].Rows[0]["Ptitle"].ToString();
                                ordernum    = orderds.Tables[0].Rows[0]["ID"].ToString();
                                //payinfo= WapPayHelper.BuildRequest(productname, ordernum, countcost, customid);
                            }
                            if (productname.Trim() != null && productname.Trim() != "" && ordernum != null && ordernum != "")
                            {
                                //Response.Write("{\"success\":true,\"payinfo\":\"" + payinfo + "\"}");
                                Response.Write("{\"success\":true,\"pname\":\"" + productname +
                                               "\",\"ordernum\":\"" + ordernum + "\",\"countcost\":\"" + countcost +
                                               "\",\"customid\":\"" + customid + "\",\"openid\":\"" + openid + "\"}");
                            }
                        }
                        else
                        {
                            Response.Write("{\"error\":true,\"msg\":\"操作失败,重新操作\"}");
                        }
                    }
                    catch (Exception)
                    {
                        Response.Write("{\"error\":true,\"msg\":\"操作失败,重新操作\"}");
                    }
                }
            }
            else
            {
                setCookies();
                Response.Write("{\"error\":true,\"msg\":\"操作失败,请登录后再操作\",\"loginurl\":\"UserLogin.aspx\"}");
            }
            Response.End();
        }
示例#19
0
        public override void OnPaySucceed(AliWapPayCallBackInfo info)
        {
            ExceptionLog log = new ExceptionLog();

            log.Message = string.Format("订单号:{0},支付宝交易号:{1}",
                                        info.out_trade_no, info.trade_no);
            ExceptionLogDAL.InsertExceptionLog(log);

            if (info.result.ToLower() == "success")
            {
                oid   = info.out_trade_no;
                payid = info.trade_no;

                MSProductOrderDAL ptitleDal = new MSProductOrderDAL();
                int paystate = 0;
                try
                {
                    paystate = Convert.ToInt32(ptitleDal.GetOrderValueByID("PayState", info.out_trade_no).ToString());
                }
                catch (Exception)
                {
                }
                if (paystate == 0)
                {
                    bool updatepayway   = ptitleDal.UpdateOrderPayWay(info.out_trade_no, "alipay");
                    bool updateOrderNum = MSProductOrderDAL.UpdateOrderPayState(info.out_trade_no, "1");
                    MSOrderLogDAL.AddMSOrderLog("订单【" + info.out_trade_no + "】支付成功,支付方式:支付宝支付");
                    if (updatepayway == true && updateOrderNum == true)
                    {
                        string countcost = string.Empty; string pid = string.Empty; string pname = string.Empty;
                        #region -获取用户数据
                        string strOpenID = string.Empty; string customerid = string.Empty;
                        try
                        {
                            customerid = ptitleDal.GetOrderValueByID("CustomerID", info.out_trade_no).ToString();
                        }
                        catch (Exception)
                        {
                        }
                        if (customerid != null && customerid != "")
                        {
                            MSCustomersDAL CustomerDal = new MSCustomersDAL();
                            try
                            {
                                strOpenID = CustomerDal.GetCustomerValueByID("OpenID", customerid).ToString();
                            }
                            catch (Exception)
                            {
                            }
                        }
                        #endregion
                        #region -获取产品信息
                        try
                        {
                            countcost = ptitleDal.GetOrderDetailValueByOID("UnitCost", info.out_trade_no).ToString();
                        }
                        catch (Exception)
                        {
                        }
                        try
                        {
                            pid = ptitleDal.GetOrderDetailValueByOID("PID", info.out_trade_no).ToString();
                        }
                        catch (Exception)
                        {
                        }
                        if (pid != null && pid != "")
                        {
                            MSProductDAL ProductDal = new MSProductDAL();
                            pname = ProductDal.GetMSProductVaueByID("Ptitle", pid).ToString();
                        }
                        #endregion
                        string      strSiteCode = GetSiteCode();
                        WXConfigDAL dal         = new WXConfigDAL();

                        WeiXinCore.WeiXin           wx        = WXHelper.CreateWeiXinInstanceBySiteCode(strSiteCode);
                        List <TemplateMessageParam> paramList = new List <TemplateMessageParam>();
                        paramList.Add(new TemplateMessageParam("first",
                                                               "我们已收到您的货款,订单号为:" + info.out_trade_no +
                                                               ";我们将尽快为您打包商品,请耐心等待: )"));
                        paramList.Add(new TemplateMessageParam("orderMoneySum", countcost + " 元"));
                        paramList.Add(new TemplateMessageParam("orderProductName", pname));
                        paramList.Add(new TemplateMessageParam("Remark", "如有问题请致电400-885-5790或直接在微信留言,小V将第一时间为您服务!"));
                        wx.SendTemplateMessage(strOpenID, "IR3TlAC2Y3lW0jaksuPRwHrVHe5nmbWRcD6ZeUPZPlA",
                                               "http://www.vgo2013.com/PalmShop/ShopCode/OrderDetail.aspx?oid=" + info.out_trade_no,
                                               paramList.ToArray(), "");
                        MSOrderLogDAL.AddMSOrderLog("发送模板消息到客户OpenID为【" + strOpenID + "】大致为:我们已收到您的货款" + countcost + "元,产品名称【" + pname + "】我们将尽快为您打包商品,请耐心等待: )");
                    }
                }
            }
        }
示例#20
0
        protected void uploadbtn_Click(object sender, EventArgs e)
        {
            #region 信息判断
            if (Session["customerID"] == null || Session["customerID"].ToString() == "")
            {
                JQDialog.SetCookies("pageurl", "PubSecHand.aspx?ishand=" + ishand, 2);
                errorscript = JQDialog.alertOKMsgBox(5, "操作失败<br/>请登录后再操作!", "UserLogin.aspx", "error");
                return;
            }
            MSProduct productModel = new MSProduct();
            if (setpvalue.Value.Trim() != null && setpvalue.Value.Trim() != "")
            {
                productModel.Cid = setpvalue.Value;
            }
            if (pdesc.Value.Trim() != null && pdesc.Value.Trim() != "")
            {
                productModel.Pcontent = pdesc.Value;
            }
            if (price.Value.Trim() != null && price.Value.Trim() != "")
            {
                productModel.Price = Convert.ToDecimal(price.Value);
            }
            if (ptitle.Value.Trim() != null && ptitle.Value.Trim() != "")
            {
                productModel.Ptitle = ptitle.Value;
            }
            if (price.Value.Trim() != null && price.Value.Trim() != "")
            {
                productModel.Price = Convert.ToDecimal(price.Value);
            }
            #endregion

            Random random    = new Random();
            int    r1        = (int)(random.Next(0, 9));               //产生2个0-9的随机数
            int    r2        = (int)(random.Next(0, 9));
            string now       = DateTime.Now.ToString("yyMMddhhmmssf"); //一个13位的时间戳
            String paymentID = r1.ToString() + r2.ToString() + now;

            pid                     = "R" + paymentID;
            productModel.ID         = pid;
            productModel.IsSecHand  = ishand;
            productModel.Pstate     = 0;
            productModel.Review     = 1;
            productModel.CustomerID = Session["customerID"].ToString();
            MSProductDAL      productDal   = new MSProductDAL();
            MSShopContacts    contactModel = new MSShopContacts();
            MSShopContactsDAL contactDal   = new MSShopContactsDAL();
            contactModel.ID       = Guid.NewGuid().ToString("N").ToUpper();
            contactModel.PID      = pid;
            contactModel.IsDel    = 0;
            contactModel.SID      = "";
            contactModel.NickName = UserName.Value;
            contactModel.Phone    = UserPhone.Value;
            string pageurl = "NewProduct.aspx?ishand=" + ishand;
            if (productDal.AddMSProduct(productModel) && SaveImages() && contactDal.AddMSSContacts(contactModel))
            {
                if (ishand == 1)
                {
                    pageurl = "MySecHand.aspx";
                }
                errorscript = JQDialog.alertOKMsgBox(5, "操作成功!", pageurl, "succeed");
            }
            else
            {
                errorscript = JQDialog.alertOKMsgBox(3, "操作失败<br/>请核对后再操作!", "", "error");
                return;
            }
        }
示例#21
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
        }
示例#22
0
        void ProductEdite()
        {
            string cid = string.Empty; string ptitle = string.Empty; string pcontent = string.Empty;
            string price = string.Empty; string zipcode = string.Empty; string isnull = "";

            #region --------------获取值--------------------
            try
            {
                cid = HttpContext.Current.Request.Form.Get("setoptionvalue").ToString();
            }
            catch (Exception)
            {
                cid = isnull;
            }
            try
            {
                ptitle = HttpContext.Current.Request.Form.Get("ptitle").ToString();
            }
            catch (Exception)
            {
                ptitle = isnull;
            }
            try
            {
                pcontent = HttpContext.Current.Request.Form.Get("pdesc").ToString();
            }
            catch (Exception)
            {
                pcontent = isnull;
            }
            try
            {
                price = HttpContext.Current.Request.Form.Get("price").ToString();
            }
            catch (Exception)
            {
                price = isnull;
            }
            try
            {
                price = HttpContext.Current.Request.Form.Get("price").ToString();
            }
            catch (Exception)
            {
                price = isnull;
            }
            try
            {
                zipcode = HttpContext.Current.Request.Form.Get("zipcode").ToString();
            }
            catch (Exception)
            {
                zipcode = isnull;
            }
            #endregion

            if (ptitle != null && ptitle != "")
            {
                MSProduct    ProductModel = new MSProduct();
                MSProductDAL ProductDal   = new MSProductDAL();
                ProductModel.ID       = pid;
                ProductModel.Cid      = cid;
                ProductModel.Ptitle   = ptitle;
                ProductModel.Pcontent = pcontent;
                if (price != null && price != "")
                {
                    ProductModel.Price = decimal.Parse(price);
                }
                ProductModel.CustomerID = customerid;
                ProductModel.SiteCode   = "";
                ProductModel.SID        = sid;
                ProductModel.IsSecHand  = 0;
                ProductModel.Pstate     = 0;
                ProductModel.ZipCode    = (zipcode == "" || zipcode == null ? "包邮" : zipcode);

                if (EditeProductModel() && SaveImages() && ProductDal.UpdateMSProduct(ProductModel))
                {
                    errorscript = JQDialog.alertOKMsgBox(3, "操作成功!", "MyShop.aspx", "succeed");
                }
                else
                {
                    errorscript = JQDialog.alertOKMsgBox(3, "操作失败<br/>请核对后再操作!", "", "error");
                }
            }
        }
示例#23
0
        public override void OnPaySucceed(WXJSAPIPayNotifyInfo info)
        {
            ExceptionLog log = new ExceptionLog();

            log.Message = string.Format("Openid:{0},订单号:{1},附加消息:{2}",
                                        info.OpenId, info.OutTradeNo, info.Attach);
            ExceptionLogDAL.InsertExceptionLog(log);

            MSProductOrderDAL ptitleDal = new MSProductOrderDAL();
            int paystate = 0;

            try
            {
                paystate = Convert.ToInt32(ptitleDal.GetOrderValueByID("PayState", info.OutTradeNo).ToString());
            }
            catch (Exception)
            {
            }
            if (paystate == 0)
            {
                bool updatepayway   = ptitleDal.UpdateOrderPayWay(info.OutTradeNo, "wxpay");
                bool updateOrderNum = MSProductOrderDAL.UpdateOrderPayState(info.OutTradeNo, "1");
                MSOrderLogDAL.AddMSOrderLog("订单【" + info.OutTradeNo + "】支付成功,支付方式:微支付");
                if (updatepayway == true && updateOrderNum == true)
                {
                    string countcost = ptitleDal.GetOrderDetailValueByOID("UnitCost", info.OutTradeNo).ToString();
                    string strSiteCode = "VYIGO";
                    string pid = string.Empty; string pname = string.Empty;

                    #region -获取产品信息
                    try
                    {
                        countcost = ptitleDal.GetOrderDetailValueByOID("UnitCost", info.OutTradeNo).ToString();
                    }
                    catch (Exception)
                    {
                    }
                    try
                    {
                        pid = ptitleDal.GetOrderDetailValueByOID("PID", info.OutTradeNo).ToString();
                    }
                    catch (Exception)
                    {
                    }
                    if (pid != null && pid != "")
                    {
                        MSProductDAL ProductDal = new MSProductDAL();
                        pname = ProductDal.GetMSProductVaueByID("Ptitle", pid).ToString();
                    }
                    #endregion

                    WeiXinCore.WeiXin           wx        = WXHelper.CreateWeiXinInstanceBySiteCode(strSiteCode);
                    List <TemplateMessageParam> paramList = new List <TemplateMessageParam>();
                    paramList.Add(new TemplateMessageParam("first", "我们已收到您的货款,订单号为:" +
                                                           info.OutTradeNo + ";我们将尽快为您打包商品,请耐心等待: )"));
                    paramList.Add(new TemplateMessageParam("orderMoneySum", countcost + " 元"));
                    paramList.Add(new TemplateMessageParam("orderProductName", pname));
                    paramList.Add(new TemplateMessageParam("Remark", "如有问题请致电400-885-5790或直接在微信留言,小V将第一时间为您服务!"));
                    wx.SendTemplateMessage(info.OpenId, "IR3TlAC2Y3lW0jaksuPRwHrVHe5nmbWRcD6ZeUPZPlA",
                                           "http://www.vgo2013.com/PalmShop/ShopCode/OrderDetail.aspx?oid=" + info.OutTradeNo,
                                           paramList.ToArray(), "");
                    MSOrderLogDAL.AddMSOrderLog("发送模板消息到客户OpenID为【" + info.OpenId + "】大致为:我们已收到您的货款" + countcost + "元,产品名称【" + pname + "】我们将尽快为您打包商品,请耐心等待: )");
                    //JQDialog.SendWeiXinMsg(strSiteCode, info.OpenId,
                    //                       "您的订单号【" + info.OutTradeNo + "】已于" +
                    //                       DateTime.Now.ToString("yyyy年MM月dd日 HH:mm:ss") +
                    //                       "付款成功,支付金额:" + countcost +
                    //                       "元;在等待卖家发货,详情请进入我的订单查询!");
                }
            }
        }
示例#24
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);
        }
        void GetProductDetail()
        {
            string ptitle    = string.Empty;
            string shopID    = string.Empty;
            string puid      = string.Empty;
            int    paracount = 0;

            #region 产品详细
            MSProductDAL productDal   = new MSProductDAL();
            MSProduct    productModel = new MSProduct();
            DataSet      productds    = productDal.GetProductDetail(strpid);
            if (null != productds && productds.Tables.Count > 0 && productds.Tables[0].Rows.Count > 0)
            {
                productModel = DataConvert.DataRowToModel <MSProduct>(productds.Tables[0].Rows[0]);
                ptitle       = productModel.Ptitle;
                puid         = productModel.CustomerID;
                if (productModel.SID != null && productModel.SID != "")
                {
                    shopID = productModel.SID;
                }
            }
            #endregion
            #region 店铺详细
            MSShop shopModel = new MSShop();
            if (shopID != null && shopID != "")
            {
                MSShopDAL shopDal = new MSShopDAL();
                DataSet   shopds  = shopDal.GetMSShopDetail(shopID);
                if (shopds != null && shopds.Tables.Count > 0 && shopds.Tables[0].Rows.Count > 0)
                {
                    shopModel = DataConvert.DataRowToModel <MSShop>(shopds.Tables[0].Rows[0]);
                }
            }
            #endregion
            #region 图集列表
            MSProductAtlasDAL     atlasDal       = new MSProductAtlasDAL();
            List <MSProductAtlas> AtlasListModel = new List <MSProductAtlas>();
            DataSet atlasds = atlasDal.GetProductAtlasByPID(strpid);
            if (null != atlasds && atlasds.Tables.Count > 0 && atlasds.Tables[0].Rows.Count > 0)
            {
                foreach (DataRow row in atlasds.Tables[0].Rows)
                {
                    MSProductAtlas atlasModel = DataConvert.DataRowToModel <MSProductAtlas>(row);
                    AtlasListModel.Add(atlasModel);
                }
            }
            #endregion
            #region 产品参数列表
            //MSProductParaDAL paraDal = new MSProductParaDAL();
            //DataSet paramds = paraDal.GetProductParamByPID(strpid);
            //string paramlist = string.Empty;
            //if (null != paramds && paramds.Tables.Count > 0 && paramds.Tables[0].Rows.Count > 0)
            //{
            //    for (int i = 0; i < paramds.Tables[0].Rows.Count; i++)
            //    {
            //        paramlist += "<tr>\r\n";
            //        string paraname = paramds.Tables[0].Rows[i]["ParName"].ToString();
            //        string paravalue = paramds.Tables[0].Rows[i]["ParValue"].ToString();
            //        paramlist += "<td class=\"td_title\">" + paraname + "</td><td>" + paravalue + "</td>\r\n";
            //        try
            //        {
            //            i = i + 1;
            //            paraname = paramds.Tables[0].Rows[i]["ParName"].ToString();
            //            paravalue = paramds.Tables[0].Rows[i]["ParValue"].ToString();
            //            paramlist += "<td class=\"td_title\">" + paraname + "</td><td>" + paravalue + "</td>\r\n";
            //        }
            //        catch (Exception)
            //        {
            //            paramlist += "<td class=\"td_title\">&nbsp;&nbsp;</td><td>&nbsp;&nbsp;</td>\r\n";
            //        }
            //        paramlist += "</tr>\r\n";
            //    }
            //}
            #endregion
            #region -------获取产品型号及价格------------
            ProductPara          ParaModel     = new ProductPara();
            List <MSProductPara> paralistmodel = new List <MSProductPara>();
            MSProductParaDAL     paraDal       = new MSProductParaDAL();
            DataSet parads = paraDal.GetMaxMinPrice(strpid);
            if (parads != null && parads.Tables.Count > 0 && parads.Tables[0].Rows.Count > 0)
            {
                paracount = parads.Tables[0].Rows.Count;
                ParaModel = DataConvert.DataRowToModel <ProductPara>(parads.Tables[0].Rows[0]);
            }
            parads = null;
            parads = paraDal.GetProductParamByPID(strpid);
            if (parads != null && parads.Tables.Count > 0 && parads.Tables[0].Rows.Count > 0)
            {
                foreach (DataRow item in parads.Tables[0].Rows)
                {
                    MSProductPara paramodel = DataConvert.DataRowToModel <MSProductPara>(item);
                    paralistmodel.Add(paramodel);
                }
            }
            #endregion

            #region ----------------根据产品编号获取联系方式--------------------
            MSShopContactsDAL contactDal   = new MSShopContactsDAL();
            MSShopContacts    contactModel = new MSShopContacts();
            DataSet           contactDs    = contactDal.GetContactDetailByPID(strpid);

            MSCustomersDAL CustomerDal = new MSCustomersDAL();
            MSCustomers    CustomerModel = new MSCustomers();
            DataSet        PuidDs = null; int contactcount = 0;

            if (contactDs != null && contactDs.Tables.Count > 0 && contactDs.Tables[0].Rows.Count > 0)
            {
                contactModel = DataConvert.DataRowToModel <MSShopContacts>(contactDs.Tables[0].Rows[0]);
                contactcount = 1;
            }
            else
            {
                if (puid != null && puid != "")
                {
                    PuidDs = CustomerDal.GetCustomerDetail(puid);
                }
                if (PuidDs != null && PuidDs.Tables.Count > 0 && PuidDs.Tables[0].Rows.Count > 0)
                {
                    CustomerModel = DataConvert.DataRowToModel <MSCustomers>(PuidDs.Tables[0].Rows[0]);
                }
            }
            #endregion
            string text = System.IO.File.ReadAllText(Server.MapPath("../ShopPage/Product_detail.html"));
            JinianNet.JNTemplate.TemplateContext context = new JinianNet.JNTemplate.TemplateContext();

            context.TempData["title"] = ptitle;
            if (shopModel != null)
            {
                context.TempData["shopdetail"] = shopModel;
            }
            context.TempData["productdetail"] = productModel;
            context.TempData["atlaslist"]     = AtlasListModel;
            if (contactcount > 0)
            {
                context.TempData["contactdetail"] = contactModel;
            }
            else
            {
                context.TempData["contactdetail"] = CustomerModel;
            }
            context.TempData["customid"] = customid;
            //context.TempData["paramlist"] = paramlist;
            context.TempData["paracount"]   = paracount;
            context.TempData["paramodel"]   = ParaModel;
            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);
        }
        protected void uploadbtn_Click(object sender, EventArgs e)
        {
            #region 信息判断
            if (Session["customerID"] != null && Session["customerID"].ToString() != "")
            {
                MSCustomersDAL customerDal = new MSCustomersDAL();
                phone = customerDal.GetCustomerValueByID("phone", Session["customerID"].ToString()).ToString();
            }
            else
            {
                JQDialog.SetCookies("pageurl", "PubSecHandEdit.aspx?ishand=" + ishand, 2);
                errorscript = JQDialog.alertOKMsgBox(5, "操作失败<br/>请登录后再操作!", "UserLogin.aspx", "error");
                return;
            }
            MSProduct productModel = new MSProduct();
            if (setpvalue.Value.Trim() != null && setpvalue.Value.Trim() != "")
            {
                productModel.Cid = setpvalue.Value;
            }
            if (pdesc.Value.Trim() != null && pdesc.Value.Trim() != "")
            {
                productModel.Pcontent = pdesc.Value;
            }
            if (price.Value.Trim() != null && price.Value.Trim() != "")
            {
                productModel.Price = Convert.ToDecimal(price.Value);
            }
            if (ptitle.Value.Trim() != null && ptitle.Value.Trim() != "")
            {
                productModel.Ptitle = ptitle.Value;
            }
            if (price.Value.Trim() != null && price.Value.Trim() != "")
            {
                productModel.Price = Convert.ToDecimal(price.Value);
            }
            #endregion
            productModel.ID         = pid;
            productModel.IsSecHand  = ishand;
            productModel.Pstate     = 0;
            productModel.Review     = Review;
            productModel.CustomerID = Session["customerID"].ToString();
            MSProductDAL productDal = new MSProductDAL();

            MSShopContacts    contactModel = new MSShopContacts();
            MSShopContactsDAL contactDal   = new MSShopContactsDAL();
            contactModel.PID      = pid;
            contactModel.IsDel    = 0;
            contactModel.SID      = "";
            contactModel.NickName = UserName.Value;
            contactModel.Phone    = UserPhone.Value;
            bool contactflag = false;
            if (contactDal.ExistContact("", "", "", pid))
            {
                contactModel.ID = contactID;
                contactflag     = contactDal.UpdateMSSContacts(contactModel);
            }
            else
            {
                contactModel.ID = Guid.NewGuid().ToString("N").ToUpper();
                contactflag     = contactDal.AddMSSContacts(contactModel);
            }
            if (productDal.UpdateMSProduct(productModel) && SaveImages())
            {
                errorscript = JQDialog.alertOKMsgBox(3, "操作成功!", "MySecHand.aspx", "error");
            }
            else
            {
                errorscript = JQDialog.alertOKMsgBox(4, "操作失败,请核对后再操作!", "", "error");
                return;
            }
        }
示例#27
0
        /// <summary>
        /// 获取购物信息
        /// </summary>
        void GetInfo()
        {
            #region 产品详细
            MSProductDAL      productDal       = new MSProductDAL();
            MSProduct         productModel     = new MSProduct();
            DataSet           productds        = productDal.GetProductDetail(strpid);
            MSProductAtlasDAL atlasDal         = new MSProductAtlasDAL();
            MSProductAtlas    atlasdetailmodel = null;
            DataSet           atlasDs          = null;
            if (null != productds && productds.Tables.Count > 0 && productds.Tables[0].Rows.Count > 0)
            {
                productModel = DataConvert.DataRowToModel <MSProduct>(productds.Tables[0].Rows[0]);
            }
            #endregion
            #region 获取产品默认展示图
            atlasDs = atlasDal.GetDefaultAtlasByPid(strpid);
            foreach (DataRow atlasrow in atlasDs.Tables[0].Rows)
            {
                atlasdetailmodel = DataConvert.DataRowToModel <MSProductAtlas>(atlasrow);
            }
            #endregion
            #region -----------获取型号尺码----------------
            MSProductPara    paraModel = new MSProductPara();
            MSProductParaDAL paraDal   = new MSProductParaDAL();
            DataSet          parads    = paraDal.GetParaDetail(mid);
            if (parads != null && parads.Tables.Count > 0 && parads.Tables[0].Rows.Count > 0)
            {
                paraModel = DataConvert.DataRowToModel <MSProductPara>(parads.Tables[0].Rows[0]);
            }
            #endregion
            #region 获取收货地址
            MSDeliveryAddressDAL     addressDal     = new MSDeliveryAddressDAL();
            MSDeliveryAddress        defaultadModel = new MSDeliveryAddress();
            List <MSDeliveryAddress> damodellist    = new List <MSDeliveryAddress>();
            string stradwhere = string.Empty;
            stradwhere = "and [UID]='" + customid + "' ";
            DataSet addressds = addressDal.GetDAList(3, stradwhere);
            if (null != addressds && addressds.Tables.Count > 0 && addressds.Tables[0].Rows.Count > 0)
            {
                foreach (DataRow row in addressds.Tables[0].Rows)
                {
                    MSDeliveryAddress damodel = DataConvert.DataRowToModel <MSDeliveryAddress>(row);
                    damodellist.Add(damodel);
                }
            }
            #endregion
            string      customerphone = string.Empty;
            MSCustomers customerModel = new MSCustomers();
            if (customid != null && customid != "")
            {
                MSCustomersDAL CustomerDal = new MSCustomersDAL();
                DataSet        customerds  = CustomerDal.GetCustomerDetail(customid);
                if (customerds != null && customerds.Tables.Count > 0 && customerds.Tables[0].Rows.Count > 0)
                {
                    customerModel = DataConvert.DataRowToModel <MSCustomers>(customerds.Tables[0].Rows[0]);
                }
            }

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

            context.TempData["productdetail"] = productModel;
            context.TempData["atlas"]         = atlasdetailmodel;
            context.TempData["paramodel"]     = paraModel;
            context.TempData["errorscript"]   = errorscript;
            context.TempData["dalist"]        = damodellist;
            context.TempData["customer"]      = customerModel;
            context.TempData["openid"]        = openid;
            context.TempData["footer"]        = "奥琦微商易";

            JinianNet.JNTemplate.Template t = new JinianNet.JNTemplate.Template(context, text);
            t.Render(Response.Output);
        }
示例#28
0
        /// <summary>
        /// 产品发布
        /// </summary>
        void PublicProduct()
        {
            string cid = string.Empty; string ptitle = string.Empty; string pcontent = string.Empty;
            string price = string.Empty; string zipcode = string.Empty; string isnull = "";

            #region --------------获取值--------------------
            try
            {
                cid = HttpContext.Current.Request.Form.Get("setoptionvalue").ToString();
            }
            catch (Exception)
            {
                cid = isnull;
            }
            try
            {
                ptitle = HttpContext.Current.Request.Form.Get("ptitle").ToString();
            }
            catch (Exception)
            {
                ptitle = isnull;
            }
            try
            {
                pcontent = HttpContext.Current.Request.Form.Get("pdesc").ToString();
            }
            catch (Exception)
            {
                pcontent = isnull;
            }
            try
            {
                price = HttpContext.Current.Request.Form.Get("price").ToString();
            }
            catch (Exception)
            {
                price = isnull;
            }
            try
            {
                price = HttpContext.Current.Request.Form.Get("price").ToString();
            }
            catch (Exception)
            {
                price = isnull;
            }
            try
            {
                zipcode = HttpContext.Current.Request.Form.Get("zipcode").ToString();
            }
            catch (Exception)
            {
                zipcode = isnull;
            }
            #endregion
            Random random    = new Random();
            int    r1        = (int)(random.Next(0, 9));
            int    r2        = (int)(random.Next(0, 9));
            string now       = DateTime.Now.ToString("yyMMddhhmmssf");
            String paymentID = r1.ToString() + r2.ToString() + now;
            pid = "R" + paymentID;

            if (ptitle != null && ptitle != "")
            {
                MSProduct    ProductModel = new MSProduct();
                MSProductDAL ProductDal   = new MSProductDAL();
                ProductModel.ID       = pid;
                ProductModel.Cid      = cid;
                ProductModel.Ptitle   = ptitle;
                ProductModel.Pcontent = pcontent;
                if (price != null && price != "")
                {
                    ProductModel.Price = decimal.Parse(price);
                }
                ProductModel.CustomerID = customerid;
                ProductModel.SiteCode   = "";
                ProductModel.SID        = sid;
                ProductModel.IsSecHand  = 0;
                ProductModel.Pstate     = 0;
                ProductModel.Review     = 1;
                ProductModel.ZipCode    = (zipcode == "" || zipcode == null ? "包邮" : zipcode);
                if (SaveImages() && AddProductModel() && ProductDal.AddMSProduct(ProductModel))
                {
                    errorscript = JQDialog.alertOKMsgBox(3, "操作成功!", "MyShop.aspx", "succeed");
                }
                else
                {
                    errorscript = JQDialog.alertOKMsgBox(3, "操作失败<br/>请核对后再操作!", "", "error");
                }
            }
        }
示例#29
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);
        }