Exemplo n.º 1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            string strMobile    = string.Empty;
            string strUserName  = string.Empty;
            string strPassWord  = string.Empty;
            string strPassWord1 = string.Empty;
            string strSiteCode  = string.Empty;
            string strSiteName  = string.Empty;
            string strErrInfo   = string.Empty;

            if (null != Request.QueryString["SiteCode"])
            {
                strSiteCode = Common.Common.NoHtml(Request.QueryString["SiteCode"].ToString());
                CustomerSession.strSiteCode = strSiteCode;
            }
            //strSiteID = "KM_HLF";
            DAL.SYS.AccountDAL dalAccount = new DAL.SYS.AccountDAL();
            DataSet            dsAccount  = dalAccount.GetSiteData(strSiteCode);

            if (null != dsAccount && dsAccount.Tables.Count > 0 && dsAccount.Tables[0].Rows.Count > 0)
            {
                strSiteCode = dsAccount.Tables[0].Rows[0]["SiteCode"].ToString();
                strSiteName = dsAccount.Tables[0].Rows[0]["Name"].ToString();
                GlobalSession.strSiteCode = strSiteCode;
            }

            if (null != Request.QueryString["action"])
            {
                if (Common.Common.NoHtml(Request.QueryString["action"].ToString()) == "save")
                {
                    strMobile    = Request.Form["mobile"].ToString();
                    strUserName  = Request.Form["username"].ToString();
                    strPassWord  = Request.Form["password"].ToString();
                    strPassWord1 = Request.Form["password1"].ToString();

                    if (string.IsNullOrEmpty(strMobile) || string.IsNullOrEmpty(strUserName) || string.IsNullOrEmpty(strPassWord) || string.IsNullOrEmpty(strPassWord1))
                    {
                        strErrInfo = "请完整填写注册信息!";
                    }
                    if (strPassWord != strPassWord1)
                    {
                        strErrInfo = "两次输入的密码不一致!";
                    }

                    DAL.SYS.CustomerDAL dalCustomer = new DAL.SYS.CustomerDAL();

                    if (dalCustomer.CheckMobile(strMobile))
                    {
                        strErrInfo = "此手机号码已经注册!";
                    }
                    else
                    {
                        Model.SYS.SYS_Customer modelAdd = new Model.SYS.SYS_Customer
                        {
                            ID       = Guid.NewGuid().ToString("N").ToUpper(),
                            Mobile   = strMobile,
                            Name     = strUserName,
                            PassWord = Common.Common.MD5(strPassWord),
                            OpenID   = "",
                            SiteCode = GlobalSession.strSiteCode
                        };
                        if (dalCustomer.AddCustomerData(modelAdd))
                        {
                            strErrInfo = "账户添加成功!";
                            Response.Redirect("ProductList.aspx?SiteCode=" + strSiteCode, false);
                        }
                        else
                        {
                            strErrInfo = "账户添加失败!";
                        }
                    }
                }
            }
            string text = System.IO.File.ReadAllText(Server.MapPath("Themes/Default/Reg.html"));

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

            context.TempData["SiteCode"] = GlobalSession.strSiteCode;
            context.TempData["ErrInfo"]  = strErrInfo;
            context.TempData["Title"]    = "用户注册";
            context.TempData["SiteName"] = strSiteName;
            context.TempData["footer"]   = "奥琦微商易";

            JinianNet.JNTemplate.Template t = new JinianNet.JNTemplate.Template(context, text);
            t.Render(Response.Output);
        }
