예제 #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 showdetailinfo()
        {
            MSShopDAL shopdal   = new MSShopDAL();
            DataSet   ds        = shopdal.GetMSShopDetail(strID);
            MSShop    shopmodel = DataConvert.DataRowToModel <MSShop>(ds.Tables[0].Rows[0]);

            hd_content.Value = shopmodel.ShopDesc;
            MSCustomersDAL customerDal = new MSCustomersDAL();

            userphone.Text = customerDal.GetCustomerValueByID("Phone", shopmodel.UID).ToString();
            shopname.Text  = shopmodel.ShopName;
            if (shopmodel.ShopLogo != null && shopmodel.ShopLogo != "")
            {
                img0.Src = "../../PalmShop/ShopCode/" + shopmodel.ShopLogo;
                oldimg   = shopmodel.ShopLogo;
            }
            if (shopmodel.ShopBackImg != null && shopmodel.ShopBackImg != "")
            {
                img1.Src   = "../../PalmShop/ShopCode/" + shopmodel.ShopBackImg;
                oldbackimg = shopmodel.ShopBackImg;
            }
            wxname.Text = shopmodel.WXName;
            wxnum.Text  = shopmodel.WXNum;
            if (strAction == "show")
            {
                this.btnReset.Visible = false;
                this.btnSave.Visible  = false;
            }
        }
예제 #3
0
        /// <summary>
        /// 订单收货
        /// </summary>
        void ReceiveOrder()
        {
            string oid = string.Empty;

            if (Request["oid"] != null && Request["oid"] != "")
            {
                oid = Common.Common.NoHtml(Request["oid"]);
            }
            if (oid != null && oid != "")
            {
                MSProductOrderDAL OrderDal = new MSProductOrderDAL();
                if (OrderDal.UpdateOrderState("isReceive", oid))
                {
                    string buyName = string.Empty;
                    try
                    {
                        buyName = OrderDal.GetOrderValueByID("BuyName", oid).ToString();
                        if (strOpenID == null || strOpenID == "")
                        {
                            string         customerid  = OrderDal.GetOrderDetailValueByOID("CustomerID", oid).ToString();
                            MSCustomersDAL CustomerDal = new MSCustomersDAL();
                            try
                            {
                                strOpenID = CustomerDal.GetCustomerValueByID("OpenID", customerid).ToString();
                            }
                            catch (Exception)
                            {
                            }
                        }
                        WeiXinCore.WeiXin           wx        = WXHelper.CreateWeiXinInstanceBySiteCode("VYIGO");
                        List <TemplateMessageParam> paramList = new List <TemplateMessageParam>();
                        paramList.Add(new TemplateMessageParam("first", "尊敬的" + buyName));
                        paramList.Add(new TemplateMessageParam("OrderSn", oid));
                        paramList.Add(new TemplateMessageParam("OrderStatus", "已收货"));
                        paramList.Add(new TemplateMessageParam("Remark",
                                                               "请关注公众号【vgo2013】进入“服务中心进行查询”查看完整信息"));
                        wx.SendTemplateMessage(strOpenID, "wmrxCKRq1hG3cHR0BXsuUnNq1chcbVosqYLqlsBBRCc",
                                               "http://www.vgo2013.com/PalmShop/ShopCode/CustomerOrder.aspx?receive=1",
                                               paramList.ToArray(), "");
                        MSOrderLogDAL.AddMSOrderLog("提示客户订单【" + oid +
                                                    "】已确认收货,发送模板消息到客户OpenID【" + strOpenID + "】");
                    }
                    catch (Exception)
                    {
                    }
                    Response.Write("{\"success\":true}");
                }
                else
                {
                    Response.Write("{\"error\":true,\"msg\":\"操作失败,请稍后再操作\"}");
                }
            }
            else
            {
                Response.Write("{\"error\":true,\"msg\":\"操作失败,请稍后再操作\"}");
            }
            Response.End();
        }
