public ReturnValue <bool> UpdateUserInfo(int uid, int gender, int fatetype, string intro)
        {
            if (gender > 1 || gender < 0)
            {
                throw new BusinessException("性别错误");
            }
            if (fatetype > 3 || fatetype < 1)
            {
                throw new BusinessException("排盘类型错误");
            }
            USR_CustomerMod m_user = USR_CustomerBll.GetInstance().GetModel(uid);

            if (m_user == null || m_user.SysNo == -999999)
            {
                throw new BusinessException("该用户不存在");
            }
            else
            {
                m_user.Gender   = gender;
                m_user.FateType = fatetype;
                m_user.Intro    = AppCmn.CommonTools.NoHTML(AppCmn.CommonTools.StringFilter(intro));
                USR_CustomerBll.GetInstance().Update(m_user);
                return(ReturnValue <bool> .Get200OK(true));
            }
        }
Exemple #2
0
        /// <summary>
        /// 仅用于用户登录
        /// </summary>
        /// <param name="username"></param>
        /// <param name="password"></param>
        /// <returns></returns>
        public USR_CustomerMod CheckUser(string username, string password)
        {
            USR_CustomerMod model = new USR_CustomerMod();

            using (SQLData data = new SQLData())
            {
                StringBuilder builder = new StringBuilder();
                if (Util.IsEmailAddress(username))
                {
                    builder.Append("select SysNo from USR_Customer where Email='").Append(SQLData.SQLFilter(username)).Append("' and Password='******' and Status=").Append((int)AppEnum.State.normal);
                }
                else
                {
                    builder.Append("select SysNo from USR_Customer where Phone='").Append(SQLData.SQLFilter(username)).Append("' and Password='******' and Status=").Append((int)AppEnum.State.normal);
                }
                try
                {
                    model.SysNo = int.Parse(data.CmdtoDataRow(builder.ToString())["SysNo"].ToString());
                }
                catch (Exception exception)
                {
                    //throw exception;
                }
            }
            if (model.SysNo != AppConst.IntNull)
            {
                model = this.GetModel(model.SysNo);
                model.LastLoginTime = DateTime.Now;
                this.Update(model);
            }
            return(model);
        }
Exemple #3
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public int Add(USR_CustomerMod model)
        {
            int ret = 0;
            TransactionOptions options = new TransactionOptions();
            options.IsolationLevel = System.Transactions.IsolationLevel.ReadCommitted;
            options.Timeout = TransactionManager.DefaultTimeout;

            using (TransactionScope scope = new TransactionScope(TransactionScopeOption.Required, options))
            {

                ret =  dal.Add(model);
                USR_MessageMod m_notice = new USR_MessageMod();
                m_notice.CustomerSysNo = ret;
                m_notice.Context = AppConst.NewUserWelcome.Replace("@nickname", model.NickName)
                    .Replace("@userinfourl", AppConfig.HomeUrl() + "Qin/UserInfo.aspx?id="+model.SysNo)
                    .Replace("@pointhelpurl", AppConfig.HomeUrl() + "About/HelpCenter.aspx?memo=POINTANDCREDIT");
                m_notice.DR = 0;
                m_notice.IsRead = 0;
                m_notice.Title = "欢迎加入上上签";
                m_notice.TS = DateTime.Now;
                m_notice.Type = (int)AppEnum.MessageType.notice;
                USR_MessageBll.GetInstance().AddMessage(m_notice);
                scope.Complete();
            }
            return ret;
        }
Exemple #4
0
        /// <summary>
        /// 编辑信息
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void Button3_Click(object sender, EventArgs e)
        {
            #region 检查输入
            if (RadioButtonList1.SelectedIndex == -1)
            {
                Page.ClientScript.RegisterStartupScript(this.GetType(), "nogender", "alert('请选择性别');", true);
                return;
            }
            #endregion
            try
            {
                m_user             = USR_CustomerBll.GetInstance().GetModel(int.Parse(Request.QueryString["id"]));
                m_user.FateType    = int.Parse(drpFateType.SelectedValue);
                m_user.Gender      = int.Parse(RadioButtonList1.SelectedValue);
                m_user.Birth       = DatePicker2.SelectedTime;
                m_user.IsShowBirth = int.Parse(drpBirthType.SelectedValue);
                m_user.HomeTown    = District2.Area3SysNo;
                m_user.Intro       = txtIntro.Text;

                USR_CustomerBll.GetInstance().Update(m_user);

                SessionInfo m_session = new SessionInfo();
                m_session.CustomerEntity           = m_user;
                m_session.GradeEntity              = USR_GradeBll.GetInstance().GetModel(m_user.SysNo);
                Session[AppConfig.CustomerSession] = m_session;

                Page.ClientScript.RegisterStartupScript(this.GetType(), "infook", "alert('用户信息更新成功');", true);
            }
            catch (Exception ex)
            {
                LogManagement.getInstance().WriteException(ex, "WebForMain.UserInfo.Edit", Request.UserHostAddress);
                Page.ClientScript.RegisterStartupScript(this.GetType(), "noinfo", "alert('系统故障,请联系管理员');", true);
            }
        }
Exemple #5
0
 public void SetSession(USR_CustomerMod m_user)
 {
     SessionInfo m_session = new SessionInfo();
     m_session.CustomerEntity = m_user;
     m_session.GradeEntity = USR_GradeBll.GetInstance().GetModel(m_user.GradeSysNo);
     Session[AppConfig.CustomerSession] = m_session;
 }
        public ReturnValue <bool> CheckUser(string username)
        {
            if (string.IsNullOrEmpty(username))
            {
                throw new BusinessException("用户名或手机号不能为空");
            }

            USR_CustomerMod m_user = USR_CustomerBll.GetInstance().CheckUser(username);

            if (m_user.SysNo != -999999)
            {
                return(ReturnValue <bool> .Get200OK(true));
            }
            else
            {
                m_user = USR_CustomerBll.GetInstance().CheckPhone(username);
                if (m_user.SysNo != -999999)
                {
                    return(ReturnValue <bool> .Get200OK(true));
                }
                else
                {
                    return(ReturnValue <bool> .Get200OK(false));
                }
            }
        }
