Beispiel #1
0
        /// <summary>
        /// 验证电话和旧密码
        /// </summary>
        void valitepwd()
        {
            string phone  = string.Empty;
            string oldpwd = string.Empty;

            if (Request["phone"] != null && Request["phone"] != "")
            {
                phone = Request["phone"];
            }
            if (Request["oldpwd"] != null && Request["oldpwd"] != "")
            {
                oldpwd = Request["oldpwd"];
            }
            MSCustomersDAL customerDal = new MSCustomersDAL();

            if (phone != null && phone != "" && oldpwd != null && oldpwd != "")
            {
                if (customerDal.ExistPhoneAndPwd(phone, Common.Common.MD5(oldpwd)))
                {
                    Response.Write("{\"success\":true}");
                }
                else
                {
                    Response.Write("{\"error\":true,\"msg\":\"原密码不正确\"}");
                }
            }
            else
            {
                Response.Write("{\"error\":true,\"msg\":\"请正确输入信息后再操作\"}");
            }
            Response.End();
        }
        /// <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;
        }
        /// <summary>
        /// 修改密码
        /// </summary>
        void EditePhone()
        {
            string phone  = string.Empty;
            string newpwd = string.Empty;

            if (Request["phone"] != null && Request["phone"] != "")
            {
                phone = Request["phone"];
            }
            if (Request["newpwd"] != null && Request["newpwd"] != "")
            {
                newpwd = Request["newpwd"];
            }
            MSCustomersDAL customerDal = new MSCustomersDAL();

            if (phone != null && phone != "" && newpwd != null && newpwd != "")
            {
                if (customerDal.UpdatePwdByPhone(phone, Common.Common.MD5(newpwd)))
                {
                    Response.Write("{\"success\":true}");
                }
                else
                {
                    Response.Write("{\"error\":true,\"msg\":\"操作失败,请重新操作\"}");
                }
            }
            else
            {
                Response.Write("{\"error\":true,\"msg\":\"请正确输入信息后再操作\"}");
            }
            Response.End();
        }
Beispiel #4
0
        void showdetailinfo()
        {
            MSCustomersDAL CustomerDal   = new MSCustomersDAL();
            DataSet        ds            = CustomerDal.GetCustomerDetail(strID);
            MSCustomers    CustomerModel = DataConvert.DataRowToModel <MSCustomers>(ds.Tables[0].Rows[0]);

            phone.Text       = CustomerModel.Phone;
            hd_content.Value = CustomerModel.Pnote;
            NickName.Text    = CustomerModel.NickName;
            email.Text       = CustomerModel.Email;
            QQnum.Text       = CustomerModel.QQnum;
            if (CustomerModel.HeadImg != null && CustomerModel.HeadImg != "")
            {
                img0.Src = "../../PalmShop/ShopCode/" + CustomerModel.HeadImg;
                oldimg   = CustomerModel.HeadImg;
            }
            if (CustomerModel.Sex == 0)
            {
                isstateyes.Checked = true;
            }
            else
            {
                isstateno.Checked = true;
            }
            if (strAction == "show")
            {
                this.btnReset.Visible = false;
                this.btnSave.Visible  = false;
            }
        }
        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;
            }
        }
        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"]);
            }

            MSCustomersDAL dal = new MSCustomersDAL();

            switch (strAction)
            {
            case "del":
                if (dal.UpdateCustomerState(strID))
                {
                    strMessage = "操作成功!";
                }
                else
                {
                    strMessage = "操作失败!";
                }
                break;
            }
            Response.Write(strMessage);
            Response.End();
        }
Beispiel #7
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();
        }
        /// <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;
            }
        }
        /// <summary>
        /// 用户登录
        /// </summary>
        void ToUserLogin()
        {
            string logphone = string.Empty; string logpwd = string.Empty;

            if (Request["logphone"] != null && Request["logphone"] != "")
            {
                logphone = Common.Common.NoHtml(Request["logphone"]);
            }
            if (Request["logpwd"] != null && Request["logpwd"] != "")
            {
                logpwd = Common.Common.NoHtml(Request["logpwd"]);
            }
            if (logphone.Trim() != null && logphone.Trim() != "" && logpwd.Trim() != null && logpwd.Trim() != "")
            {
                MSCustomersDAL customerDal = new MSCustomersDAL();
                MSShopDAL      shopDal     = new MSShopDAL();
                string         usrsid      = string.Empty;
                DataSet        loginds     = null;
                loginds = customerDal.CustomerLogin(strOpenID, logphone, Common.Common.MD5(logpwd));
                if (loginds != null && loginds.Tables.Count > 0 && loginds.Tables[0].Rows.Count > 0)
                {
                    string customerID = loginds.Tables[0].Rows[0]["ID"].ToString();
                    string useropenid = loginds.Tables[0].Rows[0]["OpenID"].ToString();
                    if (useropenid == null || useropenid == "")
                    {
                        if (strOpenID != null && strOpenID != "")
                        {
                            customerDal.UpdateUserOpenID(customerID, strOpenID);
                        }
                    }
                    Session["customerID"] = customerID;
                    Session["OpenID"]     = strOpenID;
                    if (customerID != null && customerID != "")
                    {
                        try
                        {
                            usrsid = shopDal.GetSidByUid("ID", customerID).ToString();
                        }
                        catch (Exception)
                        {
                            usrsid = "";
                        }
                    }
                    if (usrsid != null && usrsid != "")
                    {
                        Session["SID"] = usrsid;
                    }
                    Response.Write("{\"success\":true}");
                }
                else
                {
                    Response.Write("{\"error\":true,\"msg\":\"非法操作,请核对后再操作\"}");
                }
            }
            Response.End();
        }