예제 #4
0
        /// <summary>
        /// 获取用户OpenID
        /// </summary>
        void GetUserOpenID()
        {
            if (null == Request.QueryString["state"])
            {
                //return;
            }
            else
            {
                strSiteCode            = Common.Common.NoHtml(Request.QueryString["state"].ToString());
                Session["strSiteCode"] = strSiteCode;
            }
            string code = Request.QueryString["code"] as string;

            if (!string.IsNullOrEmpty(code))
            {
                WXConfigDAL           dal      = new WXConfigDAL();
                Model.WeiXin.WXConfig wxConfig = dal.GetWXConfigBySiteCode(strSiteCode);
                if (wxConfig != null)
                {
                    WeiXinCore.Models.WeiXinConfig weixinConfig = new WeiXinCore.Models.WeiXinConfig()
                    {
                        ID        = wxConfig.WXID,
                        Name      = wxConfig.WXName,
                        Token     = wxConfig.WXToken,
                        AppId     = wxConfig.WXAppID,
                        AppSecret = wxConfig.WXAppSecret
                    };
                    WeiXinCore.WeiXin weixin            = new WeiXinCore.WeiXin(weixinConfig);
                    Oauth2AccessToken oauth2AccessToken = weixin.GetOauth2AccessToken(code);
                    if (oauth2AccessToken != null)
                    {
                        strOpenID = oauth2AccessToken.OpenID;
                    }
                }
                else
                {
                    strOpenID = code;
                }
            }
            if (strOpenID == null || strOpenID == "")
            {
                if (Session["customerID"] != null && Session["customerID"].ToString() != "")
                {
                    MSCustomersDAL CustomerDal = new MSCustomersDAL();
                    try
                    {
                        strOpenID = CustomerDal.GetCustomerValueByID("OpenID", Session["customerID"].ToString()).ToString();
                    }
                    catch (Exception)
                    {
                    }
                }
            }
            if (strOpenID != null && strOpenID != "")
            {
                Session["OpenID"] = strOpenID;
            }
        }
예제 #5
0
 void GetOpenId()
 {
     if (customid != null && customid != "")
     {
         MSCustomersDAL CustomerDal = new MSCustomersDAL();
         openid            = CustomerDal.GetCustomerValueByID("OpenID", customid).ToString();
         Session["OpenID"] = openid;
     }
     else
     {
         openid = "";
     }
 }
예제 #6
0
 void GetOpenId()
 {
     if (customerid != null && customerid != "")
     {
         MSCustomersDAL CustomerDal = new MSCustomersDAL();
         strOpenID         = CustomerDal.GetCustomerValueByID("OpenID", customerid).ToString();
         Session["OpenID"] = strOpenID;
     }
     else
     {
         strOpenID = "";
     }
 }
예제 #7
0
        /// <summary>
        /// 图集上传
        /// </summary>
        /// <returns></returns>
        bool SaveImages()
        {
            bool result = false;

            if (customerid != null && customerid != "")
            {
                MSCustomersDAL customer = new MSCustomersDAL();
                phone = customer.GetCustomerValueByID("Phone", customerid).ToString() + "/";
            }
            HttpFileCollection files = HttpContext.Current.Request.Files;

            try
            {
                MSProductAtlas    atlasModel = new MSProductAtlas();
                MSProductAtlasDAL atlasDal   = new MSProductAtlasDAL();
                atlasModel.PID = pid;
                for (int iFile = 0; iFile < files.Count; iFile++)
                {
                    //检查文件扩展名字
                    HttpPostedFile postedFile = files[iFile];
                    string         fileName, fileExtension, file_oldid, file_id;
                    //取出精确到毫秒的时间做文件的名称
                    string my_file_id = DateTime.Now.ToString("yyyyMMddHHmmssfff") + iFile.ToString();
                    fileName      = System.IO.Path.GetFileName(postedFile.FileName);
                    fileExtension = System.IO.Path.GetExtension(fileName);
                    file_id       = my_file_id + fileExtension;
                    if (fileName != "" && fileName != null)
                    {
                        fileExtension = System.IO.Path.GetExtension(fileName);
                        string saveurl, modelimgurl;
                        saveurl = modelimgurl = "Atlas/" + phone;
                        saveurl = Server.MapPath(saveurl);
                        if (!Directory.Exists(saveurl))
                        {
                            Directory.CreateDirectory(saveurl);
                        }

                        int length = postedFile.ContentLength;
                        if (length > 512000)
                        {
                            file_oldid = "old" + file_id;
                            postedFile.SaveAs(saveurl + file_oldid);
                            JQDialog.ystp(saveurl + file_oldid, saveurl + file_id, 15);
                            File.Delete(saveurl + file_oldid);
                        }
                        else
                        {
                            postedFile.SaveAs(saveurl + file_id);
                        }
                        atlasModel.ID = Guid.NewGuid().ToString("N").ToUpper();
                        if (iFile == 0)
                        {
                            if (!atlasDal.IsExitDefaultImg(pid))
                            {
                                atlasModel.IsDefault = 1;
                            }
                        }
                        atlasModel.ImgState  = 0;
                        atlasModel.PimgUrl   = modelimgurl + file_id;
                        atlasModel.AtlasName = "";
                        if (atlasDal.AddMSProductAtlas(atlasModel))
                        {
                            result = true;
                        }
                    }
                }
            }
            catch (System.Exception Ex)
            {
                result = false;
            }
            return(result);
        }
