Пример #1
0
    private string homeLogin()
    {
        string uEmail    = Request["UserEmail"];
        string uPwd      = Request["Password"];
        string viladCode = Request["viladCode"];

        string sessionCode = Cmn.Session.Get("code");

        if (!sessionCode.Equals(viladCode))
        {
            return("验证码输入错误");
        }

        DBEntity.Tab_UserCommunity ent = DBEntity.Tab_UserCommunity.Get(uEmail, uPwd);
        if (ent == null)
        {
            return("用户名或者密码错误");
        }
        return("dd");

        //int remeberDay = 1;
        //if (ChkRemeberLogined.Checked)
        //{
        //    remeberDay = 7;
        //}

        //Session["loginUser"] = ent;
        //Cmn.Cookies.Set("login_UserEmail", ent.UserEmail, remeberDay);
        //Cmn.Cookies.Set("login_RealName", ent.RealName, remeberDay);

        //Response.Redirect("index.aspx");
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!this.IsPostBack)
        {
            try
            {
                string validCode = Request["validCode"];
                string strSql    = "update Tab_UserCommunity set RegViladBool='yes' where RegViladCode=@validCode";
                SqlHelper.ExecuteNonQuery(CommandType.Text, strSql,
                                          new SqlParameter("@validCode", validCode));

                DBEntity.Tab_UserCommunity ent = new DBEntity.Tab_UserCommunity().GetByRegCode(validCode);
                Session["loginUser"] = ent;
                Cmn.Cookies.Set("login_UserIdx", ent.Idx.ToString(), 1);
                Cmn.Cookies.Set("login_UserEmail", ent.UserEmail, 1);
                Cmn.Cookies.Set("login_RealName", ent.RealName, 1);
                Cmn.Cookies.Set("login_VipBool", ent.VipBool, 1);

                //Cmn.Js.ShowAlert("验证成功!");
                Cmn.Js.ExeScript(string.Format("location.href='{0}'", Cmn.WebConfig.getApp("app_WebsiteDomain")));
            }
            catch (Exception ext)
            {
                Cmn.Log.Write(ext.ToString());
            }
        }
    }
        public bool Update(Tab_UserCommunity model)
        {
            string sql  = "update Tab_UserCommunity set UserEmail=@UserEmail,Password=@Password,HeadPhoto=@HeadPhoto,QqWeibo_Id=@QqWeibo_Id,KaixinWeibo_Id=@KaixinWeibo_Id,SinaWeibo_Id=@SinaWeibo_Id,UserlevelIdx_FxIdx=@UserlevelIdx_FxIdx,VipCardNo=@VipCardNo,VipBool=@VipBool,V_SignBool=@V_SignBool,SubscribeBool=@SubscribeBool,RegViladBool=@RegViladBool,RealName=@RealName,Birthday=@Birthday,MobilePhone=@MobilePhone,Province=@Province,City=@City,Address=@Address,ZipCode=@ZipCode,LastLoginIp=@LastLoginIp,CreatedDate=@CreatedDate,LastModificationDate=@LastModificationDate,RegViladCode=@RegViladCode where Idx=@Idx";
            int    rows = SqlHelper.ExecuteNonQuery(CommandType.Text, sql
                                                    , new SqlParameter("@UserEmail", model.UserEmail)
                                                    , new SqlParameter("@Password", model.Password)
                                                    , new SqlParameter("@HeadPhoto", model.HeadPhoto)
                                                    , new SqlParameter("@QqWeibo_Id", model.QqWeibo_Id)
                                                    , new SqlParameter("@KaixinWeibo_Id", model.KaixinWeibo_Id)
                                                    , new SqlParameter("@SinaWeibo_Id", model.SinaWeibo_Id)
                                                    , new SqlParameter("@UserlevelIdx_FxIdx", model.UserlevelIdx_FxIdx)
                                                    , new SqlParameter("@VipCardNo", model.VipCardNo)
                                                    , new SqlParameter("@VipBool", model.VipBool)
                                                    , new SqlParameter("@V_SignBool", model.V_SignBool)
                                                    , new SqlParameter("@SubscribeBool", model.SubscribeBool)
                                                    , new SqlParameter("@RegViladBool", model.RegViladBool)
                                                    , new SqlParameter("@RealName", model.RealName)
                                                    , new SqlParameter("@Birthday", model.Birthday)
                                                    , new SqlParameter("@MobilePhone", model.MobilePhone)
                                                    , new SqlParameter("@Province", model.Province)
                                                    , new SqlParameter("@City", model.City)
                                                    , new SqlParameter("@Address", model.Address)
                                                    , new SqlParameter("@ZipCode", model.ZipCode)
                                                    , new SqlParameter("@LastLoginIp", model.LastLoginIp)
                                                    , new SqlParameter("@CreatedDate", model.CreatedDate)
                                                    , new SqlParameter("@LastModificationDate", model.LastModificationDate)
                                                    , new SqlParameter("@RegViladCode", model.RegViladCode)
                                                    , new SqlParameter("Idx", model.Idx)
                                                    );

            return(rows > 0);
        }
        private static Tab_UserCommunity ToModel(DataRow row)
        {
            Tab_UserCommunity model = new Tab_UserCommunity();

            model.Idx                  = row.IsNull("Idx") ? null : (System.Int32?)row["Idx"];
            model.UserEmail            = row.IsNull("UserEmail") ? null : (System.String)row["UserEmail"];
            model.Password             = row.IsNull("Password") ? null : (System.String)row["Password"];
            model.HeadPhoto            = row.IsNull("HeadPhoto") ? null : (System.String)row["HeadPhoto"];
            model.QqWeibo_Id           = row.IsNull("QqWeibo_Id") ? null : (System.String)row["QqWeibo_Id"];
            model.KaixinWeibo_Id       = row.IsNull("KaixinWeibo_Id") ? null : (System.String)row["KaixinWeibo_Id"];
            model.SinaWeibo_Id         = row.IsNull("SinaWeibo_Id") ? null : (System.String)row["SinaWeibo_Id"];
            model.UserlevelIdx_FxIdx   = row.IsNull("UserlevelIdx_FxIdx") ? null : (System.Int32?)row["UserlevelIdx_FxIdx"];
            model.VipCardNo            = row.IsNull("VipCardNo") ? null : (System.String)row["VipCardNo"];
            model.VipBool              = row.IsNull("VipBool") ? null : (System.String)row["VipBool"];
            model.V_SignBool           = row.IsNull("V_SignBool") ? null : (System.String)row["V_SignBool"];
            model.SubscribeBool        = row.IsNull("SubscribeBool") ? null : (System.String)row["SubscribeBool"];
            model.RegViladBool         = row.IsNull("RegViladBool") ? null : (System.String)row["RegViladBool"];
            model.RealName             = row.IsNull("RealName") ? null : (System.String)row["RealName"];
            model.Birthday             = row.IsNull("Birthday") ? null : (System.DateTime?)row["Birthday"];
            model.MobilePhone          = row.IsNull("MobilePhone") ? null : (System.String)row["MobilePhone"];
            model.Province             = row.IsNull("Province") ? null : (System.String)row["Province"];
            model.City                 = row.IsNull("City") ? null : (System.String)row["City"];
            model.Address              = row.IsNull("Address") ? null : (System.String)row["Address"];
            model.ZipCode              = row.IsNull("ZipCode") ? null : (System.String)row["ZipCode"];
            model.LastLoginIp          = row.IsNull("LastLoginIp") ? null : (System.String)row["LastLoginIp"];
            model.CreatedDate          = row.IsNull("CreatedDate") ? null : (System.DateTime?)row["CreatedDate"];
            model.LastModificationDate = row.IsNull("LastModificationDate") ? null : (System.DateTime?)row["LastModificationDate"];
            model.RegViladCode         = row.IsNull("RegViladCode") ? null : (System.String)row["RegViladCode"];
            model.AvailablePoints      = row.IsNull("AvailablePoints") ? null : (System.Decimal?)row["AvailablePoints"];
            model.TotalPoints          = row.IsNull("TotalPoints") ? null : (System.Decimal?)row["TotalPoints"];
            model.RedemptionPoints     = row.IsNull("RedemptionPoints") ? null : (System.Decimal?)row["RedemptionPoints"];
            return(model);
        }
        public int AddNew(Tab_UserCommunity model)
        {
            string sql = "insert into Tab_UserCommunity(UserEmail,Password,HeadPhoto,QqWeibo_Id,KaixinWeibo_Id,SinaWeibo_Id,UserlevelIdx_FxIdx,VipCardNo,VipBool,V_SignBool,SubscribeBool,RegViladBool,RealName,Birthday,MobilePhone,Province,City,Address,ZipCode,LastLoginIp,CreatedDate,LastModificationDate,RegViladCode)  values(@UserEmail,@Password,@HeadPhoto,@QqWeibo_Id,@KaixinWeibo_Id,@SinaWeibo_Id,@UserlevelIdx_FxIdx,@VipCardNo,@VipBool,@V_SignBool,@SubscribeBool,@RegViladBool,@RealName,@Birthday,@MobilePhone,@Province,@City,@Address,@ZipCode,@LastLoginIp,@CreatedDate,@LastModificationDate,@RegViladCode); select @@identity ;";
            int    Idx = Convert.ToInt32(SqlHelper.ExecuteScalar(CommandType.Text, sql
                                                                 , new SqlParameter("@UserEmail", model.UserEmail)
                                                                 , new SqlParameter("@Password", model.Password)
                                                                 , new SqlParameter("@HeadPhoto", model.HeadPhoto)
                                                                 , new SqlParameter("@QqWeibo_Id", model.QqWeibo_Id)
                                                                 , new SqlParameter("@KaixinWeibo_Id", model.KaixinWeibo_Id)
                                                                 , new SqlParameter("@SinaWeibo_Id", model.SinaWeibo_Id)
                                                                 , new SqlParameter("@UserlevelIdx_FxIdx", model.UserlevelIdx_FxIdx)
                                                                 , new SqlParameter("@VipCardNo", model.VipCardNo)
                                                                 , new SqlParameter("@VipBool", model.VipBool)
                                                                 , new SqlParameter("@V_SignBool", model.V_SignBool)
                                                                 , new SqlParameter("@SubscribeBool", model.SubscribeBool)
                                                                 , new SqlParameter("@RegViladBool", model.RegViladBool)
                                                                 , new SqlParameter("@RealName", model.RealName)
                                                                 , new SqlParameter("@Birthday", model.Birthday)
                                                                 , new SqlParameter("@MobilePhone", model.MobilePhone)
                                                                 , new SqlParameter("@Province", model.Province)
                                                                 , new SqlParameter("@City", model.City)
                                                                 , new SqlParameter("@Address", model.Address)
                                                                 , new SqlParameter("@ZipCode", model.ZipCode)
                                                                 , new SqlParameter("@LastLoginIp", model.LastLoginIp)
                                                                 , new SqlParameter("@CreatedDate", model.CreatedDate)
                                                                 , new SqlParameter("@LastModificationDate", model.LastModificationDate)
                                                                 , new SqlParameter("@RegViladCode", model.RegViladCode)
                                                                 ));

            return(Idx);
        }
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!this.IsPostBack)
        {
            if (string.IsNullOrEmpty(Cmn.Cookies.Get("login_UserIdx")))
            {
                Response.Redirect("login.aspx?from=" + Request.Url.ToString());
            }

            int uIdx = int.Parse(Cmn.Cookies.Get("login_UserIdx"));
            ent = ent.Get(uIdx);

            if (ent.VipBool == "yes")
            {
                strVip      = "VIP 会员";
                strPosion   = "至臻坊会员专享";
                strTopClass = "subTit vipTit";
            }

            this.RealName.Value    = ent.RealName;
            this.MobilePhone.Value = ent.MobilePhone;
            this.Hidden1.Value     = ent.Province;
            this.City.Value        = ent.City;
            this.Address.Value     = ent.Address;
            this.ZipCode.Value     = ent.ZipCode;
        }
    }