Exemple #7
0
        protected void Button7_Click(object sender, EventArgs e)
        {
            string OPath = @"~\WebResources\UpUserFiles\Photos\O";

            try
            {
                int imageWidth  = Int32.Parse(txt_width.Text);
                int imageHeight = Int32.Parse(txt_height.Text);
                int cutTop      = Int32.Parse(txt_top.Text);
                int cutLeft     = Int32.Parse(txt_left.Text);
                int dropWidth   = Int32.Parse(txt_DropWidth.Text);
                int dropHeight  = Int32.Parse(txt_DropHeight.Text);

                string filename = ImageHelper.SaveCutPic(Server.MapPath(@"~\WebResources\UpUserFiles\Photos\Tmp\o" + hdfPicID.Value), Server.MapPath(OPath), 0, 0, dropWidth,
                                                         dropHeight, cutLeft, cutTop, imageWidth, imageHeight);
                ImageHelper.SaveThumbnail(Server.MapPath(OPath + @"\" + filename), Server.MapPath(@"~\WebResources\UpUserFiles\Photos\T"), filename, 70, 70, true);
                m_user       = USR_CustomerBll.GetInstance().GetModel(int.Parse(Request.QueryString["id"]));
                m_user.Photo = filename.Replace(".jpg", "");
                USR_CustomerBll.GetInstance().Update(m_user);
                MultiView1.ActiveViewIndex = 0;
                //DataBind();
                Page.ClientScript.RegisterStartupScript(this.GetType(), "photook", "alert('头像更新成功');", true);
            }
            catch (Exception ex)
            {
                LogManagement.getInstance().WriteException(ex, "WebForMain.Userphoto.Upload", Request.UserHostAddress);
                Page.ClientScript.RegisterStartupScript(this.GetType(), "photook", "alert('系统故障,请联系管理员');", true);
            }
        }
Exemple #8
0
        /// <summary>
        /// 增加一条数据
        /// </summary>

        public int Add(USR_CustomerMod model)
        {
            int ret = 0;
            TransactionOptions options = new TransactionOptions();

            options.IsolationLevel = System.Transactions.IsolationLevel.ReadCommitted;
            options.Timeout        = TransactionManager.DefaultTimeout;

            using (TransactionScope scope = new TransactionScope(TransactionScopeOption.Required, options))
            {
                ret = dal.Add(model);
                USR_MessageMod m_notice = new USR_MessageMod();
                m_notice.CustomerSysNo = ret;
                m_notice.Context       = AppConst.NewUserWelcome.Replace("@nickname", model.NickName)
                                         .Replace("@userinfourl", AppConfig.HomeUrl() + "Qin/UserInfo.aspx?id=" + model.SysNo)
                                         .Replace("@pointhelpurl", AppConfig.HomeUrl() + "About/HelpCenter.aspx?memo=POINTANDCREDIT");
                m_notice.DR     = 0;
                m_notice.IsRead = 0;
                m_notice.Title  = "欢迎加入上上签";
                m_notice.TS     = DateTime.Now;
                m_notice.Type   = (int)AppEnum.MessageType.notice;
                USR_MessageBll.GetInstance().AddMessage(m_notice);
                scope.Complete();
            }
            return(ret);
        }
Exemple #9
0
        public void SetSession(USR_CustomerMod m_user)
        {
            SessionInfo m_session = new SessionInfo();

            m_session.CustomerEntity           = m_user;
            m_session.GradeEntity              = USR_GradeBll.GetInstance().GetModel(m_user.GradeSysNo);
            Session[AppConfig.CustomerSession] = m_session;
        }
Exemple #10
0
 public SessionInfo()
 {
     //
     //TODO: 在此处添加构造函数逻辑
     //
     GradeEntity    = new USR_GradeMod();
     CustomerEntity = new USR_CustomerMod();
 }
Exemple #11
0
 public SessionInfo()
 {
     //
     //TODO: 在此处添加构造函数逻辑
     //
     GradeEntity = new USR_GradeMod();
     CustomerEntity = new USR_CustomerMod();
 }
Exemple #12
0
        /// <summary>
        /// 修改密码
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void Button5_Click(object sender, EventArgs e)
        {
            if (txtOldPass.Text.Trim() == "")
            {
                Page.ClientScript.RegisterStartupScript(this.GetType(), "passwrong", "alert('请输入旧密码');", true);
                return;
            }
            if (txtNewPass.Text.Trim() == "" || txtPassAgain.Text.Trim() == "")
            {
                Page.ClientScript.RegisterStartupScript(this.GetType(), "passwrong", "alert('新的密码不能为空');", true);
                return;
            }
            if (txtNewPass.Text.Trim().Length < 6 || txtNewPass.Text.Trim().Length > 16)
            {
                Page.ClientScript.RegisterStartupScript(this.GetType(), "passwrong", "alert('密码长度必须在6-16字符内!');", true);
                return;
            }
            if (txtPassAgain.Text.Trim() != txtPassAgain.Text.Trim())
            {
                Page.ClientScript.RegisterStartupScript(this.GetType(), "passwrong", "alert('密码输入不一致!');", true);
                return;
            }

            if (txtOldPass.Text.Trim() != GetSession().CustomerEntity.Password)
            {
                Page.ClientScript.RegisterStartupScript(this.GetType(), "passwrong", "alert('您输入的旧密码与原密码不一致,请重新输入!');", true);
                return;
            }
            if (CommonTools.CheckPasswordLevel(txtNewPass.Text.Trim()) == 0)
            {
                Page.ClientScript.RegisterStartupScript(this.GetType(), "passwrong", "alert('您的密码实在太过简单,请重新输入!');", true);
                return;
            }
            else
            {
                try
                {
                    //更新数据库中的用户密码
                    m_user          = USR_CustomerBll.GetInstance().GetModel(int.Parse(Request.QueryString["id"]));
                    m_user.Password = txtNewPass.Text.Trim();
                    USR_CustomerBll.GetInstance().Update(m_user);

                    //更新session中的密码
                    SessionInfo m_session = new SessionInfo();
                    m_session.CustomerEntity           = m_user;
                    m_session.GradeEntity              = USR_GradeBll.GetInstance().GetModel(m_user.SysNo);
                    Session[AppConfig.CustomerSession] = m_session;

                    Page.ClientScript.RegisterStartupScript(this.GetType(), "passok", "alert('修改成功');", true);
                }
                catch (Exception ex)
                {
                    LogManagement.getInstance().WriteException(ex, "WebForMain.UserPass.Edit", Request.UserHostAddress);
                    Page.ClientScript.RegisterStartupScript(this.GetType(), "nopass", "alert('系统故障,请联系管理员');", true);
                }
            }
        }
Exemple #13
0
 private bool ValidateEmail()
 {
     m_user = USR_CustomerBll.GetInstance().CheckUser(email.Text.Trim());
     if (m_user.SysNo != AppConst.IntNull)
     {
         Page.ClientScript.RegisterStartupScript(this.GetType(), "emailwrong", "document.getElementById('ctl00_ContentPlaceHolder1_emailTip').innerHTML = '该邮箱已注册,请重新输入!';", true);
         return(false);
     }
     return(true);
 }
Exemple #14
0
        protected void Button5_Click(object sender, EventArgs e)
        {
            USR_CustomerMod m_user = USR_CustomerBll.GetInstance().CheckNickName(txtName.Text.Trim());

            if (m_user.SysNo == AppConst.IntNull)
            {
                Page.ClientScript.RegisterStartupScript(this.GetType(), "SendMsg", "alert('找不到该用户,请重新输入!');", true);
                ModalPopupExtender1.Show();
            }
            else
            {
                Response.Redirect("MsgDetail.aspx?UserSysNo=" + m_user.SysNo);
            }
        }
Exemple #15
0
 protected void Delete()
 {
     try
     {
         USR_CustomerMod m_customer = USR_CustomerBll.GetInstance().GetModel(int.Parse(base.Request.QueryString["delete"]));
         m_customer.Status = 3;
         USR_CustomerBll.GetInstance().Update(m_customer);
         this.ltrNotice.Text = "该记录已冻结!";
         base.ClientScript.RegisterStartupScript(base.GetType(), "", "document.getElementById('noticediv').style.display='';", true);
     }
     catch
     {
         this.ltrError.Text = "系统错误,冻结失败!";
         base.ClientScript.RegisterStartupScript(base.GetType(), "", "document.getElementById('errordiv').style.display='';", true);
     }
 }
 protected void Button7_Click(object sender, EventArgs e)
 {
     #region 判定登录信息
     USR_CustomerMod m_user = USR_CustomerBll.GetInstance().CheckUser(TextBox1.Text.Trim(), TextBox2.Text.Trim());
     if (m_user.SysNo != AppConst.IntNull)
     {
         PageBase m_base = new PageBase();
         m_base.SetSession(m_user);
         Response.Redirect(Request.Url.ToString());
     }
     else
     {
         Literal1.Text = "账号或密码错误,请重新输入!";
         ModalPopupExtender2.Show();
     }
     #endregion
 }
        private bool ValidateNickName()
        {
            if (CommonTools.HasForbiddenWords(name.Text.Trim()))
            {
                Page.ClientScript.RegisterStartupScript(this.GetType(), "namewrong", "document.getElementById('ctl00_ContentPlaceHolder1_nameTip').innerHTML = '您的昵称中有违禁字符,请重新输入!';document.getElementById('ctl00_ContentPlaceHolder1_nameTip').style['display']='block';document.getElementById('ctl00_ContentPlaceHolder1_nameTip').className='onError';", true);
                return(false);
            }
            USR_CustomerMod m_user = USR_CustomerBll.GetInstance().CheckNickName(name.Text.Trim());

            if (m_user.SysNo != AppConst.IntNull)
            {
                Page.ClientScript.RegisterStartupScript(this.GetType(), "namewrong", "document.getElementById('ctl00_ContentPlaceHolder1_nameTip').innerHTML = '该昵称已被占用,请尝试使用其他昵称!';document.getElementById('ctl00_ContentPlaceHolder1_nameTip').style['display']='block';document.getElementById('ctl00_ContentPlaceHolder1_nameTip').className='onError';", true);
                return(false);
            }

            return(true);
        }
        public ReturnValue <bool> CheckNickName(string nickname)
        {
            if (string.IsNullOrEmpty(nickname))
            {
                throw new BusinessException("昵称不能为空");
            }

            USR_CustomerMod m_user = USR_CustomerBll.GetInstance().CheckNickName(nickname);

            if (m_user.SysNo != -999999)
            {
                return(ReturnValue <bool> .Get200OK(true));
            }
            else
            {
                return(ReturnValue <bool> .Get200OK(false));
            }
        }
Exemple #19
0
        protected void Unnamed2_Click(object sender, EventArgs e)
        {
            string username = txtEmail.Text.Trim();
            string password = txtPass.Text.Trim();

            #region 验证邮箱有效性
            #endregion

            USR_CustomerMod m_user = USR_CustomerBll.GetInstance().CheckUser(username, password);
            if (m_user.SysNo != AppConst.IntNull)//COOKIES验证成功
            {
                SessionInfo m_session = new SessionInfo();
                m_session.CustomerEntity           = m_user;
                m_session.GradeEntity              = USR_GradeBll.GetInstance().GetModel(m_user.SysNo);
                Session[AppConfig.CustomerSession] = m_session;
                //记住我
                if (chkRemember.Checked)
                {
                    HttpCookie Cookie = CookiesHelper.GetCookie("upup1000");
                    if (Cookie == null || Cookie.Value == null || Cookie.Value == "")
                    {
                        Cookie = new HttpCookie("upup1000");
                        Cookie.Values.Add("uname", CommonTools.Encode(username));
                        Cookie.Values.Add("psd", CommonTools.Encode(password));
                        //设置Cookie过期时间
                        Cookie.Expires = DateTime.Now.AddYears(50);
                        CookiesHelper.AddCookie(Cookie);
                    }
                    else
                    {
                        CookiesHelper.SetCookie("upup1000", "uname", CommonTools.Encode(username), DateTime.Now.AddYears(50));
                        CookiesHelper.SetCookie("upup1000", "psd", CommonTools.Encode(password), DateTime.Now.AddYears(50));
                    }
                }
                LogManagement.getInstance().WriteTrace("前台会员登录", "Login", "IP:" + Request.UserHostAddress + "|AdminID:" + m_session.CustomerEntity.Email);
                //跳转
                Response.Redirect("Qin/View/" + m_user.SysNo);
            }
            else
            {
                Response.Redirect("Passport/Login.aspx?email=" + txtEmail.Text.Trim() + "&error=" + (int)AppEnum.ErrorType.WrongAccount);
            }
        }
Exemple #20
0
        public void LoginCheck(string username, string password)
        {
            USR_CustomerMod m_user = USR_CustomerBll.GetInstance().CheckUser(username, password);

            if (m_user.SysNo != AppConst.IntNull)//COOKIES验证成功
            {
                SetSession(m_user);
                //记住我
                if (CheckBox1.Checked)
                {
                    HttpCookie Cookie = CookiesHelper.GetCookie("upup1000");
                    if (Cookie == null || Cookie.Value == null || Cookie.Value == "")
                    {
                        Cookie = new HttpCookie("upup1000");
                        Cookie.Values.Add("uname", CommonTools.Encode(username));
                        Cookie.Values.Add("psd", CommonTools.Encode(password));
                        //设置Cookie过期时间
                        Cookie.Expires = DateTime.Now.AddYears(50);
                        CookiesHelper.AddCookie(Cookie);
                    }
                    else
                    {
                        CookiesHelper.SetCookie("upup1000", "uname", CommonTools.Encode(username), DateTime.Now.AddYears(50));
                        CookiesHelper.SetCookie("upup1000", "psd", CommonTools.Encode(password), DateTime.Now.AddYears(50));
                    }
                }
                LogManagement.getInstance().WriteTrace("前台会员登录", "Login", "IP:" + Request.UserHostAddress + "|UserID:" + GetSession().CustomerEntity.Email);
                //跳转
                if (Request.QueryString["url"] != null && Request.QueryString["url"] != "")
                {
                    Response.Redirect(Request.QueryString["url"]);
                }
                else
                {
                    Response.Redirect("../Qin/View/" + m_user.SysNo);
                }
            }
            else
            {
                password1Tip.InnerHtml = AppEnum.GetErrorType(2);
            }
        }
        public ReturnValue <bool> CheckPhone(string phone)
        {
            if (string.IsNullOrEmpty(phone))
            {
                throw new BusinessException("手机号不能为空");
            }

            USR_CustomerMod m_user = USR_CustomerBll.GetInstance().CheckPhone(phone);

            if (m_user.SysNo != -999999)
            {
                throw new BusinessException("该手机号已注册");
            }
            else
            {
                //生成6位随机验证码
                string[] arr       = ("1,2,3,4,5,6,7,8,9,0").Split(',');
                string   Password  = "";
                int      randValue = -1;
                Random   rand      = new Random(unchecked ((int)DateTime.Now.Ticks));
                for (int i = 0; i < 6; i++)
                {
                    randValue = rand.Next(0, arr.Length - 1);
                    Password += arr[randValue];
                }
                #region 发送短信

                //Password = "******";    //测试验证码为111111
                SYS_SMSMod m_sms = new SYS_SMSMod();
                m_sms.Content  = AppConst.RegisterPhoneCode.Replace("@code", Password);
                m_sms.PhoneNum = phone;
                m_sms.Status   = (int)AppEnum.SMSStatus.sending;
                m_sms.TS       = DateTime.Now;
                m_sms.Type     = (int)AppEnum.SMSType.Register;
                m_sms.SysNo    = SYS_SMSBll.GetInstance().Add(m_sms);
                SYS_SMSBll.GetInstance().SendSMS(m_sms);
                XMS.Core.Container.CacheService.LocalCache.SetItem(AppConst.APIRegionName, "SMSVerifyCode" + phone, Password, 1000);
                return(ReturnValue <bool> .Get200OK(true));

                #endregion
            }
        }
Exemple #22
0
        protected void Button2_Click(object sender, EventArgs e)
        {
            USR_CustomerMod m_user = USR_CustomerBll.GetInstance().CheckUser(this.TextBox3.Text.Trim(), this.TextBox4.Text.Trim());

            if (m_user.SysNo != -999999)
            {
                base.SetSession(m_user);
            }
            else
            {
                ScriptManager.RegisterStartupScript(this.UpdatePanel1, this.UpdatePanel1.GetType(), "addcomment", "alert('账号或密码错误,请重新输入!');", true);
                return;
            }
            this.TextBox1.Text = this.TextBox2.Text;
            this.Button1_Click(sender, e);
            this.BindFamous();
            this.BindChart();
            this.TextBox2.Text = "";
            ScriptManager.RegisterStartupScript(this.UpdatePanel1, this.UpdatePanel1.GetType(), "refresh", "location.reload();", true);
        }
        public ReturnValue <USR_CustomerShow> GetUserInfo(int uid)
        {
            USR_CustomerMod m_user = USR_CustomerBll.GetInstance().GetModel(uid);

            if (m_user.SysNo != -999999)
            {
                USR_CustomerShow ret = new USR_CustomerShow();
                m_user.MemberwiseCopy(ret);
                DataTable m_dt = REL_Customer_MedalBll.GetInstance().GetMedalByCustomer(uid, 0);
                ret.TotalMedal = m_dt.Rows.Count;
                int       total = 0;
                DataTable m_dt1 = USR_MessageBll.GetInstance().GetMessageByCustomer(uid, 1, 1, 0, 1, ref total);
                ret.NewMessage = total;
                return(ReturnValue <USR_CustomerShow> .Get200OK(ret));
            }
            else
            {
                throw new BusinessException("用户ID错误,请重新输入!");
            }
        }
Exemple #24
0
 protected void Page_Load(object sender, EventArgs e)
 {
     Login(Request.Url.ToString());
     if (Request.QueryString["tab"] != null)
     {
         try
         {
             tab = int.Parse(Request.QueryString["tab"]);
         }
         catch
         { }
     }
     if (Request.QueryString["id"] != null)
     {
         try
         {
             m_user = USR_CustomerBll.GetInstance().GetModel(int.Parse(Request.QueryString["id"]));
             if (m_user.SysNo == AppConst.IntNull)
             {
                 ShowError("");
             }
             if (m_user.SysNo != GetSession().CustomerEntity.SysNo)
             {
                 ShowError("");
             }
             if (!IsPostBack)
             {
                 FormPrepare();
             }
         }
         catch
         {
             ShowError("");
         }
     }
     else
     {
         ShowError("");
     }
     MultiView1.ActiveViewIndex = tab;
 }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                if (Request.QueryString["id"] != null)
                {
                    try
                    {
                        m_user = USR_CustomerBll.GetInstance().GetModel(int.Parse(Request.QueryString["id"]));
                    }
                    catch
                    {
                        Response.Redirect("../Error.aspx");
                    }
                }

                if (Request.QueryString["pn"] != null)
                {
                    try
                    {
                        pageindex = int.Parse(Request.QueryString["pn"]);
                    }
                    catch
                    { }
                }

                BindList();
                BindFriend();
                BindFans();

                if (BLG_AttentionBll.GetInstance().IsFans(GetSession().CustomerEntity.SysNo, m_user.SysNo))
                {
                    LinkButton1.Text = "取消关注";
                }
                else
                {
                    LinkButton1.Text = "添加关注";
                }
            }
        }
Exemple #26
0
 protected void SetTop(bool input)
 {
     try
     {
         int sysno = 0;
         if (input)
         {
             sysno = int.Parse(base.Request.QueryString["top"]);
         }
         else
         {
             sysno = int.Parse(base.Request.QueryString["notop"]);
         }
         USR_CustomerMod m_customer = USR_CustomerBll.GetInstance().GetModel(sysno);
         if (input)
         {
             m_customer.IsStar = 1;
         }
         else
         {
             m_customer.IsStar = 0;
         }
         USR_CustomerBll.GetInstance().Update(m_customer);
         if (input)
         {
             this.ltrNotice.Text = "已设置该用户为明星!";
             base.ClientScript.RegisterStartupScript(base.GetType(), "", "document.getElementById('noticediv').style.display='';", true);
         }
         else
         {
             this.ltrNotice.Text = "已取消该用户明星!";
             base.ClientScript.RegisterStartupScript(base.GetType(), "", "document.getElementById('noticediv').style.display='';", true);
         }
     }
     catch
     {
         this.ltrError.Text = "系统错误,设置明星失败!";
         base.ClientScript.RegisterStartupScript(base.GetType(), "", "document.getElementById('errordiv').style.display='';", true);
     }
 }
Exemple #27
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                if (Request.QueryString["id"] != null)
                {
                    try
                    {
                        m_user = USR_CustomerBll.GetInstance().GetModel(int.Parse(Request.QueryString["id"]));
                    }
                    catch
                    {
                        Response.Redirect("../Error.aspx");
                    }
                }

                if (Request.QueryString["pn"] != null)
                {
                    try
                    {
                        pageindex = int.Parse(Request.QueryString["pn"]);
                    }
                    catch
                    { }
                }

                BindList();
                BindFriend();
                BindFans();

                if (BLG_AttentionBll.GetInstance().IsFans(GetSession().CustomerEntity.SysNo, m_user.SysNo))
                {
                    LinkButton1.Text = "取消关注";
                }
                else
                {
                    LinkButton1.Text = "添加关注";
                }
            }
        }
