Example #1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                if (Request.QueryString["User_id"] == null)
                {
                    Response.Write("<script>window.alert('您没有选择用户,无法传值');</script>");
                    Response.Write("<script>window.location.href='index.aspx';</script>");
                }
                else
                {
                    RadButton2.Visible = false;
                    RadButton3.Visible = false;
                    ViewState["BackUrl"] = Request.UrlReferrer.ToString();
                    string a = Request.QueryString["User_id"].ToString();
                    modUserInfo = bllUserInfo.GetModel(Convert.ToInt16(a));
                    User_ID.Text = modUserInfo.User_ID.ToString();
                    DataTable dt = bllUserInfo.GetList_2(a).Tables[0];
                    if (dt.Rows.Count > 0)
                    {
                        Username.Text = dt.Rows[0]["Username"].ToString();

                        Image1.ImageUrl = dt.Rows[0]["Head_pic"].ToString();
                        imgDimensionalPic.ImageUrl = dt.Rows[0]["Head_pic"].ToString();
                        Password.Text = dt.Rows[0]["Password"].ToString();
                        //TextBox11.Text = dt.Rows[0]["Password"].ToString();
                        Nickname.Text = dt.Rows[0]["Nickname"].ToString();

                        Sex.Text = dt.Rows[0]["Sex"].ToString();

                        Truename.Text = dt.Rows[0]["Truename"].ToString();

                        Phone.Text = dt.Rows[0]["Phone"].ToString();

                        E_mail.Text = dt.Rows[0]["E_mail"].ToString();

                        Address.Text = dt.Rows[0]["Address"].ToString();

                        //Balance.Text = dt.Rows[0]["Balance"].ToString();
                        //TextBox9.Text = dt.Rows[0]["Balance"].ToString();
                        if (dt.Rows[0]["Manage"].ToString() == "1")
                        {
                            Manage.Text = "是";
                            //DropDownList4.SelectedValue = "是";
                        }
                        else
                        {
                            Manage.Text = "否";
                            //DropDownList4.SelectedValue = "否";
                        }

                    }
                }

            }
        }
Example #2
0
 public void dataload()
 {
     int num = bllOrder.GetRecordCount("User_Name = '" + Request.Cookies["Username"].Value + "' and IN_group_buying = " + 0 + "");
        if (num == 0)
        {
        noordercon.Visible = true;
        }
        else if(num !=0)
        {
        ordercon.Visible = true;
        noordercon.Visible = false;
        moluserinfo = blluserinfo.GetModel(int.Parse(Request.Cookies["UID"].Value));
        lblusername.Text = moluserinfo.Username;
        SqlDataSource1.SelectCommand = "select * from [Order] where IN_group_buying = 0 and User_Name = '" + lblusername.Text + "'";
        //DataSet ds = bllOrder.GetList("User_Name = '" + lblusername.Text + "'");
        //RadListView1.DataSource = ds;
        //RadListView1.DataBind();
        }
 }
Example #3
0
 /// <summary>
 /// 得到一个对象实体
 /// </summary>
 public TtNum1.Model.UserInfo GetModel(int User_ID)
 {
     StringBuilder strSql=new StringBuilder();
     strSql.Append("select  top 1  ");
     strSql.Append(" User_ID,Username,Password,Nickname,Sex,Truename,Phone,E_mail,Address,Head_pic,Manage,Balance ");
     strSql.Append(" from UserInfo ");
     strSql.Append(" where User_ID="+User_ID+"" );
     TtNum1.Model.UserInfo model=new TtNum1.Model.UserInfo();
     DataSet ds=DbHelperSQL.Query(strSql.ToString());
     if(ds.Tables[0].Rows.Count>0)
     {
         return DataRowToModel(ds.Tables[0].Rows[0]);
     }
     else
     {
         return null;
     }
 }