Пример #7
0
    protected void lnkSubmit_Click(object sender, EventArgs e)
    {
        string sessionCode = Cmn.Session.Get("code");

        if (!sessionCode.Equals(viladCode.Value))
        {
            Cmn.Js.ShowAlert("验证码输入错误");
            return;
        }

        if (DBEntity.Tab_UserCommunity.HasEmail(this.UserEmail.Value) > 0)
        {
            Cmn.Js.ShowAlert(string.Format("邮箱账号:{0} 已经存!", this.UserEmail.Value));
            return;
        }

        string strGuid = Guid.NewGuid().ToString();

        DBEntity.Tab_UserCommunity ent = new DBEntity.Tab_UserCommunity();
        ent.UserEmail    = this.UserEmail.Value;
        ent.Password     = this.Password.Value;
        ent.MobilePhone  = this.MobilePhone.Value;
        ent.VipBool      = "no";
        ent.City         = "";
        ent.Province     = "";
        ent.RegViladCode = strGuid;

        ent.LastLoginIp = Request.UserHostAddress;


        ent.AddNew(ent);

        string SmtpServer   = "mail.showone.com.cn";
        string SmtpUserName = "******";
        string SmtpPassword = "******";
        string fromMail     = "*****@*****.**";
        string formName     = "SisleyCommnutiy";

        Cmn.Email el = new Cmn.Email(SmtpServer, SmtpUserName, SmtpPassword, fromMail, formName);
        el.IsBodyHtml = true;

        string subject  = "来自希思黎社区网,用户注册验证码";
        string validUrl = string.Format("{0}/EmailRegValid.aspx?validCode={1}", Cmn.WebConfig.getApp("app_WebsiteDomain"), strGuid);

        string body = string.Format("亲爱的{0}, <br /><br /> 恭喜您成功注册。<br / > 请点击以下链接验证邮箱 <br />{1}<br/><br/> 如果链接不能点击,请复制地址到浏览器,然后直接打开 <br /><br />   祝好! <br /><br /> 希思黎社区 <br />{2}", this.UserEmail.Value, validUrl, Cmn.Date.ToDateTimeStr(DateTime.Now));

        el.Send(this.UserEmail.Value, subject, body);

        Response.Redirect("register_success.aspx");
    }