Exemple #28
0
        public USR_CustomerMod GetUserByThirdID(string id)
        {
            USR_CustomerMod model = new USR_CustomerMod();

            using (SQLData data = new SQLData())
            {
                StringBuilder builder = new StringBuilder();
                builder.Append("select CustomerSysNo from USR_ThirdLogin where OpenID='").Append(SQLData.SQLFilter(id)).Append("'");
                try
                {
                    model.SysNo = int.Parse(data.CmdtoDataRow(builder.ToString())["CustomerSysNo"].ToString());
                }
                catch (Exception exception)
                {
                    //throw exception;
                }
            }
            if (model.SysNo != AppConst.IntNull)
            {
                model = this.GetModel(model.SysNo);
            }
            return(model);
        }
Exemple #29
0
        public USR_CustomerMod CheckNickName(string nickname)
        {
            USR_CustomerMod model = new USR_CustomerMod();

            using (SQLData data = new SQLData())
            {
                StringBuilder builder = new StringBuilder();
                builder.Append("select SysNo from USR_Customer where NickName='").Append(SQLData.SQLFilter(nickname)).Append("' and Status=").Append((int)AppEnum.State.normal);
                try
                {
                    model.SysNo = int.Parse(data.CmdtoDataRow(builder.ToString())["SysNo"].ToString());
                }
                catch (Exception exception)
                {
                    //throw exception;
                }
            }
            if (model.SysNo != AppConst.IntNull)
            {
                model = this.GetModel(model.SysNo);
            }
            return(model);
        }
        public ReturnValue <USR_CustomerMaintain> UserLogin(string username, string password)
        {
            if (string.IsNullOrEmpty(username))
            {
                throw new BusinessException("用户名不能为空");
            }

            if (string.IsNullOrEmpty(password))
            {
                throw new BusinessException("密码不能为空");
            }
            USR_CustomerMod m_user = USR_CustomerBll.GetInstance().CheckUser(username, password);

            if (m_user.SysNo != -999999)
            {
                USR_CustomerMaintain ret = new USR_CustomerMaintain();
                m_user.MemberwiseCopy(ret);
                return(ReturnValue <USR_CustomerMaintain> .Get200OK(ret));
            }
            else
            {
                throw new BusinessException("账号或密码错误,请重新输入!");
            }
        }
Exemple #31
0
        /// <summary>
        /// 修改密码
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void Button5_Click(object sender, EventArgs e)
        {
            if (txtOldPass.Text.Trim() == "")
            {
                Page.ClientScript.RegisterStartupScript(this.GetType(), "passwrong", "alert('请输入旧密码');", true);
                return;
            }
            if (txtNewPass.Text.Trim() == "" || txtPassAgain.Text.Trim() == "")
            {
                Page.ClientScript.RegisterStartupScript(this.GetType(), "passwrong", "alert('新的密码不能为空');", true);
                return;
            }
            if (txtNewPass.Text.Trim().Length < 6 || txtNewPass.Text.Trim().Length > 16)
            {
                Page.ClientScript.RegisterStartupScript(this.GetType(), "passwrong", "alert('密码长度必须在6-16字符内!');", true);
                return;
            }
            if (txtPassAgain.Text.Trim() != txtPassAgain.Text.Trim())
            {
                Page.ClientScript.RegisterStartupScript(this.GetType(), "passwrong", "alert('密码输入不一致!');", true);
                return;
            }

            if (txtOldPass.Text.Trim() != GetSession().CustomerEntity.Password)
            {
                Page.ClientScript.RegisterStartupScript(this.GetType(), "passwrong", "alert('您输入的旧密码与原密码不一致,请重新输入!');", true);
                return;
            }
            if (CommonTools.CheckPasswordLevel(txtNewPass.Text.Trim()) == 0)
            {
                Page.ClientScript.RegisterStartupScript(this.GetType(), "passwrong", "alert('您的密码实在太过简单,请重新输入!');", true);
                return;
            }
            else
            {
                try
                {
                    //更新数据库中的用户密码
                    m_user = USR_CustomerBll.GetInstance().GetModel(int.Parse(Request.QueryString["id"]));
                    m_user.Password = txtNewPass.Text.Trim();
                    USR_CustomerBll.GetInstance().Update(m_user);

                    //更新session中的密码
                    SessionInfo m_session = new SessionInfo();
                    m_session.CustomerEntity = m_user;
                    m_session.GradeEntity = USR_GradeBll.GetInstance().GetModel(m_user.SysNo);
                    Session[AppConfig.CustomerSession] = m_session;

                    Page.ClientScript.RegisterStartupScript(this.GetType(), "passok", "alert('修改成功');", true);
                }
                catch (Exception ex)
                {
                    LogManagement.getInstance().WriteException(ex, "WebForMain.UserPass.Edit", Request.UserHostAddress);
                    Page.ClientScript.RegisterStartupScript(this.GetType(), "nopass", "alert('系统故障,请联系管理员');", true);
                }
            }
        }
Exemple #32
0
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public int Update(USR_CustomerMod model)
 {
     StringBuilder strSql = new StringBuilder();
     strSql.Append("update USR_Customer set ");
     SqlCommand cmd = new SqlCommand();
     if (model.SysNo != AppConst.IntNull)
     {
         SqlParameter param = new SqlParameter("@SysNo", SqlDbType.Int, 4);
         param.Value = model.SysNo;
         cmd.Parameters.Add(param);
     }
     if (model.Email != AppConst.StringNull)
     {
         strSql.Append("Email=@Email,");
         SqlParameter param = new SqlParameter("@Email", SqlDbType.VarChar, 100);
         param.Value = model.Email;
         cmd.Parameters.Add(param);
     }
     if (model.Password != AppConst.StringNull)
     {
         strSql.Append("Password=@Password,");
         SqlParameter param = new SqlParameter("@Password", SqlDbType.VarChar, 20);
         param.Value = model.Password;
         cmd.Parameters.Add(param);
     }
     if (model.GradeSysNo != AppConst.IntNull)
     {
         strSql.Append("GradeSysNo=@GradeSysNo,");
         SqlParameter param = new SqlParameter("@GradeSysNo", SqlDbType.Int, 4);
         param.Value = model.GradeSysNo;
         cmd.Parameters.Add(param);
     }
     if (model.NickName != AppConst.StringNull)
     {
         strSql.Append("NickName=@NickName,");
         SqlParameter param = new SqlParameter("@NickName", SqlDbType.NVarChar, 40);
         param.Value = model.NickName;
         cmd.Parameters.Add(param);
     }
     if (model.Gender != AppConst.IntNull)
     {
         strSql.Append("Gender=@Gender,");
         SqlParameter param = new SqlParameter("@Gender", SqlDbType.Int, 4);
         param.Value = model.Gender;
         cmd.Parameters.Add(param);
     }
     if (model.Photo != AppConst.StringNull)
     {
         strSql.Append("Photo=@Photo,");
         SqlParameter param = new SqlParameter("@Photo", SqlDbType.VarChar, 500);
         param.Value = model.Photo;
         cmd.Parameters.Add(param);
     }
     if (model.Credit != AppConst.IntNull)
     {
         strSql.Append("Credit=@Credit,");
         SqlParameter param = new SqlParameter("@Credit", SqlDbType.Int, 4);
         param.Value = model.Credit;
         cmd.Parameters.Add(param);
     }
     if (model.Point != AppConst.IntNull)
     {
         strSql.Append("Point=@Point,");
         SqlParameter param = new SqlParameter("@Point", SqlDbType.Int, 4);
         param.Value = model.Point;
         cmd.Parameters.Add(param);
     }
     if (model.Birth != AppConst.DateTimeNull)
     {
         strSql.Append("Birth=@Birth,");
         SqlParameter param = new SqlParameter("@Birth", SqlDbType.DateTime);
         param.Value = model.Birth;
         cmd.Parameters.Add(param);
     }
     if (model.FateType != AppConst.IntNull)
     {
         strSql.Append("FateType=@FateType,");
         SqlParameter param = new SqlParameter("@FateType", SqlDbType.TinyInt, 1);
         param.Value = model.FateType;
         cmd.Parameters.Add(param);
     }
     if (model.RegTime != AppConst.DateTimeNull)
     {
         strSql.Append("RegTime=@RegTime,");
         SqlParameter param = new SqlParameter("@RegTime", SqlDbType.DateTime);
         param.Value = model.RegTime;
         cmd.Parameters.Add(param);
     }
     if (model.LastLoginTime != AppConst.DateTimeNull)
     {
         strSql.Append("LastLoginTime=@LastLoginTime,");
         SqlParameter param = new SqlParameter("@LastLoginTime", SqlDbType.DateTime);
         param.Value = model.LastLoginTime;
         cmd.Parameters.Add(param);
     }
     if (model.Status != AppConst.IntNull)
     {
         strSql.Append("Status=@Status,");
         SqlParameter param = new SqlParameter("@Status", SqlDbType.TinyInt, 1);
         param.Value = model.Status;
         cmd.Parameters.Add(param);
     }
     if (model.IsStar != AppConst.IntNull)
     {
         strSql.Append("IsStar=@IsStar,");
         SqlParameter param = new SqlParameter("@IsStar", SqlDbType.TinyInt, 1);
         param.Value = model.IsStar;
         cmd.Parameters.Add(param);
     }
     if (model.Signature != AppConst.StringNull)
     {
         strSql.Append("Signature=@Signature,");
         SqlParameter param = new SqlParameter("@Signature", SqlDbType.NVarChar, 600);
         param.Value = model.Signature;
         cmd.Parameters.Add(param);
     }
     if (model.Exp != AppConst.IntNull)
     {
         strSql.Append("Exp=@Exp,");
         SqlParameter param = new SqlParameter("@Exp", SqlDbType.Int, 4);
         param.Value = model.Exp;
         cmd.Parameters.Add(param);
     }
     if (model.TotalAnswer != AppConst.IntNull)
     {
         strSql.Append("TotalAnswer=@TotalAnswer,");
         SqlParameter param = new SqlParameter("@TotalAnswer", SqlDbType.Int, 4);
         param.Value = model.TotalAnswer;
         cmd.Parameters.Add(param);
     }
     if (model.TotalQuest != AppConst.IntNull)
     {
         strSql.Append("TotalQuest=@TotalQuest,");
         SqlParameter param = new SqlParameter("@TotalQuest", SqlDbType.Int, 4);
         param.Value = model.TotalQuest;
         cmd.Parameters.Add(param);
     }
     if (model.BestAnswer != AppConst.IntNull)
     {
         strSql.Append("BestAnswer=@BestAnswer,");
         SqlParameter param = new SqlParameter("@BestAnswer", SqlDbType.Int, 4);
         param.Value = model.BestAnswer;
         cmd.Parameters.Add(param);
     }
     if (model.HomeTown != AppConst.IntNull)
     {
         strSql.Append("HomeTown=@HomeTown,");
         SqlParameter param = new SqlParameter("@HomeTown", SqlDbType.Int, 4);
         param.Value = model.HomeTown;
         cmd.Parameters.Add(param);
     }
     if (model.Intro != AppConst.StringNull)
     {
         strSql.Append("Intro=@Intro,");
         SqlParameter param = new SqlParameter("@Intro", SqlDbType.NVarChar, 1000);
         param.Value = model.Intro;
         cmd.Parameters.Add(param);
     }
     if (model.Icons != AppConst.StringNull)
     {
         strSql.Append("Icons=@Icons,");
         SqlParameter param = new SqlParameter("@Icons", SqlDbType.VarChar, 500);
         param.Value = model.Icons;
         cmd.Parameters.Add(param);
     }
     if (model.IsShowBirth != AppConst.IntNull)
     {
         strSql.Append("IsShowBirth=@IsShowBirth,");
         SqlParameter param = new SqlParameter("@IsShowBirth", SqlDbType.TinyInt, 1);
         param.Value = model.IsShowBirth;
         cmd.Parameters.Add(param);
     }
     if (model.TotalReply != AppConst.IntNull)
     {
         strSql.Append("TotalReply=@TotalReply,");
         SqlParameter param = new SqlParameter("@TotalReply", SqlDbType.Int, 4);
         param.Value = model.TotalReply;
         cmd.Parameters.Add(param);
     }
     if (model.HasNewInfo != AppConst.IntNull)
     {
         strSql.Append("HasNewInfo=@HasNewInfo,");
         SqlParameter param = new SqlParameter("@HasNewInfo", SqlDbType.Int, 4);
         param.Value = model.HasNewInfo;
         cmd.Parameters.Add(param);
     }
     if (model.TotalTalk != AppConst.IntNull)
     {
         strSql.Append("TotalTalk=@TotalTalk,");
         SqlParameter param = new SqlParameter("@TotalTalk", SqlDbType.Int, 4);
         param.Value = model.TotalTalk;
         cmd.Parameters.Add(param);
     }
     if (model.TotalTalkReply != AppConst.IntNull)
     {
         strSql.Append("TotalTalkReply=@TotalTalkReply,");
         SqlParameter param = new SqlParameter("@TotalTalkReply", SqlDbType.Int, 4);
         param.Value = model.TotalTalkReply;
         cmd.Parameters.Add(param);
     }
     if (model.Phone != AppConst.StringNull)
     {
         strSql.Append("Phone=@Phone,");
         SqlParameter param = new SqlParameter("@Phone", SqlDbType.VarChar, 50);
         param.Value = model.Phone;
         cmd.Parameters.Add(param);
     }
     if (model.SetOrderCount != AppConst.IntNull)
     {
         strSql.Append("SetOrderCount=@SetOrderCount,");
         SqlParameter param = new SqlParameter("@SetOrderCount", SqlDbType.Int, 4);
         param.Value = model.SetOrderCount;
         cmd.Parameters.Add(param);
     }
     if (model.BuyOrderCount != AppConst.IntNull)
     {
         strSql.Append("BuyOrderCount=@BuyOrderCount,");
         SqlParameter param = new SqlParameter("@BuyOrderCount", SqlDbType.Int, 4);
         param.Value = model.BuyOrderCount;
         cmd.Parameters.Add(param);
     }
     if (model.SellOrderCount != AppConst.IntNull)
     {
         strSql.Append("SellOrderCount=@SellOrderCount,");
         SqlParameter param = new SqlParameter("@SellOrderCount", SqlDbType.Int, 4);
         param.Value = model.SellOrderCount;
         cmd.Parameters.Add(param);
     }
     if (model.TotalSellRMB != AppConst.DecimalNull)
     {
         strSql.Append("TotalSellRMB=@TotalSellRMB,");
         SqlParameter param = new SqlParameter("@TotalSellRMB", SqlDbType.Decimal, 20);
         param.Value = model.TotalSellRMB;
         cmd.Parameters.Add(param);
     }
     if (model.TotalBuyRMB != AppConst.DecimalNull)
     {
         strSql.Append("TotalBuyRMB=@TotalBuyRMB,");
         SqlParameter param = new SqlParameter("@TotalBuyRMB", SqlDbType.Decimal, 20);
         param.Value = model.TotalBuyRMB;
         cmd.Parameters.Add(param);
     }
     if (model.TotalBuyPoint != AppConst.IntNull)
     {
         strSql.Append("TotalBuyPoint=@TotalBuyPoint,");
         SqlParameter param = new SqlParameter("@TotalBuyPoint", SqlDbType.Int, 4);
         param.Value = model.TotalBuyPoint;
         cmd.Parameters.Add(param);
     }
     strSql.Remove(strSql.Length - 1, 1);
     strSql.Append(" where SysNo=@SysNo ");
     cmd.CommandText = strSql.ToString();
     return SqlHelper.ExecuteNonQuery(cmd, null);
 }