예제 #8
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 + "】我们将尽快为您打包商品,请耐心等待: )");
                    }
                }
            }
        }
예제 #9
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();
        }
예제 #10
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                errormsg = "";
                #region ------------获取请求信息----------------
                if (Request["pname"] != null && Request["pname"] != "")
                {
                    pname = Request["pname"];
                }
                if (Request["ordernum"] != null && Request["ordernum"] != "")
                {
                    ordernum = Request["ordernum"];
                }
                if (Request["countcost"] != null && Request["countcost"] != "")
                {
                    countcost = Request["countcost"];
                }
                if (Request["customid"] != null && Request["customid"] != "")
                {
                    customid = Request["customid"];
                }
                #endregion
                #region -获取用户openid
                if (Session["OpenID"] == null || Session["OpenID"].ToString() == "")
                {
                    if (customid != null && customid != "")
                    {
                        MSCustomersDAL customerDal = new MSCustomersDAL();
                        try
                        {
                            strOpenID = customerDal.GetCustomerValueByID("OpenID", customid).ToString();
                        }
                        catch (Exception)
                        {
                        }
                    }
                }
                else
                {
                    strOpenID = Session["OpenID"].ToString();
                }
                #endregion
                if (Request["action"] != null && Request["action"] != "")
                {
                    action = Request["action"];
                    string            strSiteCode = "VYIGO";
                    WXJSAPIPay        wxpay       = new WXJSAPIPay(strSiteCode);
                    MSProductOrderDAL ptitleDal   = new MSProductOrderDAL();
                    switch (action.Trim().ToLower())
                    {
                    case "alipay":
                        //ptitleDal.UpdateOrderPayWay(ordernum, "alipay");
                        //payway= WapPayHelper.BuildRequest(pname, ordernum, countcost, customid);
                        AliWapPay pay           = new AliWapPay("VYIGO");
                        string    notify_url    = "http://www.vgo2013.com/PalmShop/ShopCode/NotifyUrl.aspx";
                        string    call_back_url = "http://www.vgo2013.com/PalmShop/ShopCode/Alipayreturn.aspx";
                        pay.DirectAliWayPay(this.Response, pname, ordernum, countcost, customid, call_back_url, notify_url);
                        break;

                    case "wxpay":
                        ptitle = ptitleDal.GetOrderTitleByOID(ordernum);
                        strIP  = System.Web.HttpContext.Current.Request.ServerVariables["REMOTE_ADDR"];
                        decimal countcostx = decimal.Parse(countcost);
                        int     v          = (Int32)Math.Round(countcostx * 100, 0);

                        try
                        {
                            wxpay.DirectWXJSAPIPay(this.Response, ptitle, ordernum, v,
                                                   strIP, strOpenID, "http://www.vgo2013.com/PalmShop/ShopCode/PayState.aspx", null, "");
                        }
                        catch (Exception emsg)
                        {
                            errormsg = JQDialog.alertOKMsgBox(5, emsg.Message, "", "error");
                        }

                        break;
                    }
                }
                GetHtmlPage();
            }
        }