Пример #8
0
    //获取登录者的信息
    private string GetLoginerInfo()
    {
        string uIdx = Cmn.Cookies.Get("login_UserIdx");

        if (string.IsNullOrEmpty(uIdx))
        {
            Cmn.Log.Write("uIdx:" + uIdx);
            return("noLogin");
        }

        //获取课程通过了几门
        string beginDate  = Cmn.WebConfig.getApp("app_CourseMainTest_BeginDate");
        string endDate    = Cmn.WebConfig.getApp("app_CourseMainTest_EndDate");
        string UserIdx_Fx = "1";     //Cmn.Cookies.Get("uIdx");

        string strSql = "select myPassNum=COUNT(1) from Tab_CourseMain_TestLog where  CreatedDate>='{0}' and CreatedDate<='{1}' and PassBool='yes' and  UserIdx_Fx={2}";

        strSql = string.Format(strSql, beginDate, endDate, UserIdx_Fx);
        int myPassNum = Convert.ToInt32(SqlHelper.ExecuteScalar(CommandType.Text, strSql));


        DBEntity.Tab_UserCommunity ent = new DBEntity.Tab_UserCommunity();
        ent = ent.Get(uIdx);

        StringBuilder sb = new StringBuilder();

        sb.AppendLine(@"<?xml version='1.0' encoding='utf-8' ?>");
        sb.AppendLine(@"<Data>");
        sb.AppendLine("<Item>");
        sb.AppendLine(String.Format("<uIdx>{0}</uIdx>", ent.Idx));
        sb.AppendLine(String.Format("<RealName>{0}</RealName>", ent.RealName));
        sb.AppendLine(String.Format("<HeadPhoto>{0}/upload/userHearderImg/{1}</HeadPhoto>", Cmn.WebConfig.getApp("app_WebsiteDomain"), ent.HeadPhoto));
        sb.AppendLine(String.Format("<UserEmail>{0}</UserEmail>", ent.UserEmail));
        sb.AppendLine(String.Format("<VipBool>{0}</VipBool>", ent.VipBool));
        sb.AppendLine(String.Format("<myPassNum>{0}</myPassNum>", myPassNum));
        sb.AppendLine(String.Format("<orderUserList>{0}</orderUserList>", "108"));

        sb.AppendLine("</Item>");
        sb.AppendLine(@"</Data>");

        return(sb.ToString());
        //}
        //catch
        //{
        //    return "noLogin";
        //}
    }