Exemple #33
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public int Add(USR_CustomerMod model)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("insert into USR_Customer(");
            strSql.Append("Email,Password,GradeSysNo,NickName,Gender,Photo,Credit,Point,Birth,FateType,RegTime,LastLoginTime,Status,IsStar,Signature,Exp,TotalAnswer,TotalQuest,BestAnswer,HomeTown,Intro,Icons,IsShowBirth,TotalReply,HasNewInfo,TotalTalk,TotalTalkReply,Phone,SetOrderCount,BuyOrderCount,SellOrderCount,TotalSellRMB,TotalBuyRMB,TotalBuyPoint)");
            strSql.Append(" values (");
            strSql.Append("@Email,@Password,@GradeSysNo,@NickName,@Gender,@Photo,@Credit,@Point,@Birth,@FateType,@RegTime,@LastLoginTime,@Status,@IsStar,@Signature,@Exp,@TotalAnswer,@TotalQuest,@BestAnswer,@HomeTown,@Intro,@Icons,@IsShowBirth,@TotalReply,@HasNewInfo,@TotalTalk,@TotalTalkReply,@Phone,@SetOrderCount,@BuyOrderCount,@SellOrderCount,@TotalSellRMB,@TotalBuyRMB,@TotalBuyPoint)");
            strSql.Append(";select @@IDENTITY");
            SqlCommand cmd = new SqlCommand(strSql.ToString());
            SqlParameter[] parameters = {
                 new SqlParameter("@Email",SqlDbType.VarChar,100),
                 new SqlParameter("@Password",SqlDbType.VarChar,20),
                 new SqlParameter("@GradeSysNo",SqlDbType.Int,4),
                 new SqlParameter("@NickName",SqlDbType.NVarChar,40),
                 new SqlParameter("@Gender",SqlDbType.Int,4),
                 new SqlParameter("@Photo",SqlDbType.VarChar,500),
                 new SqlParameter("@Credit",SqlDbType.Int,4),
                 new SqlParameter("@Point",SqlDbType.Int,4),
                 new SqlParameter("@Birth",SqlDbType.DateTime),
                 new SqlParameter("@FateType",SqlDbType.TinyInt,1),
                 new SqlParameter("@RegTime",SqlDbType.DateTime),
                 new SqlParameter("@LastLoginTime",SqlDbType.DateTime),
                 new SqlParameter("@Status",SqlDbType.TinyInt,1),
                 new SqlParameter("@IsStar",SqlDbType.TinyInt,1),
                 new SqlParameter("@Signature",SqlDbType.NVarChar,600),
                 new SqlParameter("@Exp",SqlDbType.Int,4),
                 new SqlParameter("@TotalAnswer",SqlDbType.Int,4),
                 new SqlParameter("@TotalQuest",SqlDbType.Int,4),
                 new SqlParameter("@BestAnswer",SqlDbType.Int,4),
                 new SqlParameter("@HomeTown",SqlDbType.Int,4),
                 new SqlParameter("@Intro",SqlDbType.NVarChar,1000),
                 new SqlParameter("@Icons",SqlDbType.VarChar,500),
                 new SqlParameter("@IsShowBirth",SqlDbType.TinyInt,1),
                 new SqlParameter("@TotalReply",SqlDbType.Int,4),
                 new SqlParameter("@HasNewInfo",SqlDbType.Int,4),
                 new SqlParameter("@TotalTalk",SqlDbType.Int,4),
                 new SqlParameter("@TotalTalkReply",SqlDbType.Int,4),
                 new SqlParameter("@Phone",SqlDbType.VarChar,50),
                 new SqlParameter("@SetOrderCount",SqlDbType.Int,4),
                 new SqlParameter("@BuyOrderCount",SqlDbType.Int,4),
                 new SqlParameter("@SellOrderCount",SqlDbType.Int,4),
                 new SqlParameter("@TotalSellRMB",SqlDbType.Decimal,20),
                 new SqlParameter("@TotalBuyRMB",SqlDbType.Decimal,20),
                 new SqlParameter("@TotalBuyPoint",SqlDbType.Int,4),
             };
            if (model.Email != AppConst.StringNull)
                parameters[0].Value = model.Email;
            else
                parameters[0].Value = System.DBNull.Value;
            cmd.Parameters.Add(parameters[0]);
            if (model.Password != AppConst.StringNull)
                parameters[1].Value = model.Password;
            else
                parameters[1].Value = System.DBNull.Value;
            cmd.Parameters.Add(parameters[1]);
            if (model.GradeSysNo != AppConst.IntNull)
                parameters[2].Value = model.GradeSysNo;
            else
                parameters[2].Value = System.DBNull.Value;
            cmd.Parameters.Add(parameters[2]);
            if (model.NickName != AppConst.StringNull)
                parameters[3].Value = model.NickName;
            else
                parameters[3].Value = System.DBNull.Value;
            cmd.Parameters.Add(parameters[3]);
            if (model.Gender != AppConst.IntNull)
                parameters[4].Value = model.Gender;
            else
                parameters[4].Value = System.DBNull.Value;
            cmd.Parameters.Add(parameters[4]);
            if (model.Photo != AppConst.StringNull)
                parameters[5].Value = model.Photo;
            else
                parameters[5].Value = System.DBNull.Value;
            cmd.Parameters.Add(parameters[5]);
            if (model.Credit != AppConst.IntNull)
                parameters[6].Value = model.Credit;
            else
                parameters[6].Value = System.DBNull.Value;
            cmd.Parameters.Add(parameters[6]);
            if (model.Point != AppConst.IntNull)
                parameters[7].Value = model.Point;
            else
                parameters[7].Value = System.DBNull.Value;
            cmd.Parameters.Add(parameters[7]);
            if (model.Birth != AppConst.DateTimeNull)
                parameters[8].Value = model.Birth;
            else
                parameters[8].Value = System.DBNull.Value;
            cmd.Parameters.Add(parameters[8]);
            if (model.FateType != AppConst.IntNull)
                parameters[9].Value = model.FateType;
            else
                parameters[9].Value = System.DBNull.Value;
            cmd.Parameters.Add(parameters[9]);
            if (model.RegTime != AppConst.DateTimeNull)
                parameters[10].Value = model.RegTime;
            else
                parameters[10].Value = System.DBNull.Value;
            cmd.Parameters.Add(parameters[10]);
            if (model.LastLoginTime != AppConst.DateTimeNull)
                parameters[11].Value = model.LastLoginTime;
            else
                parameters[11].Value = System.DBNull.Value;
            cmd.Parameters.Add(parameters[11]);
            if (model.Status != AppConst.IntNull)
                parameters[12].Value = model.Status;
            else
                parameters[12].Value = System.DBNull.Value;
            cmd.Parameters.Add(parameters[12]);
            if (model.IsStar != AppConst.IntNull)
                parameters[13].Value = model.IsStar;
            else
                parameters[13].Value = System.DBNull.Value;
            cmd.Parameters.Add(parameters[13]);
            if (model.Signature != AppConst.StringNull)
                parameters[14].Value = model.Signature;
            else
                parameters[14].Value = System.DBNull.Value;
            cmd.Parameters.Add(parameters[14]);
            if (model.Exp != AppConst.IntNull)
                parameters[15].Value = model.Exp;
            else
                parameters[15].Value = System.DBNull.Value;
            cmd.Parameters.Add(parameters[15]);
            if (model.TotalAnswer != AppConst.IntNull)
                parameters[16].Value = model.TotalAnswer;
            else
                parameters[16].Value = System.DBNull.Value;
            cmd.Parameters.Add(parameters[16]);
            if (model.TotalQuest != AppConst.IntNull)
                parameters[17].Value = model.TotalQuest;
            else
                parameters[17].Value = System.DBNull.Value;
            cmd.Parameters.Add(parameters[17]);
            if (model.BestAnswer != AppConst.IntNull)
                parameters[18].Value = model.BestAnswer;
            else
                parameters[18].Value = System.DBNull.Value;
            cmd.Parameters.Add(parameters[18]);
            if (model.HomeTown != AppConst.IntNull)
                parameters[19].Value = model.HomeTown;
            else
                parameters[19].Value = System.DBNull.Value;
            cmd.Parameters.Add(parameters[19]);
            if (model.Intro != AppConst.StringNull)
                parameters[20].Value = model.Intro;
            else
                parameters[20].Value = System.DBNull.Value;
            cmd.Parameters.Add(parameters[20]);
            if (model.Icons != AppConst.StringNull)
                parameters[21].Value = model.Icons;
            else
                parameters[21].Value = System.DBNull.Value;
            cmd.Parameters.Add(parameters[21]);
            if (model.IsShowBirth != AppConst.IntNull)
                parameters[22].Value = model.IsShowBirth;
            else
                parameters[22].Value = System.DBNull.Value;
            cmd.Parameters.Add(parameters[22]);
            if (model.TotalReply != AppConst.IntNull)
                parameters[23].Value = model.TotalReply;
            else
                parameters[23].Value = System.DBNull.Value;
            cmd.Parameters.Add(parameters[23]);
            if (model.HasNewInfo != AppConst.IntNull)
                parameters[24].Value = model.HasNewInfo;
            else
                parameters[24].Value = System.DBNull.Value;
            cmd.Parameters.Add(parameters[24]);
            if (model.TotalTalk != AppConst.IntNull)
                parameters[25].Value = model.TotalTalk;
            else
                parameters[25].Value = System.DBNull.Value;
            cmd.Parameters.Add(parameters[25]);
            if (model.TotalTalkReply != AppConst.IntNull)
                parameters[26].Value = model.TotalTalkReply;
            else
                parameters[26].Value = System.DBNull.Value;
            cmd.Parameters.Add(parameters[26]);
            if (model.Phone != AppConst.StringNull)
                parameters[27].Value = model.Phone;
            else
                parameters[27].Value = System.DBNull.Value;
            cmd.Parameters.Add(parameters[27]);
            if (model.SetOrderCount != AppConst.IntNull)
                parameters[28].Value = model.SetOrderCount;
            else
                parameters[28].Value = System.DBNull.Value;
            cmd.Parameters.Add(parameters[28]);
            if (model.BuyOrderCount != AppConst.IntNull)
                parameters[29].Value = model.BuyOrderCount;
            else
                parameters[29].Value = System.DBNull.Value;
            cmd.Parameters.Add(parameters[29]);
            if (model.SellOrderCount != AppConst.IntNull)
                parameters[30].Value = model.SellOrderCount;
            else
                parameters[30].Value = System.DBNull.Value;
            cmd.Parameters.Add(parameters[30]);
            if (model.TotalSellRMB != AppConst.DecimalNull)
                parameters[31].Value = model.TotalSellRMB;
            else
                parameters[31].Value = System.DBNull.Value;
            cmd.Parameters.Add(parameters[31]);
            if (model.TotalBuyRMB != AppConst.DecimalNull)
                parameters[32].Value = model.TotalBuyRMB;
            else
                parameters[32].Value = System.DBNull.Value;
            cmd.Parameters.Add(parameters[32]);
            if (model.TotalBuyPoint != AppConst.IntNull)
                parameters[33].Value = model.TotalBuyPoint;
            else
                parameters[33].Value = System.DBNull.Value;
            cmd.Parameters.Add(parameters[33]);

            return Convert.ToInt32(SqlHelper.ExecuteScalar(cmd, parameters));
        }