Example #4
0
 /// <summary>
 /// 得到一个对象实体
 /// </summary>
 public TtNum1.Model.UserInfo DataRowToModel(DataRow row)
 {
     TtNum1.Model.UserInfo model=new TtNum1.Model.UserInfo();
     if (row != null)
     {
         if(row["User_ID"]!=null && row["User_ID"].ToString()!="")
         {
             model.User_ID=int.Parse(row["User_ID"].ToString());
         }
         if(row["Username"]!=null)
         {
             model.Username=row["Username"].ToString();
         }
         if(row["Password"]!=null)
         {
             model.Password=row["Password"].ToString();
         }
         if(row["Nickname"]!=null)
         {
             model.Nickname=row["Nickname"].ToString();
         }
         if(row["Sex"]!=null)
         {
             model.Sex=row["Sex"].ToString();
         }
         if(row["Truename"]!=null)
         {
             model.Truename=row["Truename"].ToString();
         }
         if(row["Phone"]!=null && row["Phone"].ToString()!="")
         {
             model.Phone=int.Parse(row["Phone"].ToString());
         }
         if(row["E_mail"]!=null)
         {
             model.E_mail=row["E_mail"].ToString();
         }
         if(row["Address"]!=null)
         {
             model.Address=row["Address"].ToString();
         }
         if(row["Head_pic"]!=null)
         {
             model.Head_pic=row["Head_pic"].ToString();
         }
         if(row["Manage"]!=null && row["Manage"].ToString()!="")
         {
             model.Manage=int.Parse(row["Manage"].ToString());
         }
         if(row["Balance"]!=null && row["Balance"].ToString()!="")
         {
             model.Balance=int.Parse(row["Balance"].ToString());
         }
     }
     return model;
 }
Example #5
0
 /// <summary>
 /// 得到一个对象实体
 /// </summary>
 public TtNum1.Model.UserInfo GetModel(int User_ID)
 {
     StringBuilder strSql=new StringBuilder();
     strSql.Append("select  top 1  ");
     strSql.Append(" User_ID,Username,Password,Nickname,Sex,Truename,Phone,E_mail,Address,Head_pic,Manage,Balance ");
     strSql.Append(" from UserInfo ");
     strSql.Append(" where User_ID="+User_ID+"" );
     TtNum1.Model.UserInfo model=new TtNum1.Model.UserInfo();
     DataSet ds=DbHelperSQL.Query(strSql.ToString());
     if(ds.Tables[0].Rows.Count>0)
     {
         if(ds.Tables[0].Rows[0]["User_ID"]!=null && ds.Tables[0].Rows[0]["User_ID"].ToString()!="")
         {
             model.User_ID=int.Parse(ds.Tables[0].Rows[0]["User_ID"].ToString());
         }
         if(ds.Tables[0].Rows[0]["Username"]!=null && ds.Tables[0].Rows[0]["Username"].ToString()!="")
         {
             model.Username=ds.Tables[0].Rows[0]["Username"].ToString();
         }
         if(ds.Tables[0].Rows[0]["Password"]!=null && ds.Tables[0].Rows[0]["Password"].ToString()!="")
         {
             model.Password=ds.Tables[0].Rows[0]["Password"].ToString();
         }
         if(ds.Tables[0].Rows[0]["Nickname"]!=null && ds.Tables[0].Rows[0]["Nickname"].ToString()!="")
         {
             model.Nickname=ds.Tables[0].Rows[0]["Nickname"].ToString();
         }
         if(ds.Tables[0].Rows[0]["Sex"]!=null && ds.Tables[0].Rows[0]["Sex"].ToString()!="")
         {
             model.Sex=ds.Tables[0].Rows[0]["Sex"].ToString();
         }
         if(ds.Tables[0].Rows[0]["Truename"]!=null && ds.Tables[0].Rows[0]["Truename"].ToString()!="")
         {
             model.Truename=ds.Tables[0].Rows[0]["Truename"].ToString();
         }
         if(ds.Tables[0].Rows[0]["Phone"]!=null && ds.Tables[0].Rows[0]["Phone"].ToString()!="")
         {
             model.Phone=ds.Tables[0].Rows[0]["Phone"].ToString();
         }
         if(ds.Tables[0].Rows[0]["E_mail"]!=null && ds.Tables[0].Rows[0]["E_mail"].ToString()!="")
         {
             model.E_mail=ds.Tables[0].Rows[0]["E_mail"].ToString();
         }
         if(ds.Tables[0].Rows[0]["Address"]!=null && ds.Tables[0].Rows[0]["Address"].ToString()!="")
         {
             model.Address=ds.Tables[0].Rows[0]["Address"].ToString();
         }
         if(ds.Tables[0].Rows[0]["Head_pic"]!=null && ds.Tables[0].Rows[0]["Head_pic"].ToString()!="")
         {
             model.Head_pic=ds.Tables[0].Rows[0]["Head_pic"].ToString();
         }
         if(ds.Tables[0].Rows[0]["Manage"]!=null && ds.Tables[0].Rows[0]["Manage"].ToString()!="")
         {
             model.Manage=int.Parse(ds.Tables[0].Rows[0]["Manage"].ToString());
         }
         if(ds.Tables[0].Rows[0]["Balance"]!=null && ds.Tables[0].Rows[0]["Balance"].ToString()!="")
         {
             model.Balance=int.Parse(ds.Tables[0].Rows[0]["Balance"].ToString());
         }
         return model;
     }
     else
     {
         return null;
     }
 }
