Example #1
0
 protected void btnok_Click(object sender, EventArgs e)
 {
     Maticsoft.BLL.MemberInfo   menbll   = new Maticsoft.BLL.MemberInfo();
     Maticsoft.Model.MemberInfo menmodel = menbll.GetModel(1);
     if (txtname.Text.Trim() == "")
     {
         lblusername.Text = "请填写用户名";
         return;
     }
     menmodel.MemberName = txtname.Text.Trim();
     lblusername.Text    = "";
     if (txtpass.Text.Trim() == "")
     {
         lblpass.Text = "请填写密码";
         return;
     }
     if (txtpassord.Text.Trim() == "")
     {
         lblpassword.Text = "请填写确认密码";
         return;
     }
     if (txtpass.Text.Trim() != menmodel.Password)
     {
         lblpass.Text = "您的旧密码输入不正确";
         return;
     }
     menmodel.Password = txtpassord.Text.Trim();
     lblpass.Text      = "";
     lblpassword.Text  = "";
     if (drpsex.SelectedIndex == 0)
     {
         lblsex.Text = "请选择您的性别";
     }
     else if (drpsex.SelectedIndex == 1)
     {
         menmodel.Sex = 1;
     }
     else
     {
         menmodel.Sex = 0;
     }
     if (txtlinkphoto.Text.Trim() == "")
     {
         lblLinkphoto.Text = "请填写联系电话";
         return;
     }
     menmodel.Linkphoto = txtlinkphoto.Text.Trim();
     lblLinkphoto.Text  = "";
     if (txtemail.Text.Trim() == "")
     {
         lblemail.Text = "请填写电子邮箱";
         return;
     }
     menmodel.Email = txtemail.Text.Trim();
     lblemail.Text  = "";
     menmodel.QQMSN = txtqq.Text.Trim();
     menbll.Update(menmodel);
     Page.ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert('信息添加成功!')</script>");
     bind();
 }
Example #2
0
 private void bind()
 {
     try
     {
         Maticsoft.BLL.MemberInfo menbll = new Maticsoft.BLL.MemberInfo();
         string usernamr = Session["usename"].ToString();
         string name     = Server.UrlDecode(usernamr);
         Maticsoft.Model.MemberInfo menmodel1 = menbll.GetpassModel(name);
         int menid = int.Parse(menmodel1.MemberID.ToString());
         Maticsoft.Model.MemberInfo menmodel = menbll.GetModel(menid);
         txtemail.Text     = menmodel.Email;
         txtlinkphoto.Text = menmodel.Linkphoto;
         txtname.Text      = menmodel.MemberName;
         txtqq.Text        = menmodel.QQMSN;
         if (menmodel.Sex == 1)
         {
             drpsex.SelectedIndex = 1;
         }
         else
         {
             drpsex.SelectedIndex = 2;
         }
     }
     catch (Exception ex) {
         Page.ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert('发生错误:" + ex.Message + "')</script>");
     }
 }
Example #3
0
        protected void ImageButton1_Click(object sender, ImageClickEventArgs e)
        {
            if (txtyan.Text.Trim() != lblyanzheng.Text)
            {
                lblyan.Text = "验证码不正确";
                return;
            }
            string usename = txtusename.Text.Trim();
            string pass    = txtpass.Text.Trim();

            Maticsoft.BLL.MemberInfo   menbll   = new Maticsoft.BLL.MemberInfo();
            Maticsoft.Model.MemberInfo menmodel = menbll.GetpassModel(usename);
            if (menbll.GetExists(usename) == true)
            {
                if (pass != menmodel.Password)
                {
                    lblpass.Text = "密码不正确";
                    return;
                }
                else
                {
                    string urlendel = Server.UrlEncode(usename);
                    Session["usename"] = urlendel;
                    Response.Redirect("main.aspx");
                }
            }
            else
            {
                lblusename.Text = "该用户不存在";
            }
        }