Beispiel #10
0
 void GetOpenId()
 {
     if (customid != null && customid != "")
     {
         MSCustomersDAL CustomerDal = new MSCustomersDAL();
         openid            = CustomerDal.GetCustomerValueByID("OpenID", customid).ToString();
         Session["OpenID"] = openid;
     }
     else
     {
         openid = "";
     }
 }
Beispiel #11
0
 void GetOpenId()
 {
     if (customerid != null && customerid != "")
     {
         MSCustomersDAL CustomerDal = new MSCustomersDAL();
         strOpenID         = CustomerDal.GetCustomerValueByID("OpenID", customerid).ToString();
         Session["OpenID"] = strOpenID;
     }
     else
     {
         strOpenID = "";
     }
 }
Beispiel #12
0
        /// <summary>
        /// 验证电话是否注册
        /// </summary>
        void validatephone()
        {
            string valphone = string.Empty;

            if (Request["inputphone"] != null && Request["inputphone"] != "")
            {
                valphone = Common.Common.NoHtml(Request["inputphone"]);
            }
            if (valphone != null && valphone != "")
            {
                MSCustomersDAL customerDal = new MSCustomersDAL();
                if (action != null && action != "" && action == "wxphone")
                {
                    if (strOpenID != null && strOpenID != "")
                    {
                        if (customerDal.ExistCustomer(strOpenID, "", "", ""))
                        {
                            Response.Write("{\"error\":true,\"msg\":\"该微信已被注册\"}");
                        }
                        else
                        {
                            Response.Write("{\"success\":true}");
                        }
                    }
                    else
                    {
                        Response.Write("{\"success\":true}");
                    }
                }
                else
                {
                    if (customerDal.ExistCustomer("", valphone, "", ""))
                    {
                        Response.Write("{\"error\":true,\"msg\":\"该号码已被注册\"}");
                    }
                    else
                    {
                        Response.Write("{\"success\":true}");
                    }
                }
            }
            else
            {
                Response.Write("{\"success\":true}");
            }
            Response.End();
        }
        /// <summary>
        /// 验证电话是否正确
        /// </summary>
        void validatephone()
        {
            string valphone = string.Empty;

            if (Request["phone"] != null && Request["phone"] != "")
            {
                valphone = Common.Common.NoHtml(Request["phone"]);
            }
            if (valphone != null && valphone != "")
            {
                MSCustomersDAL customerDal = new MSCustomersDAL();
                if (customerDal.ExistCustomer("", valphone, "", ""))
                {
                    if (strOpenID != null && strOpenID != "")
                    {
                        if (customerDal.ExistCustomer(strOpenID, "", "", ""))
                        {
                            if (customerDal.ExistCustomer(strOpenID, valphone, "", ""))
                            {
                                Response.Write("{\"success\":true}");
                            }
                            else
                            {
                                Response.Write("{\"error\":true,\"msg\":\"该微信号与注册电话不一致\"}");
                            }
                        }
                        else
                        {
                            Response.Write("{\"error\":true,\"msg\":\"该微信还未注册\"}");
                        }
                    }
                    else
                    {
                        Response.Write("{\"success\":true}");
                    }
                }
                else
                {
                    Response.Write("{\"error\":true,\"msg\":\"未找到该用户资料\"}");
                }
            }
            else
            {
                Response.Write("{\"success\":true}");
            }
            Response.End();
        }