Пример #9
0
    protected void lnkLogin_Click(object sender, EventArgs e)
    {
        string uEmail    = this.txtEmail.Text;
        string uPwd      = this.txtPwd.Text;
        string viladCode = this.txtValidCode.Text;

        //Cmn.Log.Write(string.Format("uEmail={0},uPwd={1},viladCode={2}", uEmail, uPwd, viladCode));

        string sessionCode = Cmn.Session.Get("code");

        if (!sessionCode.Equals(viladCode))
        {
            Cmn.Js.ShowAlert("验证码输入错误");
            return;
        }


        DBEntity.Tab_UserCommunity ent = DBEntity.Tab_UserCommunity.Get(uEmail, uPwd);
        if (ent == null)
        {
            Cmn.Js.ShowAlert("用户名或者密码错误");
            return;
        }

        int remeberDay = 1;

        if (ChkRemeberLogined.Checked)
        {
            remeberDay = 7;
        }

        Session["loginUser"] = ent;
        Cmn.Cookies.Set("login_UserIdx", ent.Idx.ToString(), remeberDay);
        Cmn.Log.Write("Idx=" + ent.Idx.ToString());
        Cmn.Cookies.Set("login_UserEmail", ent.UserEmail, remeberDay);
        Cmn.Cookies.Set("login_RealName", ent.RealName, remeberDay);
        Cmn.Cookies.Set("login_VipBool", ent.VipBool, remeberDay);
        Cmn.Cookies.Set("login_HeadPhoto", string.Format("{0}/upload/userHearderImg/{1}", Cmn.WebConfig.getApp("app_WebsiteDomain"), ent.HeadPhoto), remeberDay);

        string url = Request["from"];

        if (string.IsNullOrEmpty(url) || url.IndexOf("register") >= 0)
        {
            url = "index.aspx";
        }
        Response.Redirect(url);
    }