예제 #11
0
        /// <summary>
        /// 提交订单
        /// </summary>
        void submitOrder()
        {
            string oid = string.Empty; string cid = string.Empty; string cname = string.Empty;

            #region -获取页面请求值
            try
            {
                oid = Request.Form.Get("ordernum").ToString();
            }
            catch (Exception)
            {
                oid = "";
            }
            try
            {
                cname = Request.Form.Get("cname").ToString();
            }
            catch (Exception)
            {
                cname = "";
            }
            try
            {
                cid = Request.Form.Get("cid").ToString();
            }
            catch (Exception)
            {
                cid = "";
            }
            #endregion
            strSiteCode = "VYIGO"; string customerid = string.Empty; string openid = string.Empty;
            if (oid != null && oid != "" && cid != null && cid != "")
            {
                MSOrderLogistics    olModel  = new MSOrderLogistics();
                MSOrderLogisticsDAL olDal    = new MSOrderLogisticsDAL();
                MSProductOrderDAL   OrderDal = new MSProductOrderDAL();
                olModel.ID = cid; olModel.OID = oid; olModel.CName = cname;

                customerid = OrderDal.GetOrderValueByID("CustomerID", oid).ToString();

                if (customerid != null && customerid != "")
                {
                    MSCustomersDAL customerDal = new MSCustomersDAL();
                    openid = customerDal.GetCustomerValueByID("OpenID", customerid).ToString();
                }

                if (olDal.AddOrderLogistics(olModel) && OrderDal.UpdateOrderState("IsSend", oid))
                {
                    string buyName = string.Empty;
                    try
                    {
                        buyName = OrderDal.GetOrderValueByID("BuyName", oid).ToString();
                        WeiXinCore.WeiXin           wx        = WXHelper.CreateWeiXinInstanceBySiteCode(strSiteCode);
                        List <TemplateMessageParam> paramList = new List <TemplateMessageParam>();
                        paramList.Add(new TemplateMessageParam("first", "亲,宝贝已经启程了,好想快点来到你身边"));
                        paramList.Add(new TemplateMessageParam("delivername", cname));
                        paramList.Add(new TemplateMessageParam("ordername", cid));
                        paramList.Add(new TemplateMessageParam("remark",
                                                               "请关注公众号【vgo2013】进入“快点我”查看完整物流信息"));
                        SendTemplateMessageReturnObj temobj = wx.SendTemplateMessage(openid,
                                                                                     "k4eMeEtKReeDvDRFAf8-Li9FuuHkaFPP1xQI6t3Jomo",
                                                                                     "http://www.vgo2013.com/PalmShop/ShopCode/CopyOrder.aspx?oid=" + oid,
                                                                                     paramList.ToArray(), "");
                        MSOrderLogDAL.AddMSOrderLog("提示客户订单【" + oid + "】已经发货,发送模板消息到客户OpenID【" + openid + "】");
                        bool flag = true;
                        if (flag)
                        {
                        }
                    }
                    catch { }

                    errormsg = JQDialog.alertOKMsgBox(3, "操作成功!", "OrderDelivery.aspx", "succeed");
                }
                else
                {
                    errormsg = JQDialog.alertOKMsgBoxGoBack(3, "操作失败,请重新操作!", false);
                }
            }
            else
            {
                errormsg = JQDialog.alertOKMsgBoxGoBack(3, "操作失败,请重新操作!", false);
            }
        }