Beispiel #14
0
        /// <summary>
        /// 加载数据
        /// </summary>
        /// <param name="strWhere">条件</param>
        void LoadData(string strWhere)
        {
            MSCustomersDAL customerDal = new MSCustomersDAL();
            DataSet        ds          = customerDal.GetCustomersList(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();
        }
Beispiel #15
0
        void GetHtmlPage()
        {
            MSShop      shopModel = new MSShop();
            MSCustomers UserModel = new MSCustomers();

            #region -----------------店铺详情-----------------------
            if (strSID != null && strSID != "")
            {
                MSShopDAL shopDal = new MSShopDAL();
                DataSet   shopds  = shopDal.GetMSShopDetail(strSID);
                if (shopds != null && shopds.Tables.Count > 0 && shopds.Tables[0].Rows.Count > 0)
                {
                    shopModel = DataConvert.DataRowToModel <MSShop>(shopds.Tables[0].Rows[0]);
                }
            }
            #endregion
            #region ---------------店铺用户资料详情--------------------
            if (strUid != null && strUid != "")
            {
                MSCustomersDAL UserDal = new MSCustomersDAL();
                DataSet        userds  = UserDal.GetCustomerDetail(strUid);
                if (userds != null && userds.Tables.Count > 0 && userds.Tables[0].Rows.Count > 0)
                {
                    UserModel = DataConvert.DataRowToModel <MSCustomers>(userds.Tables[0].Rows[0]);
                }
            }
            #endregion
            string text = System.IO.File.ReadAllText(Server.MapPath("../ShopPage/ApplyShop.html"));
            JinianNet.JNTemplate.TemplateContext context = new JinianNet.JNTemplate.TemplateContext();

            context.TempData["footer"]      = "奥琦微商易";
            context.TempData["errorscript"] = errorscript;
            context.TempData["shopdetail"]  = shopModel;
            context.TempData["usredetail"]  = UserModel;
            context.TempData["action"]      = action;
            context.TempData["sid"]         = strSID;

            JinianNet.JNTemplate.Template t = new JinianNet.JNTemplate.Template(context, text);
            t.Render(Response.Output);
        }
Beispiel #16
0
 /// <summary>
 /// 页面加载事件
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         if (Session["strLoginName"].ToString() != null && Session["strLoginName"].ToString() != "")
         {
             #region 初始化界面
             if (null != Common.Common.NoHtml(Request.QueryString["action"]))
             {
                 strAction = Common.Common.NoHtml(Request.QueryString["action"]);
             }
             if (null != Common.Common.NoHtml(Request.QueryString["id"]))
             {
                 strID = Common.Common.NoHtml(Request.QueryString["id"]);
             }
             ddlphonelist.Items.Clear();
             MSCustomersDAL phoneDal = new MSCustomersDAL();
             DataSet        ds       = new DataSet();
             ds = phoneDal.GetCustomersList("");
             DataTable dt = ds.Tables[0];
             DataRow   dr = ds.Tables[0].NewRow();
             dr["ID"]    = "";
             dr["Phone"] = "--请选择用户电话--";
             dt.Rows.InsertAt(dr, 0);
             ddlphonelist.DataSource     = ds.Tables[0].DefaultView;
             ddlphonelist.DataTextField  = "Phone";
             ddlphonelist.DataValueField = "ID";
             ddlphonelist.DataBind();
             #endregion
         }
         else
         {
             return;
         }
     }
 }
 void getTemplate()
 {
     #region --------------获取客户详细-----------------
     MSCustomers    customerModel = new MSCustomers();
     MSCustomersDAL customerDal   = new MSCustomersDAL();
     DataSet        customerDs    = customerDal.GetCustomerDetail(strUid);
     if (null != customerDs && customerDs.Tables.Count > 0 && customerDs.Tables[0].Rows.Count > 0)
     {
         customerModel = DataConvert.DataRowToModel <MSCustomers>(customerDs.Tables[0].Rows[0]);
         if (customerModel.HeadImg != null && customerModel.HeadImg != "")
         {
             oldimgname = customerModel.HeadImg;
         }
     }
     #endregion
     string text = System.IO.File.ReadAllText(Server.MapPath("HtmlPage/customerinfo.html"));
     JinianNet.JNTemplate.TemplateContext context = new JinianNet.JNTemplate.TemplateContext();
     JinianNet.JNTemplate.Template        t       = new JinianNet.JNTemplate.Template(context, text);
     context.TempData["customer"]    = customerModel;
     context.TempData["errorscript"] = errorscript;
     context.TempData["fid"]         = strfid;
     context.TempData["footer"]      = "奥琦微商易";
     t.Render(Response.Output);
 }