Exemple #34
0
 protected void Page_Load(object sender, EventArgs e)
 {
     Login(Request.Url.ToString());
     if (Request.QueryString["tab"] != null)
     {
         try
         {
             tab = int.Parse(Request.QueryString["tab"]);
         }
         catch
         { }
     }
     if (Request.QueryString["id"] != null)
     {
         try
         {
             m_user = USR_CustomerBll.GetInstance().GetModel(int.Parse(Request.QueryString["id"]));
             if (m_user.SysNo == AppConst.IntNull)
             {
                 ShowError("");
             }
             if (m_user.SysNo != GetSession().CustomerEntity.SysNo)
             {
                 ShowError("");
             }
             if (!IsPostBack)
             {
                 FormPrepare();
             }
         }
         catch
         {
             ShowError("");
         }
     }
     else
     {
         ShowError("");
     }
     MultiView1.ActiveViewIndex = tab;
 }
Exemple #35
0
        protected void BindData()
        {
            try
            {
                if (m_qustion.DR != (int)AppEnum.State.normal)
                {
                    ShowError("");
                }
                m_qustion.ReadCount++;
                QA_QuestionBll.GetInstance().Update(m_qustion);

                ltrTitle.Text   = m_qustion.Title;
                ltrContext.Text = m_qustion.Context;
                ltrAward.Text   = m_qustion.Award.ToString();
                ltrReply.Text   = m_qustion.ReplyCount.ToString();
                ltrViewNum.Text = m_qustion.ReadCount.ToString();
                USR_CustomerMod m_user  = USR_CustomerBll.GetInstance().GetModel(m_qustion.CustomerSysNo);
                USR_GradeMod    m_grade = USR_GradeBll.GetInstance().GetModel(m_user.GradeSysNo);
                ltrNickName.Text   = m_user.NickName;
                ltrQALevel.Text    = m_grade.Name;
                ltrTotalReply.Text = m_user.TotalReply.ToString();
                ltrTotalAsk.Text   = m_user.TotalQuest.ToString();
                Image1.ImageUrl    = AppConfig.HomeUrl() + "ControlLibrary/ShowPhoto.aspx?type=t&id=" + m_user.Photo;

                #region 显示命盘
                FATE_ChartMod m_chart = QA_QuestionBll.GetInstance().GetChartByQuest(SysNo);
                if (m_chart != null && m_chart.SysNo != AppConst.IntNull)
                {
                    if (GetSession().CustomerEntity == null || GetSession().CustomerEntity.SysNo == AppConst.IntNull)
                    {
                        Astro1.input   = m_chart;
                        Astro1.Visible = true;
                    }
                    else if (GetSession().CustomerEntity.FateType == (int)AppEnum.FateType.ziwei)
                    {
                        Ziwei1.input   = m_chart;
                        Ziwei1.Visible = true;
                    }
                    else if (GetSession().CustomerEntity.FateType == (int)AppEnum.FateType.bazi)
                    {
                        Bazi1.input   = m_chart;
                        Bazi1.Visible = true;
                    }
                    else
                    {
                        Astro1.input   = m_chart;
                        Astro1.Visible = true;
                    }
                }
                #endregion

                #region 绑定原报价单信息
                if (order != 0)
                {
                    TextBox2.Text           = old_order.Words.ToString();
                    TextBox2.ReadOnly       = true;
                    TextBox3.Text           = old_order.Price.ToString();
                    TextBox3.ReadOnly       = true;
                    txtDescription.Text     = old_order.Description;
                    txtDescription.ReadOnly = true;
                    txtTrial.Text           = old_order.Trial;
                    txtTrial.ReadOnly       = true;
                }
                else
                {
                    //发布报价单时隐藏结果输入框
                    resulttitle.Visible   = false;
                    resultcontent.Visible = false;
                }
                #endregion
            }
            catch
            {
                ShowError("");
            }
        }
Exemple #36
0
 private bool ValidateEmail()
 {
     m_user = USR_CustomerBll.GetInstance().CheckUser(email.Text.Trim());
     if (m_user.SysNo != AppConst.IntNull)
     {
         Page.ClientScript.RegisterStartupScript(this.GetType(), "emailwrong", "document.getElementById('ctl00_ContentPlaceHolder1_emailTip').innerHTML = '该邮箱已注册,请重新输入!';", true);
         return false;
     }
     return true;
 }
Exemple #37
0
        public QA_QuestionShowMini <BaZiMod> MapQA_QuestionShowMiniForBaZi(DataRow input)
        {
            QA_QuestionShowMini <BaZiMod> ret = new QA_QuestionShowMini <BaZiMod>();

            if (input["Award"].ToString() != "")
            {
                ret.Award = int.Parse(input["Award"].ToString());
            }
            if (input["CateSysNo"].ToString() != "")
            {
                ret.CateSysNo = int.Parse(input["CateSysNo"].ToString());
            }
            #region 设置命盘
            FATE_ChartMod m_chart = QA_QuestionBll.GetInstance().GetChartByQuest(int.Parse(input["SysNo"].ToString()));
            if (m_chart != null)
            {
                BaZiMod  m_bazi    = new BaZiMod();
                string[] tmplatlng = m_chart.FirstPoi.ToString().Split(new char[] { '|' });
                m_bazi.BirthTime = new DateEntity(PublicDeal.GetInstance().RealTime(DateTime.Parse(m_chart.FirstBirth.ToString()),
                                                                                    new LatLng(tmplatlng[1], tmplatlng[0], m_chart.FirstPoiName)));
                m_bazi.AreaName  = m_chart.FirstPoiName.ToString();
                m_bazi.Longitude = tmplatlng[0];
                m_bazi.Gender    = (AppEnum.Gender)m_chart.FirstGender;
                BaZiBiz.GetInstance().TimeToBaZi(ref m_bazi);
                ret.Chart.Add(m_bazi);
                if (m_chart.CharType.ToString() == ((int)AppEnum.ChartType.relation).ToString())
                {
                    BaZiMod m_bazi1 = new BaZiMod();
                    tmplatlng         = m_chart.SecondPoi.ToString().Split(new char[] { '|' });
                    m_bazi1.BirthTime = new DateEntity(PublicDeal.GetInstance().RealTime(DateTime.Parse(m_chart.SecondBirth.ToString()),
                                                                                         new LatLng(tmplatlng[1], tmplatlng[0], m_chart.SecondPoiName)));
                    m_bazi1.AreaName  = m_chart.SecondPoiName.ToString();
                    m_bazi1.Longitude = tmplatlng[0];
                    m_bazi1.Gender    = (AppEnum.Gender)m_chart.SecondGender;
                    BaZiBiz.GetInstance().TimeToBaZi(ref m_bazi1);
                    ret.Chart.Add(m_bazi1);
                }
            }
            #endregion
            ret.Context = input["Context"].ToString();
            if (input["NickName"] == null)
            {
                USR_CustomerMod m_customer = USR_CustomerBll.GetInstance().GetModel(int.Parse(input["CustomerSysNo"].ToString()));

                ret.CustomerNickName = m_customer.NickName;
                ret.CustomerPhoto    = m_customer.Photo;
            }
            else
            {
                ret.CustomerNickName = input["NickName"].ToString();
                ret.CustomerPhoto    = input["Photo"].ToString();
            }
            if (input["CustomerSysNo"].ToString() != "")
            {
                ret.CustomerSysNo = int.Parse(input["CustomerSysNo"].ToString());
            }
            ret.DR = int.Parse(input["DR"].ToString());
            if (input["EndTime"].ToString() != "")
            {
                ret.EndTime = DateTime.Parse(input["EndTime"].ToString());
            }
            if (input["IsSecret"].ToString() != "")
            {
                ret.IsSecret = int.Parse(input["IsSecret"].ToString());
            }
            if (input["LastReplyTime"].ToString() != "")
            {
                ret.LastReplyTime = DateTime.Parse(input["LastReplyTime"].ToString());
            }
            if (input["LastReplyUser"].ToString() != "")
            {
                ret.LastReplyUser = int.Parse(input["LastReplyUser"].ToString());
            }
            if (input["ReadCount"].ToString() != "")
            {
                ret.ReadCount = int.Parse(input["ReadCount"].ToString());
            }
            if (input["ReplyCount"].ToString() != "")
            {
                ret.ReplyCount = int.Parse(input["ReplyCount"].ToString());
            }
            if (input["SysNo"].ToString() != "")
            {
                ret.SysNo = int.Parse(input["SysNo"].ToString());
            }
            ret.Title = input["Title"].ToString();
            if (input["TS"].ToString() != "")
            {
                ret.TS = DateTime.Parse(input["TS"].ToString());
            }

            return(ret);
        }
Exemple #38
0
        public QA_QuestionShowMini <ZiWeiMod> MapQA_QuestionShowMiniForZiWei(DataRow input)
        {
            QA_QuestionShowMini <ZiWeiMod> ret = new QA_QuestionShowMini <ZiWeiMod>();

            if (input["Award"].ToString() != "")
            {
                ret.Award = int.Parse(input["Award"].ToString());
            }
            if (input["CateSysNo"].ToString() != "")
            {
                ret.CateSysNo = int.Parse(input["CateSysNo"].ToString());
            }
            #region 设置命盘
            int[]         _paras  = { 1, 1, 0, 1 };
            FATE_ChartMod m_chart = QA_QuestionBll.GetInstance().GetChartByQuest(int.Parse(input["SysNo"].ToString()));
            if (m_chart != null)
            {
                ZiWeiMod m_ziwei = new ZiWeiMod();
                #region 设置实体各种参数
                //默认做太阳时修正
                string[] tmplatlng = m_chart.FirstPoi.ToString().Split(new char[] { '|' });
                m_ziwei.BirthTime = new DateEntity(PublicDeal.GetInstance().RealTime(DateTime.Parse(m_chart.FirstBirth.ToString()),
                                                                                     new LatLng(tmplatlng[1], tmplatlng[0], m_chart.FirstPoiName)));
                m_ziwei.Gender      = (AppEnum.Gender) int.Parse(m_chart.FirstGender.ToString());
                m_ziwei.RunYue      = PublicValue.ZiWeiRunYue.dangxia;
                m_ziwei.TransitTime = new DateEntity(DateTime.Now);
                #endregion
                m_ziwei = ZiWeiBiz.GetInstance().TimeToZiWei(m_ziwei.BirthTime, m_ziwei.Gender, _paras);
                ret.Chart.Add(m_ziwei);

                if (m_chart.CharType.ToString() == ((int)AppEnum.ChartType.relation).ToString())
                {
                    ZiWeiMod m_ziwei1 = new ZiWeiMod();
                    #region 设置实体各种参数
                    tmplatlng          = m_chart.SecondPoi.ToString().Split(new char[] { '|' });
                    m_ziwei1.BirthTime = new DateEntity(PublicDeal.GetInstance().RealTime(DateTime.Parse(m_chart.SecondBirth.ToString()),
                                                                                          new LatLng(tmplatlng[1], tmplatlng[0], m_chart.SecondPoiName)));
                    m_ziwei1.Gender      = (AppEnum.Gender) int.Parse(m_chart.SecondGender.ToString());
                    m_ziwei1.RunYue      = PublicValue.ZiWeiRunYue.dangxia;
                    m_ziwei1.TransitTime = new DateEntity(DateTime.Now);
                    #endregion
                    m_ziwei1 = ZiWeiBiz.GetInstance().TimeToZiWei(m_ziwei.BirthTime, m_ziwei.Gender, _paras);
                    ret.Chart.Add(m_ziwei1);
                }
            }
            #endregion
            ret.Context = input["Context"].ToString();
            if (input["NickName"] == null)
            {
                USR_CustomerMod m_customer = USR_CustomerBll.GetInstance().GetModel(int.Parse(input["CustomerSysNo"].ToString()));

                ret.CustomerNickName = m_customer.NickName;
                ret.CustomerPhoto    = m_customer.Photo;
            }
            else
            {
                ret.CustomerNickName = input["NickName"].ToString();
                ret.CustomerPhoto    = input["Photo"].ToString();
            }
            if (input["CustomerSysNo"].ToString() != "")
            {
                ret.CustomerSysNo = int.Parse(input["CustomerSysNo"].ToString());
            }
            ret.DR = int.Parse(input["DR"].ToString());
            if (input["EndTime"].ToString() != "")
            {
                ret.EndTime = DateTime.Parse(input["EndTime"].ToString());
            }
            if (input["IsSecret"].ToString() != "")
            {
                ret.IsSecret = int.Parse(input["IsSecret"].ToString());
            }
            if (input["LastReplyTime"].ToString() != "")
            {
                ret.LastReplyTime = DateTime.Parse(input["LastReplyTime"].ToString());
            }
            if (input["LastReplyUser"].ToString() != "")
            {
                ret.LastReplyUser = int.Parse(input["LastReplyUser"].ToString());
            }
            if (input["ReadCount"].ToString() != "")
            {
                ret.ReadCount = int.Parse(input["ReadCount"].ToString());
            }
            if (input["ReplyCount"].ToString() != "")
            {
                ret.ReplyCount = int.Parse(input["ReplyCount"].ToString());
            }
            if (input["SysNo"].ToString() != "")
            {
                ret.SysNo = int.Parse(input["SysNo"].ToString());
            }
            ret.Title = input["Title"].ToString();
            if (input["TS"].ToString() != "")
            {
                ret.TS = DateTime.Parse(input["TS"].ToString());
            }

            return(ret);
        }