예제 #12
0
        void PrintPhoto(string imgsrc)
        {
            string imgname = string.Empty;

            string[] imgarray = imgsrc.Split('.');
            imgname = imgarray[0];
            string openid = string.Empty;

            if (userid != null && userid != "")
            {
                MSCustomersDAL customerDal = new MSCustomersDAL();
                try
                {
                    openid = customerDal.GetCustomerValueByID("OpenID", userid).ToString();
                }
                catch (Exception)
                {
                }
            }
            if (openid == null || openid == "")
            {
                openid = strID;
            }

            DAL.HP.PhotoDAL dalPhoto = new DAL.HP.PhotoDAL();
            //照片处理
            strSFilePath = "../../PalmShop/ShopCode/" + imgsrc;
            strFilePath  = imgsrc;
            string[] urls    = strSFilePath.Split('.');
            string   _url    = openid + "." + urls.Last();
            string   saveurl = "../../HP_Photo/";

            saveurl = Server.MapPath(saveurl);
            if (!Directory.Exists(saveurl))
            {
                Directory.CreateDirectory(saveurl);
            }
            string inputurl  = Server.MapPath("../../PalmShop/ShopCode/") + strFilePath;
            string outputurl = Server.MapPath("../../HP_Photo/") + _url;

            int width  = 260;
            int height = 310;

            System.IO.FileStream fs = new System.IO.FileStream(inputurl, System.IO.FileMode.Open);
            //ZoomAuto(fs, outputurl,width, height, "", "");
            CutForCustom(fs, outputurl, width, height, 100);
            fs.Close();

            string SiteCode = "VYIGO";

            if (Session["strSiteCode"].ToString() != null && Session["strSiteCode"].ToString() != "")
            {
                SiteCode = Session["strSiteCode"].ToString();
            }

            // DAL.HP.PrintCodeDAL dalPrintCode = new DAL.HP.PrintCodeDAL();
            // DataSet printds = dalPrintCode.AddPrintCode(1, SiteCode,"0000", "2014-01-01", "2019-12-31");
            //string strPID = string.Empty;
            //if (printds != null && printds.Tables.Count > 0 && printds.Tables[0].Rows.Count > 0)
            //{
            //    strPID = printds.Tables[0].Rows[0]["ID"].ToString();
            //}

            string strPID = Guid.NewGuid().ToString("N");

            Model.HP.Photo modelPhoto = new Model.HP.Photo()
            {
                ID         = strPID,
                OpenId     = openid,
                SiteCode   = SiteCode,
                ClientID   = "WSY01",
                PrintCode  = "1111",
                Img        = openid + "." + imgsrc.Split('.').Last(),
                AttachText = AttachText.Text + "\r\n"
            };
            dalPhoto.InsertInfo(modelPhoto);

            //插入V币记录
            if (userid != null && userid != "" && strPID != null && strPID != "")
            {
                int              award          = GetAwardChance();
                MSVAcct          msvModel       = new MSVAcct();
                MSVAcctDAL       msvDal         = new MSVAcctDAL();
                MSVAcctDetail    msvdetailModel = new MSVAcctDetail();
                MSVAcctDetailDAL msvdetailDal   = new MSVAcctDetailDAL();
                if (!msvDal.ExistMSVAcct(userid, SiteCode))
                {
                    msvModel.CustID   = userid;
                    msvModel.SiteCode = SiteCode;
                    msvModel.V_Amont  = award;
                    msvDal.AddMSVAcct(msvModel);
                }
                else
                {
                    int count = Convert.ToInt32(msvDal.GetMSVAcct("V_Amont", userid).ToString());
                    count             = count + award;
                    msvModel.CustID   = userid;
                    msvModel.SiteCode = SiteCode;
                    msvModel.V_Amont  = count;
                    msvDal.UpdateMSVAcct(msvModel);
                }
                msvdetailModel.CustID     = userid;
                msvdetailModel.Amount     = award;
                msvdetailModel.ChargeType = "首次购物";
                msvdetailModel.Ext_Fld1   = strPID;
                msvdetailModel.SiteCode   = SiteCode;
                msvdetailDal.AddMSVAcctDetail(msvdetailModel);
            }
            //插入活动券
            if (!string.IsNullOrEmpty(openid))
            {
                string            strGuid = Guid.NewGuid().ToString("N");
                DAL.ACT.CouponDAL cdal    = new DAL.ACT.CouponDAL();
                if (!cdal.ExistCoupon(SiteCode, "56DBFD79AFF94FD6B0FE7E72CE7589E6", openid))
                {
                    Model.ACT.Coupon coupon = null;
                    coupon = new Model.ACT.Coupon()
                    {
                        ID             = strGuid,
                        SiteCode       = SiteCode,
                        SiteActivityID = "56DBFD79AFF94FD6B0FE7E72CE7589E6",
                        OpenID         = openid,
                        CouponStatus   = 0
                    };
                    cdal.InsertInfo(coupon);
                }
            }
        }
예제 #13
0
        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;
            }
        }