Beispiel #18
0
        /// <summary>
        /// 用户注册
        /// </summary>
        void ToSaveUserInfo()
        {
            string inputphone = string.Empty; string logpwd = string.Empty;

            if (Request["inputphone"] != null && Request["inputphone"] != "")
            {
                inputphone = Common.Common.NoHtml(Request["inputphone"]);
            }
            if (Request["logpwd"] != null && Request["logpwd"] != "")
            {
                logpwd = Common.Common.NoHtml(Request["logpwd"]);
            }
            if (inputphone.Trim() != null && inputphone.Trim() != "" && logpwd.Trim() != null && logpwd.Trim() != "")
            {
                MSCustomersDAL customerDal = new MSCustomersDAL();
                if (customerDal.ExistCustomer(strOpenID, inputphone, "", ""))
                {
                    Response.Write("{\"error\":true,\"msg\":\"该用户已经存在\"}");
                }
                else
                {
                    MSCustomers customerModel = new MSCustomers();
                    string      strID         = string.Empty;
                    strID                  = Guid.NewGuid().ToString("N").ToUpper();
                    customerModel.ID       = strID;
                    customerModel.Phone    = inputphone;
                    customerModel.OpenID   = strOpenID;
                    customerModel.NickName = regNickName;
                    customerModel.Sex      = regSex;
                    customerModel.HeadImg  = regHeadImg;
                    customerModel.UserPwd  = Common.Common.MD5(logpwd);
                    customerModel.IsDel    = 0;

                    MSVAcctDetailDAL vacctdetailDal = new MSVAcctDetailDAL();
                    MSVAcctDAL       vacctDal       = new MSVAcctDAL();

                    if (customerDal.AddCustomers(customerModel))
                    {
                        int vcount = 2;
                        if (!vacctDal.ExistMSVAcct(strID, ""))
                        {
                            MSVAcct vaccModel = new MSVAcct();
                            vaccModel.CustID   = strID;
                            vaccModel.SiteCode = "VYIGO";
                            vaccModel.V_Amont  = vcount;
                            MSVAcctDetail vaccDetailModel = new MSVAcctDetail();
                            vaccDetailModel.Amount     = vcount;
                            vaccDetailModel.ChargeType = "注册";
                            vaccDetailModel.CustID     = strID;
                            vaccDetailModel.Ext_Fld1   = "";
                            vaccDetailModel.IsReceive  = 1;
                            vaccDetailModel.SiteCode   = "VYIGO";
                            //vacctDal.AddMSVAcct(vaccModel);
                            //vacctdetailDal.AddMSVAcctDetail(vaccDetailModel);
                        }
                        Response.Write("{\"success\":true,\"msg\":\"操作成功\"}");
                    }
                    else
                    {
                        Response.Write("{\"error\":true,\"msg\":\"操作失败,请核对后再操作\"}");
                    }
                }
            }
            Response.End();
        }
Beispiel #19
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();
            }
        }