Пример #10
0
        /// <summary>
        /// 根据用户名获取用户的实例
        /// </summary>
        /// <param name="UserEmail"></param>
        /// <param name="Password"></param>
        /// <returns></returns>
        public static Tab_UserCommunity Get(string UserEmail, string Password)
        {
            DataTable dt = SqlHelper.ExecuteDataset(CommandType.Text, "select * from Tab_UserCommunity  where UserEmail=@UserEmail and Password=@Password",
                                                    new SqlParameter("UserEmail", UserEmail), new SqlParameter("Password", Password)).Tables[0];

            if (dt.Rows.Count > 1)
            {
                throw new Exception("more than 1 row was found");
            }

            if (dt.Rows.Count <= 0)
            {
                return(null);
            }

            DataRow           row   = dt.Rows[0];
            Tab_UserCommunity model = ToModel(row);

            return(model);
        }
Пример #11
0
        public Tab_UserCommunity GetByRegCode(string RegViladCode)
        {
            DataTable dt = SqlHelper.ExecuteDataset(CommandType.Text, "select top 1 * from Tab_UserCommunity  where RegViladCode=@RegViladCode",
                                                    new SqlParameter("RegViladCode", RegViladCode)).Tables[0];

            if (dt.Rows.Count > 1)
            {
                throw new Exception("more than 1 row was found");
            }

            if (dt.Rows.Count <= 0)
            {
                return(null);
            }

            DataRow           row   = dt.Rows[0];
            Tab_UserCommunity model = ToModel(row);

            return(model);
        }
Пример #12
0
        public Tab_UserCommunity Get(string Idx)
        {
            DataTable dt = SqlHelper.ExecuteDataset(CommandType.Text, "select * from Tab_UserCommunity  where Idx=@Idx",
                                                    new SqlParameter("Idx", Idx)).Tables[0];

            if (dt.Rows.Count > 1)
            {
                throw new Exception("more than 1 row was found");
            }

            if (dt.Rows.Count <= 0)
            {
                return(null);
            }

            DataRow           row   = dt.Rows[0];
            Tab_UserCommunity model = ToModel(row);

            return(model);
        }
Пример #13
0
    //底部会员头像List
    private void UserCotyHeaderImgList()
    {
        string strSql = "select top 15 * from Tab_UserCommunity Order By NewID()";
        IEnumerable <DBEntity.Tab_UserCommunity> ents = new DBEntity.Tab_UserCommunity().ListAll(strSql);

        StringBuilder contentStr = new StringBuilder();
        string        headerImg;

        foreach (DBEntity.Tab_UserCommunity ent in ents)
        {
            headerImg = ent.HeadPhoto;
            bool isExist = Cmn.FileFolder.CheckFileExist(Server.MapPath(string.Format("upload/userHearderImg/{0}", headerImg)));
            if (!isExist)
            {
                headerImg = "defaultHeaderImg.jpg";
            }
            contentStr.AppendLine(string.Format("<li><img src='upload/userHearderImg/{0}' width='50' height='50' alt='' /></li>", headerImg));
        }

        //this.ltlHome_UserCommunityHeaderImg.Text = contentStr.ToString();
    }