Exemple #39
0
        /// <summary>
        /// 编辑信息
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void Button3_Click(object sender, EventArgs e)
        {
            #region 检查输入
            if (RadioButtonList1.SelectedIndex == -1)
            {
                Page.ClientScript.RegisterStartupScript(this.GetType(), "nogender", "alert('请选择性别');", true);
                return;
            }
            #endregion
            try
            {
                m_user = USR_CustomerBll.GetInstance().GetModel(int.Parse(Request.QueryString["id"]));
                m_user.FateType = int.Parse(drpFateType.SelectedValue);
                m_user.Gender = int.Parse(RadioButtonList1.SelectedValue);
                m_user.Birth = DatePicker2.SelectedTime;
                m_user.IsShowBirth = int.Parse(drpBirthType.SelectedValue);
                m_user.HomeTown = District2.Area3SysNo;
                m_user.Intro = txtIntro.Text;

                USR_CustomerBll.GetInstance().Update(m_user);

                SessionInfo m_session = new SessionInfo();
                m_session.CustomerEntity = m_user;
                m_session.GradeEntity = USR_GradeBll.GetInstance().GetModel(m_user.SysNo);
                Session[AppConfig.CustomerSession] = m_session;

                Page.ClientScript.RegisterStartupScript(this.GetType(), "infook", "alert('用户信息更新成功');", true);
            }
            catch(Exception ex)
            {
                LogManagement.getInstance().WriteException(ex, "WebForMain.UserInfo.Edit", Request.UserHostAddress);
                Page.ClientScript.RegisterStartupScript(this.GetType(), "noinfo", "alert('系统故障,请联系管理员');", true);
            }
        }
Exemple #40
0
        public ReturnValue<USR_CustomerMaintain> WeiboLoginAlt(string token, long expires)
        {
            //新浪微博回调
            XmlDocument xmlDoc = new XmlDocument();
            xmlDoc.Load(Container.ConfigService.GetAppSetting<string>("ThirdLoginFilePath", ""));
            XmlNode node = xmlDoc.SelectSingleNode("//ThirdLogin//WeiBo//AppID");
            XmlNode node1 = xmlDoc.SelectSingleNode("//ThirdLogin//WeiBo//Key");
            var oauth = new NetDimension.Weibo.OAuth(node.InnerText, node1.InnerText, Container.ConfigService.GetAppSetting<string>("HomeUrl", "") + "Passport/ThirdLogin.aspx");
            var uid = "";
            if (!string.IsNullOrEmpty(token))
            {
                var Sina = new NetDimension.Weibo.Client(oauth);
                uid = Sina.API.Account.GetUID(); //调用API中获取UID的方法
            }

            USR_CustomerMod m_customer = USR_CustomerBll.GetInstance().GetUserByThirdID(uid);
            if (m_customer != null && m_customer.SysNo != AppConst.IntNull)
            {
                m_customer.LastLoginTime = DateTime.Now;
                USR_CustomerBll.GetInstance().Update(m_customer);

                USR_CustomerMaintain ret = new USR_CustomerMaintain();
                m_customer.MemberwiseCopy(ret);
                return ReturnValue<USR_CustomerMaintain>.Get200OK(ret);
            }

            USR_ThirdLoginMod m_third = new USR_ThirdLoginMod();
            m_third.OpenID = uid;
            m_third.AccessKey = token;
            m_third.ThirdType = (int)AppEnum.ThirdLoginType.weibo;
            USR_CustomerMod m_user = new USR_CustomerMod();
            try
            {
                m_user.Email = "";
                m_user.FateType = (int)AppEnum.FateType.astro;
                m_user.GradeSysNo = AppConst.OriginalGrade; ;
                m_user.NickName = uid;
                m_user.Password = "";
                m_user.RegTime = DateTime.Now;
                m_user.Point = AppConst.OriginalPoint;
                m_user.Photo = AppConst.OriginalPhoto;
                m_user.LastLoginTime = DateTime.Now;
                if (Container.ConfigService.GetAppSetting<string>("RegisterEmailCheck", "false").ToLower() == "true")
                {
                    m_user.Status = (int)AppEnum.State.prepare;
                }
                else
                {
                    m_user.Status = (int)AppEnum.State.normal;
                }

                m_user.Credit = 0;
                m_user.Birth = AppConst.DateTimeNull;
                m_user.IsShowBirth = 1;
                m_user.IsStar = 0;
                m_user.BestAnswer = 0;
                m_user.TotalAnswer = 0;
                m_user.TotalQuest = 0;
                m_user.HomeTown = AppConst.IntNull;
                m_user.Intro = AppConst.OriginalIntro;
                m_user.Signature = AppConst.OriginalSign;
                m_user.Exp = 0;
                m_user.TotalReply = 0;

                m_user.SysNo = USR_CustomerBll.GetInstance().Add(m_user);

                m_third.CustomerSysNo = m_user.SysNo;
                USR_ThirdLoginBll.GetInstance().Add(m_third);
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }

            USR_CustomerMaintain rett = new USR_CustomerMaintain();
            m_customer.MemberwiseCopy(rett);
            return ReturnValue<USR_CustomerMaintain>.Get200OK(rett);
        }