Beispiel #20
0
        /// <summary>
        /// 订单提交
        /// </summary>
        void submitOrder()
        {
            string ordernum = string.Empty; int imgcount = 0;
            string img1 = string.Empty; string img2 = string.Empty;
            string openid = string.Empty; string userid = string.Empty;

            if (Session["OpenID"] != null && Session["OpenID"].ToString() != "")
            {
                openid = Session["OpenID"].ToString();
            }
            if (openid != null && openid != "")
            {
                MSCustomersDAL customerDal = new MSCustomersDAL();
                try
                {
                    userid = customerDal.GetCustomerValueByOpenID("ID", openid).ToString();
                }
                catch (Exception)
                {
                }
            }
            #region -------------获取请求值------------
            try
            {
                ordernum = Request.Form.Get("ordernum").ToString();
            }
            catch (Exception)
            {
                ordernum = "";
            }
            #endregion
            try
            {
                imgcount = Request.Files.Count;
            }
            catch (Exception)
            {
            }
            if (imgcount == 2)
            {
                img1 = UploadImg(0, "printimg", ordernum);
                img2 = UploadImg(1, "shareimg", ordernum);
                if (userid == null || userid == "" && ordernum != null && ordernum != "")
                {
                    MSProductOrderDAL orderDal = new MSProductOrderDAL();
                    userid = orderDal.GetOrderValueByID("CustomerID", ordernum).ToString();
                }
                if (ordernum != null && ordernum != "")
                {
                    MSPhotoSubmit    photoModel = new MSPhotoSubmit();
                    MSPhotoSubmitDAL photoDal   = new MSPhotoSubmitDAL();
                    photoModel.OrderNum = ordernum;
                    photoModel.Img1     = img1;
                    photoModel.Img2     = img2;
                    photoModel.UID      = userid;
                    photoModel.ID       = Guid.NewGuid().ToString("N").ToUpper();
                    if (!photoDal.AddPhotoSubmit(photoModel))
                    {
                        errormsg = JQDialog.alertOKMsgBoxGoBack(3, "操作失败,请重新操作!", false);
                    }
                    else
                    {
                        errormsg = JQDialog.alertOKMsgBox(3, "操作成功,请等待审核!", "PrintImgOrder.aspx", "succeed");
                    }
                }
                else
                {
                    errormsg = JQDialog.alertOKMsgBoxGoBack(3, "请输入正确的订单!", false);
                }
            }
            else
            {
                errormsg = JQDialog.alertOKMsgBoxGoBack(3, "请选择您要打印的照片和分享的照片!", false);
            }
        }
        void editeCustomerinfo()
        {
            string nickname = string.Empty; string modelimgurl = string.Empty;

            try
            {
                nickname = HttpContext.Current.Request.Form.Get("nickname").ToString();
            }
            catch (Exception)
            {
                nickname = "";
            }
            MSCustomers    customerModel = new MSCustomers();
            MSCustomersDAL customerDal   = new MSCustomersDAL();

            customerModel.ID = strUid;
            if (nickname != null && nickname != "")
            {
                #region -----------------头像上传-------------------
                HttpFileCollection files = HttpContext.Current.Request.Files;
                if (files.Count > 0)
                {
                    //检查文件扩展名字
                    HttpPostedFile postedFile = files[0];
                    string         fileName, fileExtension, file_oldid, file_id;
                    //取出精确到毫秒的时间做文件的名称
                    string my_file_id = DateTime.Now.ToString("yyyyMMddHHmmssfff");
                    fileName      = System.IO.Path.GetFileName(postedFile.FileName);
                    fileExtension = System.IO.Path.GetExtension(fileName);
                    file_id       = my_file_id + fileExtension;
                    if (fileName != "" && fileName != null && fileName.Length > 0)
                    {
                        fileExtension = System.IO.Path.GetExtension(fileName);
                        string saveurl;
                        modelimgurl = "HeadImg/";
                        saveurl     = "../PalmShop/ShopCode/" + modelimgurl;
                        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);
                        }
                        modelimgurl = modelimgurl + file_id;
                    }
                }
                #endregion
                customerModel.NickName = nickname;
                if (modelimgurl != null && modelimgurl != "")
                {
                    customerModel.HeadImg = modelimgurl;
                }
                customerModel.IsDel = 0;
                if (customerDal.UpdateCustomers(customerModel))
                {
                    if (modelimgurl != null && modelimgurl != "")
                    {
                        if (oldimgname != null && oldimgname != "")
                        {
                            File.Delete(String.Format(@"{0}PalmShop/ShopCode/{1}",
                                                      Server.MapPath("~"), oldimgname));
                        }
                    }
                    errorscript = JQDialog.alertOKMsgBox(3, "操作成功", "MyTopicList.aspx?fid=" + strfid,
                                                         "succeed");
                }
                else
                {
                    errorscript = JQDialog.alertOKMsgBox(3, "操作失败,请核对后再操作", "Customerinfo.aspx?fid=" + strfid,
                                                         "error");
                }
            }
            else
            {
                errorscript = JQDialog.alertOKMsgBox(3, "操作失败,请核对后再操作",
                                                     "Customerinfo.aspx?fid=" + strfid, "error");
            }
        }
 public void getTemplate()
 {
     #region -----------获取客户信息---------
     MSCustomers    CustomerModel = new MSCustomers();
     MSCustomersDAL CustomerDal   = new MSCustomersDAL();
     DataSet        CustomerDs;
     if (strUid != null && strUid != "")
     {
         CustomerDs = CustomerDal.GetCustomerDetail(strUid);
         if (null != CustomerDs && CustomerDs.Tables.Count > 0 && CustomerDs.Tables[0].Rows.Count > 0)
         {
             CustomerModel = DataConvert.DataRowToModel <MSCustomers>(CustomerDs.Tables[0].Rows[0]);
             if (CustomerModel.NickName == null || CustomerModel.NickName == "" ||
                 CustomerModel.NickName.ToLower() == "null")
             {
                 CustomerModel.NickName = "游客";
             }
         }
     }
     #endregion
     #region ---------评论列表以及信息回复------------
     List <CommentListGetSet> commentModelList = new List <CommentListGetSet>();
     MSForumCommentDAL        commentDal       = new MSForumCommentDAL();
     DataSet commentDs = commentDal.GetCommentList(" and a.[uid]='" + strUid + "' ");
     DataSet repcommentds;
     List <CommentListGetSet> repcommentModelList = new List <CommentListGetSet>();
     int commentcount = 0;
     if (commentDs != null && commentDs.Tables.Count > 0 && commentDs.Tables[0].Rows.Count > 0)
     {
         foreach (DataRow row in commentDs.Tables[0].Rows)
         {
             CommentListGetSet commentModel = DataConvert.DataRowToModel <CommentListGetSet>(row);
             if (commentModel.NickName == null || commentModel.NickName == "")
             {
                 commentModel.NickName = "游客";
             }
             #region ----------------获取回复信息-----------------------
             string repid = commentModel.ID;
             repcommentds = commentDal.GetRepCommentList(" and a.[uid]='" + strUid + "' and a.UpID='" + repid + "' ");
             if (repcommentds != null && repcommentds.Tables.Count > 0 && repcommentds.Tables[0].Rows.Count > 0)
             {
                 foreach (DataRow reprow in repcommentds.Tables[0].Rows)
                 {
                     CommentListGetSet repcommentModel = DataConvert.DataRowToModel <CommentListGetSet>(reprow);
                     if (repcommentModel.NickName == null || repcommentModel.NickName == "")
                     {
                         repcommentModel.NickName = "游客";
                     }
                     repcommentModelList.Add(repcommentModel);
                 }
             }
             #endregion
             commentModelList.Add(commentModel);
         }
     }
     try
     {
         commentcount = commentDs.Tables[0].Rows.Count;
     }
     catch (Exception)
     {
         commentcount = 0;
     }
     #endregion
     #region --------------获取喜欢 总数------------------
     int likecount = 0;
     MSForumTopicLoveDAL likeDal = new MSForumTopicLoveDAL();
     try
     {
         likecount = likeDal.GetLoveOrLikeCountByUID(strUid, "tlike");
     }
     catch (Exception)
     {
         likecount = 0;
     }
     #endregion
     #region ------------获取消息总数---------------
     int msgcount = 0;
     try
     {
         msgcount = commentDal.GetCommentCountByUID(strUid);
     }
     catch (Exception)
     {
         msgcount = 0;
     }
     #endregion
     #region ---------帖子总数-------------
     int             topiccount = 0;
     MSForumTopicDAL topicdal   = new MSForumTopicDAL();
     try
     {
         topiccount = topicdal.GetTopicCountByUID(strUid);
     }
     catch (Exception)
     {
         topiccount = 0;
     }
     #endregion
     string text = System.IO.File.ReadAllText(Server.MapPath("HtmlPage/Mycommentlist.html"));
     JinianNet.JNTemplate.TemplateContext context = new JinianNet.JNTemplate.TemplateContext();
     JinianNet.JNTemplate.Template        t       = new JinianNet.JNTemplate.Template(context, text);
     context.TempData["customer"]       = CustomerModel;
     context.TempData["commentlist"]    = commentModelList;
     context.TempData["repcommentlist"] = repcommentModelList;
     context.TempData["fid"]            = strfid;
     context.TempData["likecount"]      = likecount;
     context.TempData["msgcount"]       = msgcount;
     context.TempData["topiccount"]     = topiccount;
     context.TempData["errorscript"]    = errorscript;
     context.TempData["uid"]            = strUid;
     context.TempData["footer"]         = "奥琦微商易";
     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);
        }