Example #6
0
        /// <summary>
        /// 注册
        /// </summary>      
        protected void Button1_Click1(object sender, EventArgs e)
        {
            TtNum1.BLL.UserInfo BLLenroll = new TtNum1.BLL.UserInfo();
            TtNum1.Model.UserInfo Molenroll = new TtNum1.Model.UserInfo();
            string textbox = TextBox2.Text;
            string textbox2 = TextBox1.Text;
            //if (DALenroll.Add(Molenroll) > 0)
            //{

              if (TextBox1.Text == "")
               {
                   Page.ClientScript.RegisterStartupScript(this.GetType(), "alert", "<script>alert('帐号不能为空!');</script>");
               }
                else if (textbox2.IndexOfAny(System.IO.Path.GetInvalidFileNameChars()) >= 0  )
                {
                    Page.ClientScript.RegisterStartupScript(this.GetType(), "alert", "<script>alert('您输入的帐号包含非法字符请重新输入!');</script>");
                    TextBox1.Text = "";
                }
                else if (TextBox1.Text.Contains("'") || TextBox1.Text.Contains("~") ||TextBox1.Text.Contains("!") ||TextBox1.Text.Contains("@") ||TextBox1.Text.Contains("#") ||TextBox1.Text.Contains("$") ||TextBox1.Text.Contains("%") || TextBox1.Text.Contains("^") || TextBox1.Text.Contains("&") ||TextBox1.Text.Contains("*") ||TextBox1.Text.Contains("(") ||TextBox1.Text.Contains(")") || TextBox1.Text.Contains("——") ||TextBox1.Text.Contains("_") ||TextBox1.Text.Contains(";") ||TextBox1.Text.Contains(":") )
                {
                    Page.ClientScript.RegisterStartupScript(this.GetType(), "alert", "<script>alert('您输入的帐号包含非法字符请重新输入!');</script>");
                    TextBox1.Text = "";
                }
                else if (BLLenroll.judgeuser("[Username] = '" + TextBox1.Text + "'") != 0)
                {
                   Page.ClientScript.RegisterStartupScript(this.GetType(), "alert", "<script>alert('该账户已存在,请重新输入!');</script>");
                   TextBox1.Text = "";
                }
                else if (TextBox1.Text.Length > 12)
                {
                    Page.ClientScript.RegisterStartupScript(this.GetType(), "alert", "<script>alert('用户名的长度不得超过12个字!');</script>");
                    TextBox1.Text = "";
                }
                else if (TextBox2.Text == "")
                {
                    Page.ClientScript.RegisterStartupScript(this.GetType(), "alert", "<script>alert('密码不能为空!');</script>");
                }
                else if (textbox.IndexOfAny(System.IO.Path.GetInvalidFileNameChars()) >= 0)
                {
                    Page.ClientScript.RegisterStartupScript(this.GetType(), "alert", "<script>alert('您输入的密码包含非法字符请重新输入!');</script>");
                    TextBox2.Text = "";
                }
                else if (TextBox2.Text.Contains("'") || TextBox1.Text.Contains("~") || TextBox1.Text.Contains("!") || TextBox1.Text.Contains("@") || TextBox1.Text.Contains("#") || TextBox1.Text.Contains("$") || TextBox1.Text.Contains("%") || TextBox1.Text.Contains("^") || TextBox1.Text.Contains("&") || TextBox1.Text.Contains("*") || TextBox1.Text.Contains("(") || TextBox1.Text.Contains(")") || TextBox1.Text.Contains("——") || TextBox1.Text.Contains("_") || TextBox1.Text.Contains(";") || TextBox1.Text.Contains(":"))
                {
                    Page.ClientScript.RegisterStartupScript(this.GetType(), "alert", "<script>alert('您输入的密码包含非法字符请重新输入!');</script>");
                    TextBox1.Text = "";
                }
                else if (TextBox2.Text.Length > 18)
                {
                    Page.ClientScript.RegisterStartupScript(this.GetType(), "alert", "<script>alert('密码长度不能超过18个字符!');</script>");
                    TextBox2.Text = "";
                }
                else if (TextBox3.Text == "")
                {
                    Page.ClientScript.RegisterStartupScript(this.GetType(), "alert", "<script>alert('重复密码不能为空!');</script>");
                }

                else if (TextBox2.Text != TextBox3.Text)
                {
                    Page.ClientScript.RegisterStartupScript(this.GetType(), "alert", "<script>alert('两次输入密码不一样!');</script>");
                    TextBox2.Text = "";
                    TextBox3.Text = "";
                }
                else if (TextBox4.Text == "")
                {
                    Page.ClientScript.RegisterStartupScript(this.GetType(), "alert", "<script>alert('邮箱不能为空!');</script>");
                }
                  else if (BLLenroll.judgeuser("[E_mail] = '" + TextBox4.Text + "'") != 0)
                  {
                       Page.ClientScript.RegisterStartupScript(this.GetType(), "alert", "<script>alert('该邮箱已被注册!');</script>");
                       TextBox4.Text = "";
                  }
              else if (CheckBox1.Checked == false)
              {
                  Page.ClientScript.RegisterStartupScript(this.GetType(), "alert", "<script>alert('您还未同意团团用户注册协议!');</script>");
              }
              else
              {
                  Page.ClientScript.RegisterStartupScript(this.GetType(), "alert", "<script>alert('注册成功!');location.href='login.aspx';</script>");
                  Molenroll.Username = TextBox1.Text;
                  Molenroll.Password = TextBox2.Text;
                  Molenroll.E_mail = TextBox4.Text;
                  Molenroll.Head_pic = "../Userimg/header.png";
                  BLLenroll.Add(Molenroll);
              }
            //}
        }