Пример #14
0
        public static Tab_UserCommunity GetBySinaId(string SinaWeibo_Id)
        {
            DataTable dt = SqlHelper.ExecuteDataset(CommandType.Text, "select * from Tab_UserCommunity  where SinaWeibo_Id=@SinaWeibo_Id",
                                                    new SqlParameter("SinaWeibo_Id", SinaWeibo_Id)).Tables[0];


            if (dt.Rows.Count > 1)
            {
                Cmn.Log.Write("SinaWeibo_Id=" + SinaWeibo_Id);
                throw new Exception("more than 1 row was found");
            }

            if (dt.Rows.Count <= 0)
            {
                return(null);
            }

            DataRow           row   = dt.Rows[0];
            Tab_UserCommunity model = ToModel(row);

            return(model);
        }
Пример #15
0
    protected void GetSinaToken()
    {
        if (Request["code"] != null)
        {
            string client_id     = Cmn.WebConfig.getApp("app_key_sina");
            string client_secret = Cmn.WebConfig.getApp("app_secret_sina");
            string redirect_uri  = Cmn.WebConfig.getApp("app_redirectUri_sina");
            string grant_type    = "authorization_code";
            string code          = Request["code"].ToString();

            string    url          = "https://api.weibo.com/oauth2/access_token";
            string    postData     = string.Format("client_id={0}&client_secret={1}&grant_type={2}&code={3}&redirect_uri={4}", client_id, client_secret, grant_type, code, redirect_uri);
            HttpData  http         = new HttpData();
            string    responseData = http.WebRequest("post", url, postData);
            OathToken token        = JsonHelper.ParseFormJson <OathToken>(responseData);

            Cmn.Cookies.Set("access_token", token.access_token, 7);
            Cmn.Cookies.Set("uid", token.uid, 7);

            //============
            string strUrl = string.Format("https://api.weibo.com/2/users/show.json?access_token={0}&uid={1}",
                                          token.access_token, token.uid);
            string myJson                = http.WebRequest("get", strUrl, string.Empty);
            var    decodedJSON           = JObject.Parse(myJson);
            var    SinaScreen_name       = decodedJSON["screen_name"].ToString() + "_sina";
            var    SinaProfile_image_url = decodedJSON["profile_image_url"];
            var    sinaId                = decodedJSON["id"];
            //=======
            //查找会员社区表中,是否已经存在
            int    uIdx            = 0;
            string SinaPhotoHeader = Cmn.Date.ToDateStr2(DateTime.Now) + "_" + sinaId + ".png";
            string strSql          = string.Format("select count(1) from Tab_UserCommunity where SinaWeibo_Id='{0}'", sinaId);
            int    iCount          = Convert.ToInt32(SqlHelper.ExecuteScalar(CommandType.Text, strSql));
            Cmn.Log.Write("strSql=" + strSql + "|iCount=" + iCount);

            if (iCount == 0)
            {
                //保存头像
                using (WebClient wc = new WebClient())
                {
                    string photoUrl = SinaProfile_image_url.ToString();

                    string photoSavePath = Server.MapPath("~/upload/userHearderImg/") + SinaPhotoHeader;
                    wc.DownloadFile(photoUrl, photoSavePath);
                }

                //添加到数据库

                DBEntity.Tab_UserCommunity ent2 = new DBEntity.Tab_UserCommunity();
                ent2.UserEmail    = SinaScreen_name.ToString();
                ent2.RealName     = SinaScreen_name.ToString();
                ent2.VipBool      = "no";
                ent2.Password     = "******";
                ent2.City         = "";
                ent2.HeadPhoto    = SinaPhotoHeader;
                ent2.SinaWeibo_Id = sinaId.ToString();
                uIdx = ent2.AddNew(ent2);
            }

            strSql = string.Format("insert into Tab_User_LoginLog (LoginName,LoginIpAddress) values('{0}','{1}')", SinaScreen_name, Request.UserHostAddress);
            SqlHelper.ExecuteNonQuery(CommandType.Text, strSql);


            DBEntity.Tab_UserCommunity ent = DBEntity.Tab_UserCommunity.GetBySinaId(sinaId.ToString());

            uIdx = Convert.ToInt32(ent.Idx);
            int remeberDay = 7;
            Cmn.Cookies.Set("login_UserIdx", uIdx.ToString(), remeberDay);
            Cmn.Cookies.Set("login_UserEmail", ent.UserEmail, remeberDay);
            Cmn.Cookies.Set("login_RealName", ent.RealName, remeberDay);
            Cmn.Cookies.Set("login_VipBool", ent.VipBool, remeberDay);
            Cmn.Cookies.Set("login_HeadPhoto", string.Format("{0}/upload/userHearderImg/{1}", Cmn.WebConfig.getApp("app_WebsiteDomain"), ent.HeadPhoto), remeberDay);
            Cmn.Log.Write(Cmn.Cookies.Get("login_UserEmail"));


            //========= End


            Response.Redirect("index.aspx?s=" + Request["s"]);
        }
    }