Beispiel #24
0
        void RegOrUpdateShop()
        {
            string shopname    = string.Empty;
            string wxname      = string.Empty;
            string wxnum       = string.Empty;
            string isnull      = "";
            string ShopLogo    = string.Empty;
            string ShopBackImg = string.Empty;
            string RealName    = string.Empty;
            string IDnum       = string.Empty;
            string IDimg       = string.Empty;

            #region --------------------获取请求参数值-------------------------------
            try
            {
                shopname = Request.Form.Get("shopname").ToString();
            }
            catch (Exception)
            {
                shopname = isnull;
            }
            try
            {
                wxname = Request.Form.Get("wxname").ToString();
            }
            catch (Exception)
            {
                wxname = isnull;
            }
            try
            {
                wxnum = Request.Form.Get("wxnum").ToString();
            }
            catch (Exception)
            {
                wxnum = isnull;
            }
            try
            {
                ShopLogo = Request.Files.Get("logoimg").FileName.ToString();
            }
            catch (Exception)
            {
                ShopLogo = isnull;
            }
            try
            {
                ShopBackImg = Request.Files.Get("backimg").FileName.ToString();
            }
            catch (Exception)
            {
                ShopBackImg = isnull;
            }
            try
            {
                RealName = Request.Files.Get("realname").FileName.ToString();
            }
            catch (Exception)
            {
                RealName = isnull;
            }
            try
            {
                IDnum = Request.Form.Get("idnum").ToString();
            }
            catch (Exception)
            {
                IDnum = isnull;
            }
            try
            {
                IDimg = Request.Files.Get("idimg").FileName.ToString();
            }
            catch (Exception)
            {
                IDimg = isnull;
            }
            #endregion
            #region ---------------------获取图像---------------------------
            if (ShopLogo != null && ShopLogo != "")
            {
                ShopLogo = "ShopLogo/" + UploadImg("logoimg");
            }
            if (ShopBackImg != null && ShopBackImg != "")
            {
                ShopBackImg = "ShopLogo/" + UploadImg("backimg");
            }
            if (IDimg != null && IDimg != "")
            {
                IDimg = "ShopLogo/" + UploadImg("idimg");
            }
            #endregion
            MSShop    shopModel = new MSShop();
            MSShopDAL shopDal   = new MSShopDAL();
            #region ----------------------设置Model值-----------------------------------
            if (shopname != null && shopname != "")
            {
                shopModel.ShopName = shopname;
            }
            shopModel.WXName      = wxname;
            shopModel.WXNum       = wxnum;
            shopModel.ShopLogo    = ShopLogo;
            shopModel.ShopBackImg = ShopBackImg;
            string regSid = string.Empty;
            if (strUid != null && strUid != "")
            {
                shopModel.UID = strUid;
            }
            if (strSID != null && strSID != "")
            {
                shopModel.ID = strSID;
            }
            else
            {
                regSid       = Guid.NewGuid().ToString("N").ToUpper();
                shopModel.ID = regSid;
            }
            #endregion
            #region ------------------更新注册店铺用户身份信息---------------------------
            if (strUid != null && strUid != "")
            {
                MSCustomersDAL UserDal = new MSCustomersDAL();
                UserDal.UpdateUserIDnum(strUid, RealName, IDnum, IDimg);
            }
            #endregion
            #region ---------------------更新或注册店铺信息--------------------------------------
            if (strSID != null && strSID != "" && action == "uedite")
            {
                if (shopDal.UpdateMSShop(shopModel))
                {
                    errorscript = JQDialog.alertOKMsgBox(3, "操作成功!", "MyShop.aspx", "succeed");
                }
                else
                {
                    errorscript = JQDialog.alertOKMsgBox(3, "操作失败,请核对后再操作!", "ApplyShop.aspx", "error");
                }
            }
            else
            {
                if (!shopDal.ExistMSShop(shopname, strUid))
                {
                    if (shopDal.AddMSShop(shopModel))
                    {
                        Session["SID"] = regSid;
                        errorscript    = JQDialog.alertOKMsgBox(3, "操作成功!", "MyShop.aspx", "succeed");
                    }
                    else
                    {
                        errorscript = JQDialog.alertOKMsgBox(3, "操作失败,请核对后再操作!", "ApplyShop.aspx", "error");
                    }
                }
                else
                {
                    JQDialog.SetCookies("pageurl", "MyShop.aspx", 2);
                    errorscript = JQDialog.alertOKMsgBox(3, "改店铺已经存在,请登录后操作", "UserLogin.aspx", "error");
                }
            }
            #endregion
        }