Exemplo n.º 2
0
        /// <summary>
        /// 添加客户信息
        /// </summary>
        /// <param name="model">客户信息</param>
        ///
        public bool AddCustomerData(Model.SYS.SYS_Customer model)
        {
            StringBuilder strSql  = new StringBuilder();
            StringBuilder strSql1 = new StringBuilder();
            StringBuilder strSql2 = new StringBuilder();

            if (model.ID != null)
            {
                strSql1.Append("ID,");
                strSql2.Append("'" + model.ID + "',");
            }
            if (model.Mobile != null)
            {
                strSql1.Append("Mobile,");
                strSql2.Append("'" + model.Mobile + "',");
            }
            if (model.Name != null)
            {
                strSql1.Append("Name,");
                strSql2.Append("'" + model.Name + "',");
            }
            if (model.PassWord != null)
            {
                strSql1.Append("PassWord,");
                strSql2.Append("'" + model.PassWord + "',");
            }
            if (model.OpenID != null)
            {
                strSql1.Append("OpenID,");
                strSql2.Append("'" + model.OpenID + "',");
            }
            if (model.SiteCode != null)
            {
                strSql1.Append("SiteCode,");
                strSql2.Append("'" + model.SiteCode + "',");
            }
            if (model.MemberShipNo != null)
            {
                strSql1.Append("MemberShipNo,");
                strSql2.Append("'" + model.MemberShipNo + "',");
            }
            strSql.Append("INSERT INTO SYS_Customers(");
            strSql.Append(strSql1.ToString().Remove(strSql1.Length - 1));
            strSql.Append(")");
            strSql.Append(" VALUES (");
            strSql.Append(strSql2.ToString().Remove(strSql2.Length - 1));
            strSql.Append(");");

            strSql.Append(" UPDATE SYS_Customers SET ID = '" + model.ID + "'");
            strSql.Append(" WHERE ID ='" + model.ID + "' ");
            int rowsAffected = DbHelperSQL.ExecuteSql(strSql.ToString());

            if (rowsAffected > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Exemplo n.º 3
0
        protected void Page_Load(object sender, EventArgs e)
        {
            string strTitle  = string.Empty;
            string strTheme  = string.Empty;
            string strCustID = string.Empty;

            if (null == Request.QueryString["sitecode"])
            {
                return;
            }
            if (null == Request.QueryString["openid"])
            {
                return;
            }

            string strSiteCode = Common.Common.NoHtml(Request.QueryString["sitecode"].ToString());
            string strOpenID   = string.Empty;

            if (Request.QueryString["openid"].ToString().Length > 29 || Request.QueryString["openid"].ToString().Length < 25)
            {
                strOpenID = Common.Common.NoHtml(Request.QueryString["openid"].ToString());
                return;
            }
            else
            {
                strOpenID = Request.QueryString["openid"].ToString();
            }

            DAL.SYS.AccountDAL dalAccount = new DAL.SYS.AccountDAL();
            DataSet            ds         = dalAccount.GetAExtDataBySiteCode(strSiteCode);

            if (null != ds && ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0)
            {
                strTheme = ds.Tables[0].Rows[0]["Themes"].ToString();
                strTitle = ds.Tables[0].Rows[0]["Name"].ToString();
                Session["strSiteCode"] = ds.Tables[0].Rows[0]["SiteCode"].ToString();
            }
            //会员卡判断处理
            DAL.SYS.CustomerDAL      dalCust  = new DAL.SYS.CustomerDAL();
            DAL.Site.SiteMemberNoDAL dalMemNo = new DAL.Site.SiteMemberNoDAL();
            string strCustNo = dalCust.GetCustMemberShipNo(strSiteCode, strOpenID);
            string strMemNO  = string.Empty;

            if (strCustNo == "0" || strCustNo == "-1")
            {
                strMemNO = dalMemNo.GetMemberShipNo(strSiteCode);
                if (strCustNo == "-1") //没有用户记录
                {
                    //插入用户记录
                    Model.SYS.SYS_Customer modelAdd = new Model.SYS.SYS_Customer
                    {
                        ID           = Guid.NewGuid().ToString("N").ToUpper(),
                        Mobile       = "",
                        Name         = "",
                        PassWord     = "",
                        OpenID       = strOpenID,
                        SiteCode     = strSiteCode,
                        MemberShipNo = strMemNO
                    };
                    if (!dalCust.AddCustomerData(modelAdd))
                    {
                        return;
                    }
                }
                if (strCustNo == "0") //有用户记录,没有会员账号
                {
                    //写入用户账号
                    strMemNO = dalMemNo.GetMemberShipNo(strSiteCode);
                    dalCust.UpdateCutMemberShipNo(strSiteCode, strOpenID, strMemNO);
                }
                //修改站点账户状态
                dalMemNo.UpdateMemNoState(strSiteCode, strMemNO, "1");
            }
            if (strCustNo == "0" || strCustNo == "-1")
            {
                strCustNo = dalCust.GetCustMemberShipNo(strSiteCode, strOpenID);
            }
            //取最近的消费记录

            //读取模板内容
            string text = string.Empty;

            if (!File.Exists(Server.MapPath("Themes/" + strTheme + "/MemberShip.html")))
            {
                text = System.IO.File.ReadAllText(Server.MapPath("Themes/MemberShip/MemberShip.html"));
            }
            else
            {
                text = System.IO.File.ReadAllText(Server.MapPath("Themes/" + strTheme + "/MemberShip.html"));
            }

            JinianNet.JNTemplate.TemplateContext context = new JinianNet.JNTemplate.TemplateContext();
            Common.QRCode qr = new Common.QRCode();
            //context.TempData["qrcode"] = qr.GetQRCode("http://114.215.108.27/WebService/CustMemNo.aspx?SiteCode=" + strSiteCode + "&MemNo=" + strCustNo + "&OpenId=" + strOpenID);
            context.TempData["qrcode"]   = qr.GetImageQRCode("http://114.215.108.27/WebService/CustMemNo.aspx?SiteCode=" + strSiteCode + "&MemNo=" + strCustNo + "&OpenId=" + strOpenID);
            context.TempData["memno"]    = strCustNo;
            context.TempData["title"]    = strTitle;
            context.TempData["siteid"]   = Session["siteid"];
            context.TempData["footer"]   = "奥琦微商易";
            context.TempData["sitecode"] = Session["strSiteCode"].ToString();

            JinianNet.JNTemplate.Template t = new JinianNet.JNTemplate.Template(context, text);
            t.Render(Response.Output);
        }