Пример #16
0
    protected void lnkSubmit_Click(object sender, EventArgs e)
    {
        string sessionCode = Cmn.Session.Get("code");

        if (DBEntity.Tab_UserVipCardNo.ChkVipCard(this.VipCardNo.Value) <= 0)
        {
            Cmn.Js.ShowAlert("会员卡号不存在");
            return;
        }

        if (DBEntity.Tab_UserVipCardNo.HasCardNo(this.VipCardNo.Value) > 0)
        {
            Cmn.Js.ShowAlert("会员卡已经被人激活");
            return;
        }

        if (DBEntity.Tab_UserCommunity.HasEmail(this.UserEmail.Value) > 0)
        {
            Cmn.Js.ShowAlert(string.Format("邮箱账号:{0} 已经存!", this.UserEmail.Value));
            return;
        }

        if (!sessionCode.Equals(viladCode.Value))
        {
            Cmn.Js.ShowAlert("验证码输入错误");
            return;
        }

        string strGuid = Guid.NewGuid().ToString();

        DBEntity.Tab_UserCommunity ent = new DBEntity.Tab_UserCommunity();
        ent.UserEmail    = this.UserEmail.Value;
        ent.Password     = this.Password.Value;
        ent.VipCardNo    = this.VipCardNo.Value;
        ent.MobilePhone  = this.MobilePhone.Value;
        ent.Province     = this.Province.Items[this.Province.SelectedIndex].Value;
        ent.City         = this.City.Value;
        ent.RegViladCode = strGuid;
        ent.VipBool      = "yes";
        ent.LastLoginIp  = Request.UserHostAddress;
        ent.AddNew(ent);
        //修改会员卡状态
        string strSql = string.Format("update Tab_UserVipCardNo set VipHasUseBool='yes',VipEditDateTime=getdate() where Idx={0}", this.VipCardNo.Value);

        SqlHelper.ExecuteNonQuery(CommandType.Text, strSql);

        Cmn.Log.Write(string.Format("VIP卡:{0} -- Yes", this.VipCardNo.Value));

        //==========
        string SmtpServer   = "mail.showone.com.cn";
        string SmtpUserName = "******";
        string SmtpPassword = "******";
        string fromMail     = "*****@*****.**";
        string formName     = "SisleyCommnutiy";

        Cmn.Email el = new Cmn.Email(SmtpServer, SmtpUserName, SmtpPassword, fromMail, formName);
        el.IsBodyHtml = true;

        string subject  = "来自希思黎社区网,用户注册验证码";
        string validUrl = string.Format("{0}/EmailRegValid.aspx?validCode={1}", Cmn.WebConfig.getApp("app_WebsiteDomain"), strGuid);

        string body = string.Format("亲爱的{0}, <br /><br /> 恭喜您成功注册。<br / > 请点击以下链接验证邮箱 <br />{1}<br/><br/> 如果链接不能点击,请复制地址到浏览器,然后直接打开 <br /><br />   祝好! <br /><br /> 希思黎社区 <br />{2}", this.UserEmail.Value, validUrl, Cmn.Date.ToDateTimeStr(DateTime.Now));

        el.Send(this.UserEmail.Value, subject, body);

        Response.Redirect("register_success.aspx");
    }