Beispiel #25
0
        void GetHtmlPage()
        {
            string strWhere = string.Empty; string productmodelid = string.Empty;
            string orderstate = string.Empty; string paystate = string.Empty; string receive = string.Empty;
            string oid = string.Empty;//支付成功返回订单

            #region -获取用户信息
            if (strOpenID != null && strOpenID != "")
            {
                MSCustomersDAL customerDal = new MSCustomersDAL();
                try
                {
                    customerid = customerDal.GetCustomerValueByOpenID("ID", strOpenID).ToString();
                }
                catch (Exception)
                {
                }
            }
            else
            {
                if (Session["customerID"] != null && Session["customerID"].ToString() != "")
                {
                    customerid = Session["customerID"].ToString();
                }
                else
                {
                    JQDialog.SetCookies("pageurl", "CustomerOrder.aspx", 2);
                    errormsg = JQDialog.alertOKMsgBox(5, "操作失败<br/>请登录后再操作!",
                                                      "UserLogin.aspx", "error");
                }
            }
            #endregion
            List <MyOrderList> myorderlistModel = new List <MyOrderList>();
            if (customerid != null && customerid != "")
            {
                MSProductOrderDAL orderDal = new MSProductOrderDAL();
                #region -获取请求信息
                if (Request["oid"] != null && Request["oid"] != "")
                {
                    oid = Common.Common.NoHtml(Request["oid"]);
                }
                if (Request["orderstate"] != null && Request["orderstate"] != "")
                {
                    orderstate = Common.Common.NoHtml(Request["orderstate"]);
                }
                if (Request["paystate"] != null && Request["paystate"] != "")
                {
                    paystate = Common.Common.NoHtml(Request["paystate"]);
                }
                if (Request["receive"] != null && Request["receive"] != "")
                {
                    receive = Common.Common.NoHtml(Request["receive"]);
                }
                strWhere = " and a.CustomerID='" + customerid + "' ";
                if (orderstate.Trim() != null && orderstate.Trim() != "")
                {
                    strWhere += " and OrderState=" + orderstate;
                }
                if (paystate.Trim() != null && paystate.Trim() != "")
                {
                    strWhere += " and PayState=" + paystate;
                }
                else
                {
                    strWhere += " and PayState=1 ";
                }
                if (receive.Trim() != null && receive.Trim() != "")
                {
                    strWhere += " and IsReceive=" + receive;
                }
                else
                {
                    strWhere += " and IsReceive=0 ";
                }
                if (oid.Trim() != null && oid.Trim() != "")
                {
                    strWhere += " and a.ID='" + oid + "' ";
                }
                #endregion
                strWhere += " and a.CustomerID='" + customerid + "' ";
                DataSet orderds = orderDal.GetCustomerOrderList(strWhere);
                if (orderds != null && orderds.Tables.Count > 0 && orderds.Tables[0].Rows.Count > 0)
                {
                    foreach (DataRow item in orderds.Tables[0].Rows)
                    {
                        MyOrderList ordermodel = DataConvert.DataRowToModel <MyOrderList>(item);
                        productmodelid = ordermodel.Mid;
                        if (ordermodel.Ptitle.Length > 10)
                        {
                            ordermodel.Ptitle = ordermodel.Ptitle.ToString().Substring(0, 10) + "..";
                        }
                        myorderlistModel.Add(ordermodel);
                    }
                }
            }
            else
            {
                JQDialog.SetCookies("pageurl", "CustomerOrder.aspx", 2);
                errormsg = JQDialog.alertOKMsgBox(5, "操作失败<br/>请登录后再操作!",
                                                  "UserLogin.aspx", "error");
            }

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

            //context.TempData["artList"] = liArtList;
            context.TempData["myorderlist"] = myorderlistModel;
            context.TempData["errormsg"]    = errormsg;
            context.TempData["customerid"]  = customerid;

            JinianNet.JNTemplate.Template t = new JinianNet.JNTemplate.Template(context, text);
            t.Render(Response.Output);
        }