Example #7
0
        protected void Editbtn_Click(object sender, EventArgs e)
        {
            moluserinfo = blluserinfo.GetModel(int.Parse(Request.Cookies["UID"].Value.ToString()));
            moluserinfo.Truename = textname.Text;
            moluserinfo.E_mail = textemail.Text;
            if (textnickname.Text.IndexOfAny(System.IO.Path.GetInvalidFileNameChars()) >= 0)
            {
                Page.ClientScript.RegisterStartupScript(this.GetType(), "alert", "<script>alert('您输入的昵称包含非法字符请重新输入!');</script>");
                textnickname.Text = "";
            }
            else if (textnickname.Text.Contains("'") || textnickname.Text.Contains("~") || textnickname.Text.Contains("!") || textnickname.Text.Contains("@") || textnickname.Text.Contains("#") || textnickname.Text.Contains("$") || textnickname.Text.Contains("%") || textnickname.Text.Contains("^") || textnickname.Text.Contains("&") || textnickname.Text.Contains("*") || textnickname.Text.Contains("(") || textnickname.Text.Contains(")") || textnickname.Text.Contains("——") || textnickname.Text.Contains("_") || textnickname.Text.Contains(";") || textnickname.Text.Contains(":"))
            {
                Page.ClientScript.RegisterStartupScript(this.GetType(), "alert", "<script>alert('您输入的昵称包含非法字符请重新输入!');</script>");
                textnickname.Text = "";
            }
            else
            {
                   moluserinfo.Nickname = textnickname.Text;
            }
            if (Radio1.Checked)
            {
                moluserinfo.Sex = Radio1.Value;

            }
            else if (Radio2.Checked)
            {
                moluserinfo.Sex = Radio2.Value;

            }

            if (gp.HasFile != false)
            {
                string fileType = System.IO.Path.GetExtension(gp.FileName).ToString().ToLower();
                if (fileType != ".jpg" && fileType != ".png" && fileType != ".gif")
                {
                    Response.Write("<script>alert('格式不正确!')</script>");
                    return;
                }
                string saveName = System.IO.Path.GetFileNameWithoutExtension(gp.FileName.ToString());
                string fileName = DateTime.Now.ToString("yyyyMMddHHmmss") + fileType;   //以时间格式重命名
                string filePath = "/GoodsImg/" + fileName;
                gp.SaveAs(Server.MapPath(filePath));
                Boolean fileOK = false;
                String path = Server.MapPath("~/GoodsImg/");

                //设置服务器上传的路径,即文件上传的位置
                if (gp.HasFile)
                {
                    String fileExtension = System.IO.Path.GetExtension(gp.FileName).ToLower();
                    String[] allowedExtensions = { ".gif", ".png", ".jpeg", ".jpg" };
                    for (int i = 0; i < allowedExtensions.Length; i++)
                    {
                        if (fileExtension == allowedExtensions[i])
                        {
                            fileOK = true;
                            Label24.Text = gp.FileName.ToString();
                            string FilePath = "/GoodsImg/" + Label24.Text;
                            gp.SaveAs(Server.MapPath(FilePath));
                            moluserinfo.Head_pic = FilePath;
                        }
                    }
                }
            }
             if (textphone.Text.Length != 0)
            {
                if (textphone.Text.Length != 11)
                {
                    Page.ClientScript.RegisterStartupScript(this.GetType(), "alert", "<script>alert('请输入正确的电话号码!');</script>");
                    textphone.Text = "";
                    return;
                }
                else if (textphone.Text.Length == 11)
                {
                    moluserinfo.Phone = textphone.Text.ToString();
                }
            }
            else if (textphone.Text.Length == 0)
            {
                moluserinfo.Phone = textphone.Text.ToString();
            }
                blluserinfo.Update(moluserinfo);
                Response.Write("<script>alert('更改成功!');parent.location.href=parent.location.href;</script>"); //刷新iframe 父页面和子页面返回父页面
                // Response.Write("<script>alert('更改成功!');window.parent.location='../PersonCenter.aspx';</script>");
                // Page.ClientScript.RegisterStartupScript(this.GetType(), "alert", "<script>alert('更改成功!');location.replace(location.href);</script>");
                //Response.Redirect(ViewState["retu"].ToString());
        }
Example #8
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         //ViewState["retu"] = Request.UrlReferrer.ToString();
         moluserinfo = blluserinfo.GetModel(int.Parse(Request.Cookies["UID"].Value.ToString()));
         lblusername.Text = moluserinfo.Username;
         textnickname.Text = moluserinfo.Nickname;
         textname.Text = moluserinfo.Truename;
         textphone.Text = moluserinfo.Phone;
         textemail.Text = moluserinfo.E_mail;
         imgDimensionalPic.ImageUrl = moluserinfo.Head_pic;
         if (moluserinfo.Sex == "男")
         {
             Radio1.Checked = true;
         }
         else
         {
             Radio2.Checked = true;
         }
     }
 }
Example #9
0
 public void dataload()
 {
     moluserinfo = blluserinfo.GetModel(int.Parse(Request.Cookies["UID"].Value.ToString()));
     headimg.ImageUrl = moluserinfo.Head_pic;
 }