Exemple #41
0
        public ReturnValue<USR_CustomerMaintain> QQLogin(string code)
        {
            //QQ回调
            XmlDocument xmlDoc = new XmlDocument();
            xmlDoc.Load(Container.ConfigService.GetAppSetting<string>("ThirdLoginFilePath", ""));
            XmlNode node = xmlDoc.SelectSingleNode("//ThirdLogin//QQ//AppID");
            XmlNode node1 = xmlDoc.SelectSingleNode("//ThirdLogin//QQ//Key");
            //获取Access Token
            System.Net.HttpWebRequest req = (System.Net.HttpWebRequest)System.Net.HttpWebRequest.Create("https://graph.qq.com/oauth2.0/token?grant_type=authorization_code&client_id=" + node.InnerText + "&client_secret=" + node1.InnerText
                + "&code=" + code + "&redirect_uri=" + Container.ConfigService.GetAppSetting<string>("HomeUrl", "") + "Passport/ThirdLogin.aspx");
            System.Net.HttpWebResponse res = (System.Net.HttpWebResponse)req.GetResponse();
            Encoding encoding = Encoding.UTF8;
            StreamReader reader = new StreamReader(res.GetResponseStream(), encoding);
            string ret = reader.ReadToEnd();
            string retcode = "";
            int timespan = 0;
            try
            {
                retcode = ret.Split(new char[] { '&' })[0].Split(new char[] { '=' })[1];
                timespan = int.Parse(ret.Split(new char[] { '&' })[1].Split(new char[] { '=' })[1]);
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }
            //获取OpenID
            req = (System.Net.HttpWebRequest)System.Net.HttpWebRequest.Create("https://graph.qq.com/oauth2.0/me?access_token=" + retcode);
            res = (System.Net.HttpWebResponse)req.GetResponse();
            reader = new StreamReader(res.GetResponseStream(), encoding);
            ret = reader.ReadToEnd();
            string openid = "";
            try
            {
                openid = ret.Split(new char[] { '"' })[7];
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }

            USR_CustomerMod m_customer = USR_CustomerBll.GetInstance().GetUserByThirdID(openid);
            if (m_customer != null && m_customer.SysNo != AppConst.IntNull)
            {
                m_customer.LastLoginTime = DateTime.Now;
                USR_CustomerBll.GetInstance().Update(m_customer);

                USR_CustomerMaintain rett = new USR_CustomerMaintain();
                m_customer.MemberwiseCopy(rett);
                return ReturnValue<USR_CustomerMaintain>.Get200OK(rett);
            }

            m_customer = new USR_CustomerMod();

            //获取用户信息
            req = (System.Net.HttpWebRequest)System.Net.HttpWebRequest.Create(@"https://graph.qq.com/user/get_user_info?access_token=" + retcode +

            "&oauth_consumer_key=" + node.InnerXml +

            "&openid=" + openid);
            res = (System.Net.HttpWebResponse)req.GetResponse();
            reader = new StreamReader(res.GetResponseStream(), encoding);
            ret = reader.ReadToEnd();

            try
            {
                m_customer.NickName = ret.Split(new char[] { ':', ',' })[7].Replace(@"""", "").DoTrim();
                m_customer.Photo = ret.Split(new string[] { @""":", "," }, StringSplitOptions.None)[19].Replace(@"""", "").Replace(@"\", "").DoTrim();
                if (USR_CustomerBll.GetInstance().CheckNickName(m_customer.NickName).SysNo != AppConst.IntNull)
                {
                    m_customer.NickName += "-"+openid.Substring(0, 6);
                }
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }

            #region 保存数据
            USR_ThirdLoginMod m_third = new USR_ThirdLoginMod();
            m_third.OpenID = openid;
            m_third.AccessKey = retcode;
            m_third.ExpireTime = DateTime.Now.AddSeconds(timespan);
            m_third.ThirdType = (int)AppEnum.ThirdLoginType.qq;

            USR_CustomerMod m_user = new USR_CustomerMod();
            try
            {
                m_user.Email = "";
                m_user.FateType = (int)AppEnum.FateType.astro;
                m_user.GradeSysNo = AppConst.OriginalGrade; ;
                m_user.Password = "";
                m_user.RegTime = DateTime.Now;
                m_user.Point = AppConst.OriginalPoint;
                m_user.LastLoginTime = DateTime.Now;
                if (Container.ConfigService.GetAppSetting<string>("RegisterEmailCheck", "false").ToLower() == "true")
                {
                    m_user.Status = (int)AppEnum.State.prepare;
                }
                else
                {
                    m_user.Status = (int)AppEnum.State.normal;
                }

                m_user.Credit = 0;
                m_user.Birth = AppConst.DateTimeNull;
                m_user.IsShowBirth = 1;
                m_user.IsStar = 0;
                m_user.BestAnswer = 0;
                m_user.TotalAnswer = 0;
                m_user.TotalQuest = 0;
                m_user.HomeTown = AppConst.IntNull;
                m_user.Intro = AppConst.OriginalIntro;
                m_user.Signature = AppConst.OriginalSign;
                m_user.Exp = 0;
                m_user.TotalReply = 0;

                m_user.SysNo = USR_CustomerBll.GetInstance().Add(m_user);

                m_third.CustomerSysNo = m_user.SysNo;
                USR_ThirdLoginBll.GetInstance().Add(m_third);
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }
            #endregion

            USR_CustomerMaintain rettt = new USR_CustomerMaintain();
            m_customer.MemberwiseCopy(rettt);
            return ReturnValue<USR_CustomerMaintain>.Get200OK(rettt);
        }
Exemple #42
0
        public ReturnValue<bool> FindPass(string username)
        {
            USR_CustomerMod m_user = new USR_CustomerMod();
            //生成6位随机新密码,并MD5加密;
            string[] arr = ("A,B,C,D,E,F,G,H,J,K,L,M,N,P,Q,R,S,T,U,V,W,X,Y,Z,2,3,4,5,6,7,8,9").Split(',');
            string Password = "";
            int randValue = -1;
            Random rand = new Random(unchecked((int)DateTime.Now.Ticks));
            for (int i = 0; i < 6; i++)
            {
                randValue = rand.Next(0, arr.Length - 1);
                Password += arr[randValue];
            }
            if (string.IsNullOrEmpty(username))
            {
                throw new BusinessException("手机号或邮箱为空");
            }
            else
            {
                if (Util.IsCellNumber(username))
                {
                    m_user = USR_CustomerBll.GetInstance().CheckPhone(username);
                    if (m_user.SysNo == AppConst.IntNull)
                    {
                        throw new BusinessException("用户不存在!");
                    }
                    m_user.Password = Password;
                    USR_CustomerBll.GetInstance().Update(m_user);

                    #region 发送短信
                    throw new BusinessException("短信接口还未申请!");
                    #endregion

                }
                else if (Util.IsEmailAddress(username))
                {
                    m_user = USR_CustomerBll.GetInstance().CheckUser(username);
                    if (m_user.SysNo == AppConst.IntNull)
                    {
                        throw new BusinessException("用户不存在!");
                    }
                    m_user.Password = Password;
                    USR_CustomerBll.GetInstance().Update(m_user);

                    #region SetEmailContent
                    string mailBody = CommonTools.ReadHtmFile(Container.ConfigService.GetAppSetting<string>("AdvFolderPath","") + @"EmailTemplate/FindPassword.htm");
                    mailBody.Replace("@nickname", m_user.NickName);
                    mailBody.Replace("@password", m_user.Password);
                    //mailBody.Replace("@userid", m_user.SysNo.ToString());
                    //mailBody.Replace("@md5",CommonTools.md5(m_user.NickName+m_user.Password+DateTime.Now.ToString("yyyyMMddHHmmss"),32);
                    string mailadd = m_user.Email;
                    string mailSubject = "上上签密码找回";
                    #endregion SetEmailContent

                    //邮件发送
                    TCPMail oMail = new TCPMail();
                    oMail.Html = true;
                    if (oMail.Send(mailadd,
                        mailSubject,
                        mailBody))
                    {
                        return ReturnValue<bool>.Get200OK(true);
                    }
                    else
                    {
                        throw new BusinessException("发送邮件失败!");
                    }
                }
                else
                {
                    throw new BusinessException("手机号或邮箱不合法");
                }
            }
        }
Exemple #43
0
        protected void Unnamed3_Click(object sender, EventArgs e)
        {
            #region 验证输入
            if (!ValidateCode())
            {
                code.Text = "";
                return;
            }
            if (!ValidateEmail())
            {
                code.Text = "";
                return;
            }
            if (!ValidatePass())
            {
                code.Text = "";
                return;
            }
            if (!ValidateNickName())
            {
                code.Text = "";
                return;
            }

            #endregion

            #region 保存数据
            USR_CustomerMod m_user = new USR_CustomerMod();
            try
            {
                m_user.Email = email.Text.Trim();
                m_user.FateType = int.Parse(drpType.SelectedValue);
                m_user.GradeSysNo = AppConst.OriginalGrade; ;
                m_user.NickName = name.Text.Trim();
                m_user.Password = password1.Text.Trim();
                m_user.RegTime = DateTime.Now;
                m_user.Point = AppConst.OriginalPoint;
                m_user.Photo = AppConst.OriginalPhoto;
                m_user.LastLoginTime = DateTime.Now;
                if (AppConfig.RegisterEmailCheck.ToLower() == "true")
                {
                    m_user.Status = (int)AppEnum.State.prepare;
                }
                else
                {
                    m_user.Status = (int)AppEnum.State.normal;
                }

                m_user.Credit = 0;
                m_user.Birth = AppConst.DateTimeNull;
                m_user.IsShowBirth = 1;
                m_user.IsStar = 0;
                m_user.BestAnswer = 0;
                m_user.TotalAnswer = 0;
                m_user.TotalQuest= 0;
                m_user.HomeTown = AppConst.IntNull;
                m_user.Intro = AppConst.OriginalIntro;
                m_user.Signature = AppConst.OriginalSign;
                m_user.Exp = 0;
                m_user.TotalReply = 0;
                m_user.HasNewInfo = 0;
                m_user.TotalTalk = 0;
                m_user.TotalTalkReply = 0;
                m_user.SetOrderCount = 0;
                m_user.BuyOrderCount = 0;
                m_user.SellOrderCount = 0;
                m_user.TotalSellRMB = 0;
                m_user.TotalBuyRMB = 0;
                m_user.TotalBuyPoint = 0;

                m_user.SysNo = USR_CustomerBll.GetInstance().Add(m_user);
            }
            catch (Exception ex)
            {
                LogManagement.getInstance().WriteException(ex, "WebForMain.Register", Request.UserHostAddress);
                return;
            }
            #endregion

            #region 发送验证邮件
            if (AppConfig.RegisterEmailCheck.ToLower() == "true")
            {

            }
            #endregion

            #region 登陆状态设置
            if (!(AppConfig.RegisterEmailCheck.ToLower() == "true"))
            {
                SessionInfo m_session = new SessionInfo();
                m_session.CustomerEntity = m_user;
                m_session.GradeEntity = USR_GradeBll.GetInstance().GetModel(m_user.SysNo);
                Session[AppConfig.CustomerSession] = m_session;
            }
            #endregion
            if (Request.QueryString["url"] != null && Request.QueryString["url"] != "")
            {
                Response.Redirect("RegisterSucc.aspx?url=" + Request.QueryString["url"]);
            }
            else
            {
                Response.Redirect("RegisterSucc.aspx");
            }
        }
Exemple #44
0
 public USR_CustomerMod CheckUser(string username)
 {
     USR_CustomerMod model = new USR_CustomerMod();
     using (SQLData data = new SQLData())
     {
         StringBuilder builder = new StringBuilder();
         builder.Append("select SysNo from USR_Customer where Email='").Append(SQLData.SQLFilter(username)).Append("' and Status=").Append((int)AppEnum.State.normal);
         try
         {
             model.SysNo = int.Parse(data.CmdtoDataRow(builder.ToString())["SysNo"].ToString());
             model.Email = username;
         }
         catch (Exception exception)
         {
             //throw exception;
         }
     }
     if (model.SysNo != AppConst.IntNull)
     {
         model = this.GetModel(model.SysNo);
     }
     return model;
 }
Exemple #45
0
 public USR_CustomerMod GetUserByThirdID(string id)
 {
     USR_CustomerMod model = new USR_CustomerMod();
     using (SQLData data = new SQLData())
     {
         StringBuilder builder = new StringBuilder();
         builder.Append("select CustomerSysNo from USR_ThirdLogin where OpenID='").Append(SQLData.SQLFilter(id)).Append("'");
         try
         {
             model.SysNo = int.Parse(data.CmdtoDataRow(builder.ToString())["CustomerSysNo"].ToString());
         }
         catch (Exception exception)
         {
             //throw exception;
         }
     }
     if (model.SysNo != AppConst.IntNull)
     {
         model = this.GetModel(model.SysNo);
     }
     return model;
 }
Exemple #46
0
        protected void Button7_Click(object sender, EventArgs e)
        {
            string OPath = @"~\WebResources\UpUserFiles\Photos\O";
            try
            {
                int imageWidth = Int32.Parse(txt_width.Text);
                int imageHeight = Int32.Parse(txt_height.Text);
                int cutTop = Int32.Parse(txt_top.Text);
                int cutLeft = Int32.Parse(txt_left.Text);
                int dropWidth = Int32.Parse(txt_DropWidth.Text);
                int dropHeight = Int32.Parse(txt_DropHeight.Text);

                string filename = ImageHelper.SaveCutPic(Server.MapPath(@"~\WebResources\UpUserFiles\Photos\Tmp\o" + hdfPicID.Value), Server.MapPath(OPath), 0, 0, dropWidth,
                                    dropHeight, cutLeft, cutTop, imageWidth, imageHeight);
                ImageHelper.SaveThumbnail(Server.MapPath(OPath + @"\" + filename), Server.MapPath(@"~\WebResources\UpUserFiles\Photos\T"), filename, 70, 70, true);
                m_user = USR_CustomerBll.GetInstance().GetModel(int.Parse(Request.QueryString["id"]));
                m_user.Photo = filename.Replace(".jpg", "");
                USR_CustomerBll.GetInstance().Update(m_user);
                MultiView1.ActiveViewIndex = 0;
                //DataBind();
                Page.ClientScript.RegisterStartupScript(this.GetType(), "photook", "alert('头像更新成功');", true);

            }
            catch (Exception ex)
            {
                LogManagement.getInstance().WriteException(ex, "WebForMain.Userphoto.Upload", Request.UserHostAddress);
                Page.ClientScript.RegisterStartupScript(this.GetType(), "photook", "alert('系统故障,请联系管理员');", true);
            }
        }
Exemple #47
0
        protected void LinkButton1_Click(object sender, EventArgs e)
        {
            //if (!ValidateEmail())
            //{
            //    return;
            //}
            if (!ValidateNickName())
            {
                return;
            }

            #region 获取用户第三方数据
            USR_ThirdLoginMod m_third = new USR_ThirdLoginMod();
            switch (ViewState["type"].ToString())
            {
                case "qq":
                    m_third.OpenID = ViewState["openid"].ToString();
                    m_third.AccessKey = ViewState["code"].ToString();
                    m_third.ExpireTime = DateTime.Now.AddSeconds(int.Parse(ViewState["expire"].ToString()));
                    m_third.ThirdType = (int)AppEnum.ThirdLoginType.qq;
                    break;
                case "weibo":
                    m_third.OpenID = ViewState["openid"].ToString();
                    m_third.AccessKey = ViewState["code"].ToString();
                    m_third.ThirdType = (int)AppEnum.ThirdLoginType.weibo;
                    break;
                default:
                    ShowError("系统故障,请联系管理员");
                    break;
            }
            #endregion

            #region 保存数据
            USR_CustomerMod m_user = new USR_CustomerMod();
            try
            {
                m_user.Email = "";
                m_user.FateType = int.Parse(drpType.SelectedValue);
                m_user.GradeSysNo = AppConst.OriginalGrade; ;
                m_user.NickName = ViewState["nickname"].ToString();
                m_user.Password = "";
                m_user.RegTime = DateTime.Now;
                m_user.Point = AppConst.OriginalPoint;
                m_user.Photo = ViewState["photo"].ToString();
                m_user.LastLoginTime = DateTime.Now;
                if (AppConfig.RegisterEmailCheck.ToLower() == "true")
                {
                    m_user.Status = (int)AppEnum.State.prepare;
                }
                else
                {
                    m_user.Status = (int)AppEnum.State.normal;
                }

                m_user.Credit = 0;
                m_user.Birth = AppConst.DateTimeNull;
                m_user.IsShowBirth = 1;
                m_user.IsStar = 0;
                m_user.BestAnswer = 0;
                m_user.TotalAnswer = 0;
                m_user.TotalQuest = 0;
                m_user.HomeTown = AppConst.IntNull;
                m_user.Intro = AppConst.OriginalIntro;
                m_user.Signature = AppConst.OriginalSign;
                m_user.Exp = 0;
                m_user.TotalReply = 0;

                m_user.SysNo = USR_CustomerBll.GetInstance().Add(m_user);

                m_third.CustomerSysNo = m_user.SysNo;
                USR_ThirdLoginBll.GetInstance().Add(m_third);
            }
            catch (Exception ex)
            {
                LogManagement.getInstance().WriteException(ex, "WebForMain.Register", Request.UserHostAddress);
                return;
            }
            #endregion

            #region 登陆状态设置
            if (!(AppConfig.RegisterEmailCheck.ToLower() == "true"))
            {
                SessionInfo m_session = new SessionInfo();
                m_session.CustomerEntity = m_user;
                m_session.GradeEntity = USR_GradeBll.GetInstance().GetModel(m_user.SysNo);
                Session[AppConfig.CustomerSession] = m_session;
            }
            #endregion
            if (Request.QueryString["url"] != null && Request.QueryString["url"] != "")
            {
                Response.Redirect("RegisterSucc.aspx?url=" + Request.QueryString["url"]);
            }
            else
            {
                Response.Redirect("RegisterSucc.aspx");
            }
        }
Exemple #48
0
 /// <summary>
 /// 仅用于用户登录
 /// </summary>
 /// <param name="username"></param>
 /// <param name="password"></param>
 /// <returns></returns>
 public USR_CustomerMod CheckUser(string username, string password)
 {
     USR_CustomerMod model = new USR_CustomerMod();
     using (SQLData data = new SQLData())
     {
         StringBuilder builder = new StringBuilder();
         if (Util.IsEmailAddress(username))
         {
             builder.Append("select SysNo from USR_Customer where Email='").Append(SQLData.SQLFilter(username)).Append("' and Password='******' and Status=").Append((int)AppEnum.State.normal);
         }
         else
         {
             builder.Append("select SysNo from USR_Customer where Phone='").Append(SQLData.SQLFilter(username)).Append("' and Password='******' and Status=").Append((int)AppEnum.State.normal);
         }
         try
         {
             model.SysNo = int.Parse(data.CmdtoDataRow(builder.ToString())["SysNo"].ToString());
         }
         catch (Exception exception)
         {
             //throw exception;
         }
     }
     if (model.SysNo != AppConst.IntNull)
     {
         model = this.GetModel(model.SysNo);
         model.LastLoginTime = DateTime.Now;
         this.Update(model);
     }
     return model;
 }
Exemple #49
0
        protected void BindData()
        {
            try
            {
                if (m_qustion.DR != (int)AppEnum.State.normal)
                {
                    ShowError("");
                }
                m_qustion.ReadCount++;
                QA_QuestionBll.GetInstance().Update(m_qustion);

                ltrTitle.Text   = m_qustion.Title;
                ltrContext.Text = m_qustion.Context;
                ltrAward.Text   = m_qustion.Award.ToString();
                ltrReply.Text   = m_qustion.ReplyCount.ToString();
                ltrTime.Text    = m_qustion.TS.ToString("yyyy-MM-dd HH:mm:ss");
                ltrViewNum.Text = m_qustion.ReadCount.ToString();
                if (GetSession().CustomerEntity.SysNo == m_qustion.CustomerSysNo)
                {
                    LinkButton5.Style["display"] = "";
                    ltrTime.Text += "&nbsp;&nbsp;&nbsp;|&nbsp;&nbsp;&nbsp;";
                }
                USR_CustomerMod m_user  = USR_CustomerBll.GetInstance().GetModel(m_qustion.CustomerSysNo);
                USR_GradeMod    m_grade = USR_GradeBll.GetInstance().GetModel(m_user.GradeSysNo);
                ltrNickName.Text   = m_user.NickName;
                ltrQALevel.Text    = m_grade.Name;
                ltrTotalReply.Text = m_user.TotalReply.ToString();
                ltrTotalAsk.Text   = m_user.TotalQuest.ToString();
                Image1.ImageUrl    = AppConfig.HomeUrl() + "ControlLibrary/ShowPhoto.aspx?type=t&id=" + m_user.Photo;

                #region 显示命盘
                FATE_ChartMod m_chart = QA_QuestionBll.GetInstance().GetChartByQuest(SysNo);
                if (m_chart != null && m_chart.SysNo != AppConst.IntNull)
                {
                    if (GetSession().CustomerEntity == null || GetSession().CustomerEntity.SysNo == AppConst.IntNull)
                    {
                        Astro1.input   = m_chart;
                        Astro1.Visible = true;
                    }
                    else if (GetSession().CustomerEntity.FateType == (int)AppEnum.FateType.ziwei)
                    {
                        Ziwei1.input   = m_chart;
                        Ziwei1.Visible = true;
                    }
                    else if (GetSession().CustomerEntity.FateType == (int)AppEnum.FateType.bazi)
                    {
                        Bazi1.input   = m_chart;
                        Bazi1.Visible = true;
                    }
                    else
                    {
                        Astro1.input   = m_chart;
                        Astro1.Visible = true;
                    }
                }
                #endregion

                BindList();
            }
            catch
            {
                ShowError("");
            }
        }
Exemple #50
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Request.QueryString["id"] != null)
            {
                try
                {
                    m_user = USR_CustomerBll.GetInstance().GetModel(int.Parse(Request.QueryString["id"]));
                    if (m_user.SysNo == AppConst.IntNull)
                    {
                        ShowError("");
                    }
                }
                catch
                {
                    ShowError("");
                }
            }
            else if (Page.RouteData.Values["id"] != null)
            {
                try
                {
                    m_user = USR_CustomerBll.GetInstance().GetModel(int.Parse(Page.RouteData.Values["id"].ToString()));
                    if (m_user.SysNo == AppConst.IntNull)
                    {
                        ShowError("");
                    }
                }
                catch
                {
                    ShowError("");
                }
            }
            else
            {
                Login(Request.Url.ToString());
                m_user = USR_CustomerBll.GetInstance().GetModel(GetSession().CustomerEntity.SysNo);
                m_grade = USR_GradeBll.GetInstance().GetModel(m_user.GradeSysNo);
            }
            try
            {
                if (!IsPostBack)
                {

                    if (m_user.HomeTown != AppConst.IntNull)
                    {
                        SYS_DistrictMod m_dictrict = SYS_DistrictBll.GetInstance().GetModel(SYS_DistrictBll.GetInstance().GetModel(m_user.HomeTown).UpSysNo);
                        ltrFrom.Text = m_dictrict.Name;
                    }
                    else
                    {
                        ltrFrom.Text = "未知";
                    }
                    if (m_user.Birth != AppConst.DateTimeNull)
                    {
                        ltrBirth.Text = "生日:" + m_user.Birth.ToString("yyyy年MM月dd日");
                    }
                    else
                    {
                        ltrBirth.Text = "生日:未知";
                    }
                    BindArticles();
                    BindBestAnswer();
                    BindIcons();

                    LinkButton1_Click(LinkButton1, e);
                }
                if (GetSession().CustomerEntity != null && GetSession().CustomerEntity.SysNo != AppConst.IntNull && m_user.SysNo == GetSession().CustomerEntity.SysNo)
                    {
                        ltrMe = "我";
                        sendmsg.Visible = false;
                        intro.HRef = AppConfig.HomeUrl() + "Qin/UserInfo.aspx?id=" + m_user.SysNo + "&tab=1";
                        ImageButton1.ImageUrl = AppConfig.HomeUrl() + "ControlLibrary/ShowPhoto.aspx?type=o&id=" + m_user.Photo;
                    }
                    else
                    {
                        ltrMe = "Ta";
                        intro.Visible = false;
                        sendmsg.HRef = AppConfig.HomeUrl() + "Qin/MsgDetail.aspx?UserSysNo=" + m_user.SysNo;
                        ImageButton1.ImageUrl = AppConfig.HomeUrl()+"ControlLibrary/ShowPhoto.aspx?type=o&id=" + m_user.Photo;
                        ImageButton1.Enabled = false;
                    }
                RightPannel1.m_user = m_user;
                RightPannel1.m_grade = m_grade;
            }
            catch
            {
                ShowError("");
            }

            if (Request.QueryString["pn"] != null)
            {
                try
                {
                    pageindex = int.Parse(Request.QueryString["pn"]);
                }
                catch
                { }
            }
            if (Request.QueryString["tab"] != null)
            {
                try
                {
                    tab = int.Parse(Request.QueryString["tab"]);
                }
                catch
                { }
            }
        }
Exemple #51
0
 /// <summary>
 /// 得到一个对象实体
 /// </summary>
 public USR_CustomerMod GetModel(int SysNo)
 {
     StringBuilder strSql = new StringBuilder();
     strSql.Append("select SysNo, Email, Password, GradeSysNo, NickName, Gender, Photo, Credit, Point, Birth, FateType, RegTime, LastLoginTime, Status, IsStar, Signature, Exp, TotalAnswer, TotalQuest, BestAnswer, HomeTown, Intro, Icons, IsShowBirth, TotalReply, HasNewInfo, TotalTalk, TotalTalkReply, Phone, SetOrderCount, BuyOrderCount, SellOrderCount, TotalSellRMB, TotalBuyRMB, TotalBuyPoint from  dbo.USR_Customer");
     strSql.Append(" where SysNo=@SysNo ");
     SqlParameter[] parameters = {
     new SqlParameter("@SysNo", SqlDbType.Int,4 )
      		};
     parameters[0].Value = SysNo;
     USR_CustomerMod model = new USR_CustomerMod();
     DataSet ds = SqlHelper.ExecuteDataSet(strSql.ToString(), parameters);
     if (ds.Tables[0].Rows.Count > 0)
     {
         if (ds.Tables[0].Rows[0]["SysNo"].ToString() != "")
         {
             model.SysNo = int.Parse(ds.Tables[0].Rows[0]["SysNo"].ToString());
         }
         model.Email = ds.Tables[0].Rows[0]["Email"].ToString();
         model.Password = ds.Tables[0].Rows[0]["Password"].ToString();
         if (ds.Tables[0].Rows[0]["GradeSysNo"].ToString() != "")
         {
             model.GradeSysNo = int.Parse(ds.Tables[0].Rows[0]["GradeSysNo"].ToString());
         }
         model.NickName = ds.Tables[0].Rows[0]["NickName"].ToString();
         if (ds.Tables[0].Rows[0]["Gender"].ToString() != "")
         {
             model.Gender = int.Parse(ds.Tables[0].Rows[0]["Gender"].ToString());
         }
         model.Photo = ds.Tables[0].Rows[0]["Photo"].ToString();
         if (ds.Tables[0].Rows[0]["Credit"].ToString() != "")
         {
             model.Credit = int.Parse(ds.Tables[0].Rows[0]["Credit"].ToString());
         }
         if (ds.Tables[0].Rows[0]["Point"].ToString() != "")
         {
             model.Point = int.Parse(ds.Tables[0].Rows[0]["Point"].ToString());
         }
         if (ds.Tables[0].Rows[0]["Birth"].ToString() != "")
         {
             model.Birth = DateTime.Parse(ds.Tables[0].Rows[0]["Birth"].ToString());
         }
         if (ds.Tables[0].Rows[0]["FateType"].ToString() != "")
         {
             model.FateType = int.Parse(ds.Tables[0].Rows[0]["FateType"].ToString());
         }
         if (ds.Tables[0].Rows[0]["RegTime"].ToString() != "")
         {
             model.RegTime = DateTime.Parse(ds.Tables[0].Rows[0]["RegTime"].ToString());
         }
         if (ds.Tables[0].Rows[0]["LastLoginTime"].ToString() != "")
         {
             model.LastLoginTime = DateTime.Parse(ds.Tables[0].Rows[0]["LastLoginTime"].ToString());
         }
         if (ds.Tables[0].Rows[0]["Status"].ToString() != "")
         {
             model.Status = int.Parse(ds.Tables[0].Rows[0]["Status"].ToString());
         }
         if (ds.Tables[0].Rows[0]["IsStar"].ToString() != "")
         {
             model.IsStar = int.Parse(ds.Tables[0].Rows[0]["IsStar"].ToString());
         }
         model.Signature = ds.Tables[0].Rows[0]["Signature"].ToString();
         if (ds.Tables[0].Rows[0]["Exp"].ToString() != "")
         {
             model.Exp = int.Parse(ds.Tables[0].Rows[0]["Exp"].ToString());
         }
         if (ds.Tables[0].Rows[0]["TotalAnswer"].ToString() != "")
         {
             model.TotalAnswer = int.Parse(ds.Tables[0].Rows[0]["TotalAnswer"].ToString());
         }
         if (ds.Tables[0].Rows[0]["TotalQuest"].ToString() != "")
         {
             model.TotalQuest = int.Parse(ds.Tables[0].Rows[0]["TotalQuest"].ToString());
         }
         if (ds.Tables[0].Rows[0]["BestAnswer"].ToString() != "")
         {
             model.BestAnswer = int.Parse(ds.Tables[0].Rows[0]["BestAnswer"].ToString());
         }
         if (ds.Tables[0].Rows[0]["HomeTown"].ToString() != "")
         {
             model.HomeTown = int.Parse(ds.Tables[0].Rows[0]["HomeTown"].ToString());
         }
         model.Intro = ds.Tables[0].Rows[0]["Intro"].ToString();
         model.Icons = ds.Tables[0].Rows[0]["Icons"].ToString();
         if (ds.Tables[0].Rows[0]["IsShowBirth"].ToString() != "")
         {
             model.IsShowBirth = int.Parse(ds.Tables[0].Rows[0]["IsShowBirth"].ToString());
         }
         if (ds.Tables[0].Rows[0]["TotalReply"].ToString() != "")
         {
             model.TotalReply = int.Parse(ds.Tables[0].Rows[0]["TotalReply"].ToString());
         }
         if (ds.Tables[0].Rows[0]["HasNewInfo"].ToString() != "")
         {
             model.HasNewInfo = int.Parse(ds.Tables[0].Rows[0]["HasNewInfo"].ToString());
         }
         if (ds.Tables[0].Rows[0]["TotalTalk"].ToString() != "")
         {
             model.TotalTalk = int.Parse(ds.Tables[0].Rows[0]["TotalTalk"].ToString());
         }
         if (ds.Tables[0].Rows[0]["TotalTalkReply"].ToString() != "")
         {
             model.TotalTalkReply = int.Parse(ds.Tables[0].Rows[0]["TotalTalkReply"].ToString());
         }
         model.Phone = ds.Tables[0].Rows[0]["Phone"].ToString();
         if (ds.Tables[0].Rows[0]["SetOrderCount"].ToString() != "")
         {
             model.SetOrderCount = int.Parse(ds.Tables[0].Rows[0]["SetOrderCount"].ToString());
         }
         if (ds.Tables[0].Rows[0]["BuyOrderCount"].ToString() != "")
         {
             model.BuyOrderCount = int.Parse(ds.Tables[0].Rows[0]["BuyOrderCount"].ToString());
         }
         if (ds.Tables[0].Rows[0]["SellOrderCount"].ToString() != "")
         {
             model.SellOrderCount = int.Parse(ds.Tables[0].Rows[0]["SellOrderCount"].ToString());
         }
         if (ds.Tables[0].Rows[0]["TotalSellRMB"].ToString() != "")
         {
             model.TotalSellRMB = decimal.Parse(ds.Tables[0].Rows[0]["TotalSellRMB"].ToString());
         }
         if (ds.Tables[0].Rows[0]["TotalBuyRMB"].ToString() != "")
         {
             model.TotalBuyRMB = decimal.Parse(ds.Tables[0].Rows[0]["TotalBuyRMB"].ToString());
         }
         if (ds.Tables[0].Rows[0]["TotalBuyPoint"].ToString() != "")
         {
             model.TotalBuyPoint = int.Parse(ds.Tables[0].Rows[0]["TotalBuyPoint"].ToString());
         }
         return model;
     }
     else
     {
         return null;
     }
 }
Exemple #52
0
        public ReturnValue<USR_CustomerMaintain> Register(string email, string password, string phone, string nickname, string fatetype)
        {
            #region 验证输入
            if (email!=null&&email.DoTrim() != "")
            {
                USR_CustomerMod m_userrr = USR_CustomerBll.GetInstance().CheckUser(email);
                if (m_userrr.SysNo != AppConst.IntNull)
                {
                    throw new BusinessException("该邮箱已注册,请重新输入!");
                }
            }
            else if (phone != null && phone.DoTrim() != "")
            {
                if (!Util.IsCellNumber(phone))
                {
                    throw new BusinessException("手机号格式有误,请重新输入!");
                }
                USR_CustomerMod m_userrr = USR_CustomerBll.GetInstance().CheckPhone(phone);
                if (m_userrr.SysNo != AppConst.IntNull)
                {
                    throw new BusinessException("该手机号已注册,请重新输入!");
                }
            }
            if (CommonTools.HasForbiddenWords(nickname))
            {
                throw new BusinessException("您的昵称中有违禁字符,请重新输入!");
            }
            USR_CustomerMod m_userr = USR_CustomerBll.GetInstance().CheckNickName(nickname);
            if (m_userr.SysNo != AppConst.IntNull)
            {
                throw new BusinessException("该昵称已被占用,请尝试使用其他昵称!");
            }
            try
            {
                int fate = int.Parse(fatetype);
            }
            catch
            {
                throw new BusinessException("请输入正确的命盘类型号!");
            }

            #endregion

            #region 保存数据
            USR_CustomerMod m_user = new USR_CustomerMod();

                m_user.Email = email.DoTrim();
                m_user.Phone = phone.DoTrim();
                m_user.FateType = int.Parse(fatetype);
                m_user.GradeSysNo = AppConst.OriginalGrade; ;
                m_user.NickName = nickname.DoTrim();
                m_user.Password = password.DoTrim();
                m_user.RegTime = DateTime.Now;
                m_user.Point = AppConst.OriginalPoint;
                m_user.Photo = AppConst.OriginalPhoto;
                m_user.LastLoginTime = DateTime.Now;
                if (Container.ConfigService.GetAppSetting<string>("RegisterEmailCheck","false").ToLower() == "true")
                {
                    m_user.Status = (int)AppEnum.State.prepare;
                }
                else
                {
                    m_user.Status = (int)AppEnum.State.normal;
                }

                m_user.Credit = 0;
                m_user.Birth = AppConst.DateTimeNull;
                m_user.IsShowBirth = 1;
                m_user.IsStar = 0;
                m_user.BestAnswer = 0;
                m_user.TotalAnswer = 0;
                m_user.TotalQuest = 0;
                m_user.HomeTown = AppConst.IntNull;
                m_user.Intro = AppConst.OriginalIntro;
                m_user.Signature = AppConst.OriginalSign;
                m_user.Exp = 0;
                m_user.TotalReply = 0;
                m_user.HasNewInfo = 0;

                m_user.SysNo = USR_CustomerBll.GetInstance().Add(m_user);

            #endregion

            #region 发送验证邮件
            if (Container.ConfigService.GetAppSetting<string>("RegisterEmailCheck","false").ToLower() == "true")
            {

            }
            #endregion
            if (m_user.SysNo != -999999)
            {
                USR_CustomerMaintain ret = new USR_CustomerMaintain();
                m_user.MemberwiseCopy(ret);
                return ReturnValue<USR_CustomerMaintain>.Get200OK(ret);
            }
            else
            {
                throw new Exception("系统故障,注册失败");
            }
        }
Exemple #53
0
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public void Update(USR_CustomerMod model)
 {
     dal.Update(model);
 }