Beispiel #26
0
 void getTemplate()
 {
     #region -----------获取客户信息---------
     MSCustomers    CustomerModel = new MSCustomers();
     MSCustomersDAL CustomerDal   = new MSCustomersDAL();
     DataSet        CustomerDs;
     if (strUid != null && strUid != "")
     {
         CustomerDs = CustomerDal.GetCustomerDetail(strUid);
         if (null != CustomerDs && CustomerDs.Tables.Count > 0 && CustomerDs.Tables[0].Rows.Count > 0)
         {
             CustomerModel = DataConvert.DataRowToModel <MSCustomers>(CustomerDs.Tables[0].Rows[0]);
             if (CustomerModel.NickName == null || CustomerModel.NickName == "" ||
                 CustomerModel.NickName.ToLower() == "null")
             {
                 CustomerModel.NickName = "游客";
             }
         }
     }
     #endregion
     #region ----------获取帖子列表----------------
     MSForumTopicDAL       topicDal       = new MSForumTopicDAL();
     List <TopicModelList> topicModellist = new List <TopicModelList>();
     int     topicCount  = 0;
     DataSet topiclistds = topicDal.GetMSForumTopicList(" and a.[UID]='" + strUid + "' ", 0);
     if (topiclistds != null && topiclistds.Tables.Count > 0 && topiclistds.Tables[0].Rows.Count > 0)
     {
         topicCount = topiclistds.Tables[0].Rows.Count;
         foreach (DataRow row in topiclistds.Tables[0].Rows)
         {
             TopicModelList topicmodel = DataConvert.DataRowToModel <TopicModelList>(row);
             if (topicmodel.NickName == null || topicmodel.NickName == "" || topicmodel.NickName.Length < 1)
             {
                 topicmodel.NickName = "游客";
             }
             if (topicmodel.HeadImg == null || topicmodel.HeadImg == "")
             {
                 topicmodel.HeadImg = "images/2.png";
             }
             string msg = topicmodel.TopicDesc;
             msg = JQDialog.GetTextFromHTML(msg);
             if (msg.Length > 250)
             {
                 msg = msg.ToString().Substring(0, 100) + "...";
             }
             topicmodel.TopicDesc = msg;
             topicModellist.Add(topicmodel);
         }
     }
     #endregion
     #region --------------获取喜欢 总数------------------
     int likecount = 0;
     MSForumTopicLoveDAL likeDal = new MSForumTopicLoveDAL();
     try
     {
         likecount = likeDal.GetLoveOrLikeCountByUID(strUid, "tlike");
     }
     catch (Exception)
     {
         likecount = 0;
     }
     #endregion
     #region ------------获取消息总数---------------
     int msgcount = 0;
     MSForumCommentDAL commentDal = new MSForumCommentDAL();
     try
     {
         msgcount = commentDal.GetCommentCountByUID(strUid);
     }
     catch (Exception)
     {
         msgcount = 0;
     }
     #endregion
     string text = System.IO.File.ReadAllText(Server.MapPath("HtmlPage/othertopiclist.html"));
     JinianNet.JNTemplate.TemplateContext context = new JinianNet.JNTemplate.TemplateContext();
     JinianNet.JNTemplate.Template        t       = new JinianNet.JNTemplate.Template(context, text);
     context.TempData["mytopiclist"] = topicModellist;
     context.TempData["topiccount"]  = topicCount;
     context.TempData["customer"]    = CustomerModel;
     context.TempData["fid"]         = strfid;
     context.TempData["likecount"]   = likecount;
     context.TempData["msgcount"]    = msgcount;
     context.TempData["errorscript"] = errorscript;
     context.TempData["uid"]         = strUid;
     context.TempData["myuid"]       = strMyUid;
     context.TempData["footer"]      = "奥琦微商易";
     t.Render(Response.Output);
 }
Beispiel #27
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 + "】我们将尽快为您打包商品,请耐心等待: )");
                    }
                }
            }
        }
Beispiel #28
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);
        }
        /// <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);
        }
Beispiel #30
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();
        }