Example #4
0
 private void ShowInfo(int MemberID)
 {
     Maticsoft.BLL.MemberInfo   bll   = new Maticsoft.BLL.MemberInfo();
     Maticsoft.Model.MemberInfo model = bll.GetModel(MemberID);
     this.lblMemberID.Text   = model.MemberID.ToString();
     this.txtMemberName.Text = model.MemberName;
     this.txtPassword.Text   = model.Password;
     this.chkSex.Checked     = model.Sex;
     this.txtLinkphoto.Text  = model.Linkphoto;
     this.txtEmail.Text      = model.Email;
     this.txtQQMSN.Text      = model.QQMSN;
 }
Example #5
0
 private void ShowInfo(int MemberID)
 {
     Maticsoft.BLL.MemberInfo   bll   = new Maticsoft.BLL.MemberInfo();
     Maticsoft.Model.MemberInfo model = bll.GetModel(MemberID);
     this.lblMemberID.Text   = model.MemberID.ToString();
     this.lblMemberName.Text = model.MemberName;
     this.lblPassword.Text   = model.Password;
     this.lblSex.Text        = model.Sex?"ÊÇ":"·ñ";
     this.lblLinkphoto.Text  = model.Linkphoto;
     this.lblEmail.Text      = model.Email;
     this.lblQQMSN.Text      = model.QQMSN;
 }
Example #6
0
        public void btnSave_Click(object sender, EventArgs e)
        {
            string strErr = "";

            if (this.txtMemberName.Text.Trim().Length == 0)
            {
                strErr += "MemberName不能为空!\\n";
            }
            if (this.txtPassword.Text.Trim().Length == 0)
            {
                strErr += "Password不能为空!\\n";
            }
            if (this.txtLinkphoto.Text.Trim().Length == 0)
            {
                strErr += "Linkphoto不能为空!\\n";
            }
            if (this.txtEmail.Text.Trim().Length == 0)
            {
                strErr += "Email不能为空!\\n";
            }
            if (this.txtQQMSN.Text.Trim().Length == 0)
            {
                strErr += "QQMSN不能为空!\\n";
            }

            if (strErr != "")
            {
                MessageBox.Show(this, strErr);
                return;
            }
            int    MemberID   = int.Parse(this.lblMemberID.Text);
            string MemberName = this.txtMemberName.Text;
            string Password   = this.txtPassword.Text;
            bool   Sex        = this.chkSex.Checked;
            string Linkphoto  = this.txtLinkphoto.Text;
            string Email      = this.txtEmail.Text;
            string QQMSN      = this.txtQQMSN.Text;


            Maticsoft.Model.MemberInfo model = new Maticsoft.Model.MemberInfo();
            model.MemberID   = MemberID;
            model.MemberName = MemberName;
            model.Password   = Password;
            model.Sex        = Sex;
            model.Linkphoto  = Linkphoto;
            model.Email      = Email;
            model.QQMSN      = QQMSN;

            Maticsoft.BLL.MemberInfo bll = new Maticsoft.BLL.MemberInfo();
            bll.Update(model);
            Maticsoft.Common.MessageBox.ShowAndRedirect(this, "保存成功!", "list.aspx");
        }
Example #7
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(Maticsoft.Model.MemberInfo model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update MemberInfo set ");
            strSql.Append("MemberName=@MemberName,");
            strSql.Append("Password=@Password,");
            strSql.Append("Sex=@Sex,");
            strSql.Append("Linkphoto=@Linkphoto,");
            strSql.Append("Email=@Email,");
            strSql.Append("QQMSN=@QQMSN");
            strSql.Append(" where MemberID=@MemberID");
            SqlParameter[] parameters =
            {
                new SqlParameter("@MemberID",   SqlDbType.Int,       4),
                new SqlParameter("@MemberName", SqlDbType.VarChar, 200),
                new SqlParameter("@Password",   SqlDbType.VarChar, 200),
                new SqlParameter("@Sex",        SqlDbType.Int,       4),
                new SqlParameter("@Linkphoto",  SqlDbType.VarChar, 200),
                new SqlParameter("@Email",      SqlDbType.VarChar, 200),
                new SqlParameter("@QQMSN",      SqlDbType.VarChar, 200)
            };
            parameters[0].Value = model.MemberID;
            parameters[1].Value = model.MemberName;
            parameters[2].Value = model.Password;
            parameters[3].Value = model.Sex;
            parameters[4].Value = model.Linkphoto;
            parameters[5].Value = model.Email;
            parameters[6].Value = model.QQMSN;

            int rows = DbHelperSQL.ExecuteSql(strSql.ToString(), parameters);

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Example #8
0
        private void bind()
        {
            Maticsoft.BLL.MemberInfo menbll = new Maticsoft.BLL.MemberInfo();
            string usernamr = Session["usename"].ToString();
            string name     = Server.UrlDecode(usernamr);

            Maticsoft.Model.MemberInfo menmodel1 = menbll.GetpassModel(name);
            int menid = int.Parse(menmodel1.MemberID.ToString());

            Maticsoft.Model.MemberInfo menmodel = menbll.GetModel(menid);
            txtemail.Text     = menmodel.Email;
            txtlinkphoto.Text = menmodel.Linkphoto;
            txtname.Text      = menmodel.MemberName;
            txtqq.Text        = menmodel.QQMSN;
            if (menmodel.Sex == 1)
            {
                drpsex.SelectedIndex = 1;
            }
            else
            {
                drpsex.SelectedIndex = 2;
            }
        }
Example #9
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public Maticsoft.Model.MemberInfo GetModel(int MemberID)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select  top 1 MemberID,MemberName,Password,Sex,Linkphoto,Email,QQMSN from MemberInfo ");
            strSql.Append(" where MemberID=@MemberID");
            SqlParameter[] parameters =
            {
                new SqlParameter("@MemberID", SqlDbType.Int, 4)
            };
            parameters[0].Value = MemberID;

            Maticsoft.Model.MemberInfo model = new Maticsoft.Model.MemberInfo();
            DataSet ds = DbHelperSQL.Query(strSql.ToString(), parameters);

            if (ds.Tables[0].Rows.Count > 0)
            {
                if (ds.Tables[0].Rows[0]["MemberID"].ToString() != "")
                {
                    model.MemberID = int.Parse(ds.Tables[0].Rows[0]["MemberID"].ToString());
                }
                model.MemberName = ds.Tables[0].Rows[0]["MemberName"].ToString();
                model.Password   = ds.Tables[0].Rows[0]["Password"].ToString();
                if (ds.Tables[0].Rows[0]["Sex"].ToString() != "")
                {
                    model.Sex = int.Parse(ds.Tables[0].Rows[0]["Sex"].ToString());
                }
                model.Linkphoto = ds.Tables[0].Rows[0]["Linkphoto"].ToString();
                model.Email     = ds.Tables[0].Rows[0]["Email"].ToString();
                model.QQMSN     = ds.Tables[0].Rows[0]["QQMSN"].ToString();
                return(model);
            }
            else
            {
                return(null);
            }
        }
Example #10
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public int Add(Maticsoft.Model.MemberInfo model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into MemberInfo(");
            strSql.Append("MemberName,Password,Sex,Linkphoto,Email,QQMSN)");
            strSql.Append(" values (");
            strSql.Append("@MemberName,@Password,@Sex,@Linkphoto,@Email,@QQMSN)");
            strSql.Append(";select @@IDENTITY");
            SqlParameter[] parameters =
            {
                new SqlParameter("@MemberName", SqlDbType.VarChar, 200),
                new SqlParameter("@Password",   SqlDbType.VarChar, 200),
                new SqlParameter("@Sex",        SqlDbType.Int,       4),
                new SqlParameter("@Linkphoto",  SqlDbType.VarChar, 200),
                new SqlParameter("@Email",      SqlDbType.VarChar, 200),
                new SqlParameter("@QQMSN",      SqlDbType.VarChar, 200)
            };
            parameters[0].Value = model.MemberName;
            parameters[1].Value = model.Password;
            parameters[2].Value = model.Sex;
            parameters[3].Value = model.Linkphoto;
            parameters[4].Value = model.Email;
            parameters[5].Value = model.QQMSN;

            object obj = DbHelperSQL.GetSingle(strSql.ToString(), parameters);

            if (obj == null)
            {
                return(0);
            }
            else
            {
                return(Convert.ToInt32(obj));
            }
        }