コード例 #1
0
 private void ShowInfo(int UserId)
 {
     NoName.NetShop.BLL.MemberModelBll bll   = new NoName.NetShop.BLL.MemberModelBll();
     NoName.NetShop.Model.MemberModel  model = bll.GetModel(UserId);
     this.lblUserEmail.Text    = model.UserEmail;
     this.lblPassword.Text     = model.Password;
     this.lblNickName.Text     = model.NickName;
     this.lblAllScore.Text     = model.AllScore.ToString();
     this.lblCurScore.Text     = model.CurScore.ToString();
     this.lblLastLogin.Text    = model.LastLogin.ToString();
     this.lblLoginIP.Text      = model.LoginIP;
     this.lblRegisterTime.Text = model.RegisterTime.ToString();
     this.lblModifyTime.Text   = model.ModifyTime.ToString();
 }
コード例 #2
0
        /// <summary>
        ///  更新一条数据
        /// </summary>
        public void Update(NoName.NetShop.Model.MemberModel model)
        {
            Database  db        = DatabaseFactory.CreateDatabase();
            DbCommand dbCommand = db.GetStoredProcCommand("UP_umMember_Update");

            db.AddInParameter(dbCommand, "UserId", DbType.Int32, model.UserId);
            db.AddInParameter(dbCommand, "UserEmail", DbType.AnsiString, model.UserEmail);
            db.AddInParameter(dbCommand, "Password", DbType.AnsiString, model.Password);
            db.AddInParameter(dbCommand, "NickName", DbType.AnsiString, model.NickName);
            db.AddInParameter(dbCommand, "AllScore", DbType.Int32, model.AllScore);
            db.AddInParameter(dbCommand, "CurScore", DbType.Int32, model.CurScore);
            db.AddInParameter(dbCommand, "LastLogin", DbType.DateTime, model.LastLogin);
            db.AddInParameter(dbCommand, "LoginIP", DbType.AnsiString, model.LoginIP);
            db.AddInParameter(dbCommand, "RegisterTime", DbType.DateTime, model.RegisterTime);
            db.AddInParameter(dbCommand, "ModifyTime", DbType.DateTime, model.ModifyTime);
            db.ExecuteNonQuery(dbCommand);
        }
コード例 #3
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public NoName.NetShop.Model.MemberModel GetModel(int UserId)
        {
            Database  db        = DatabaseFactory.CreateDatabase();
            DbCommand dbCommand = db.GetStoredProcCommand("UP_umMember_GetModel");

            db.AddInParameter(dbCommand, "UserId", DbType.Int32, UserId);

            NoName.NetShop.Model.MemberModel model = null;
            using (IDataReader dataReader = db.ExecuteReader(dbCommand))
            {
                if (dataReader.Read())
                {
                    model = ReaderBind(dataReader);
                }
            }
            return(model);
        }
コード例 #4
0
        /// <summary>
        /// 对象实体绑定数据
        /// </summary>
        public NoName.NetShop.Model.MemberModel ReaderBind(IDataReader dataReader)
        {
            NoName.NetShop.Model.MemberModel model = new NoName.NetShop.Model.MemberModel();
            object ojb;

            ojb = dataReader["UserId"];
            if (ojb != null && ojb != DBNull.Value)
            {
                model.UserId = (int)ojb;
            }
            model.UserEmail = dataReader["UserEmail"].ToString();
            model.Password  = dataReader["Password"].ToString();
            model.NickName  = dataReader["NickName"].ToString();
            ojb             = dataReader["AllScore"];
            if (ojb != null && ojb != DBNull.Value)
            {
                model.AllScore = (int)ojb;
            }
            ojb = dataReader["CurScore"];
            if (ojb != null && ojb != DBNull.Value)
            {
                model.CurScore = (int)ojb;
            }
            ojb = dataReader["LastLogin"];
            if (ojb != null && ojb != DBNull.Value)
            {
                model.LastLogin = (DateTime)ojb;
            }
            model.LoginIP = dataReader["LoginIP"].ToString();
            ojb           = dataReader["RegisterTime"];
            if (ojb != null && ojb != DBNull.Value)
            {
                model.RegisterTime = (DateTime)ojb;
            }
            ojb = dataReader["ModifyTime"];
            if (ojb != null && ojb != DBNull.Value)
            {
                model.ModifyTime = (DateTime)ojb;
            }
            return(model);
        }
コード例 #5
0
        protected void btnAdd_Click(object sender, EventArgs e)
        {
            string strErr="";
            if(this.txtUserEmail.Text =="")
            {
            strErr+="UserEmail����Ϊ�գ�\\n";
            }
            if(this.txtPassword.Text =="")
            {
            strErr+="Password����Ϊ�գ�\\n";
            }
            if(this.txtNickName.Text =="")
            {
            strErr+="NickName����Ϊ�գ�\\n";
            }
            if(!PageValidate.IsNumber(txtAllScore.Text))
            {
            strErr+="AllScore�������֣�\\n";
            }
            if(!PageValidate.IsNumber(txtCurScore.Text))
            {
            strErr+="CurScore�������֣�\\n";
            }
            if(!PageValidate.IsDateTime(txtLastLogin.Text))
            {
            strErr+="LastLogin����ʱ���ʽ��\\n";
            }
            if(this.txtLoginIP.Text =="")
            {
            strErr+="LoginIP����Ϊ�գ�\\n";
            }
            if(!PageValidate.IsDateTime(txtRegisterTime.Text))
            {
            strErr+="RegisterTime����ʱ���ʽ��\\n";
            }
            if(!PageValidate.IsDateTime(txtModifyTime.Text))
            {
            strErr+="ModifyTime����ʱ���ʽ��\\n";
            }

            if(strErr!="")
            {
            MessageBox.Show(this,strErr);
            return;
            }
            string UserEmail=this.txtUserEmail.Text;
            string Password=this.txtPassword.Text;
            string NickName=this.txtNickName.Text;
            int AllScore=int.Parse(this.txtAllScore.Text);
            int CurScore=int.Parse(this.txtCurScore.Text);
            DateTime LastLogin=DateTime.Parse(this.txtLastLogin.Text);
            string LoginIP=this.txtLoginIP.Text;
            DateTime RegisterTime=DateTime.Parse(this.txtRegisterTime.Text);
            DateTime ModifyTime=DateTime.Parse(this.txtModifyTime.Text);

            NoName.NetShop.Model.MemberModel model=new NoName.NetShop.Model.MemberModel();
            model.UserEmail=UserEmail;
            model.Password=Password;
            model.NickName=NickName;
            model.AllScore=AllScore;
            model.CurScore=CurScore;
            model.LastLogin=LastLogin;
            model.LoginIP=LoginIP;
            model.RegisterTime=RegisterTime;
            model.ModifyTime=ModifyTime;

            NoName.NetShop.BLL.MemberModelBll bll=new NoName.NetShop.BLL.MemberModelBll();
            bll.Update(model);
        }
コード例 #6
0
 /// <summary>
 /// ����ʵ�������
 /// </summary>
 public NoName.NetShop.Model.MemberModel ReaderBind(IDataReader dataReader)
 {
     NoName.NetShop.Model.MemberModel model=new NoName.NetShop.Model.MemberModel();
     object ojb;
     ojb = dataReader["UserId"];
     if(ojb != null && ojb != DBNull.Value)
     {
         model.UserId=(int)ojb;
     }
     model.UserEmail=dataReader["UserEmail"].ToString();
     model.Password=dataReader["Password"].ToString();
     model.NickName=dataReader["NickName"].ToString();
     ojb = dataReader["AllScore"];
     if(ojb != null && ojb != DBNull.Value)
     {
         model.AllScore=(int)ojb;
     }
     ojb = dataReader["CurScore"];
     if(ojb != null && ojb != DBNull.Value)
     {
         model.CurScore=(int)ojb;
     }
     ojb = dataReader["LastLogin"];
     if(ojb != null && ojb != DBNull.Value)
     {
         model.LastLogin=(DateTime)ojb;
     }
     model.LoginIP=dataReader["LoginIP"].ToString();
     ojb = dataReader["RegisterTime"];
     if(ojb != null && ojb != DBNull.Value)
     {
         model.RegisterTime=(DateTime)ojb;
     }
     ojb = dataReader["ModifyTime"];
     if(ojb != null && ojb != DBNull.Value)
     {
         model.ModifyTime=(DateTime)ojb;
     }
     return model;
 }
コード例 #7
0
        protected void btnAdd_Click(object sender, EventArgs e)
        {
            string strErr = "";

            if (this.txtUserEmail.Text == "")
            {
                strErr += "UserEmail不能为空!\\n";
            }
            if (this.txtPassword.Text == "")
            {
                strErr += "Password不能为空!\\n";
            }
            if (this.txtNickName.Text == "")
            {
                strErr += "NickName不能为空!\\n";
            }
            if (!PageValidate.IsNumber(txtAllScore.Text))
            {
                strErr += "AllScore不是数字!\\n";
            }
            if (!PageValidate.IsNumber(txtCurScore.Text))
            {
                strErr += "CurScore不是数字!\\n";
            }
            if (!PageValidate.IsDateTime(txtLastLogin.Text))
            {
                strErr += "LastLogin不是时间格式!\\n";
            }
            if (this.txtLoginIP.Text == "")
            {
                strErr += "LoginIP不能为空!\\n";
            }
            if (!PageValidate.IsDateTime(txtRegisterTime.Text))
            {
                strErr += "RegisterTime不是时间格式!\\n";
            }
            if (!PageValidate.IsDateTime(txtModifyTime.Text))
            {
                strErr += "ModifyTime不是时间格式!\\n";
            }

            if (strErr != "")
            {
                MessageBox.Show(this, strErr);
                return;
            }
            string   UserEmail    = this.txtUserEmail.Text;
            string   Password     = this.txtPassword.Text;
            string   NickName     = this.txtNickName.Text;
            int      AllScore     = int.Parse(this.txtAllScore.Text);
            int      CurScore     = int.Parse(this.txtCurScore.Text);
            DateTime LastLogin    = DateTime.Parse(this.txtLastLogin.Text);
            string   LoginIP      = this.txtLoginIP.Text;
            DateTime RegisterTime = DateTime.Parse(this.txtRegisterTime.Text);
            DateTime ModifyTime   = DateTime.Parse(this.txtModifyTime.Text);

            NoName.NetShop.Model.MemberModel model = new NoName.NetShop.Model.MemberModel();
            model.UserEmail    = UserEmail;
            model.Password     = Password;
            model.NickName     = NickName;
            model.AllScore     = AllScore;
            model.CurScore     = CurScore;
            model.LastLogin    = LastLogin;
            model.LoginIP      = LoginIP;
            model.RegisterTime = RegisterTime;
            model.ModifyTime   = ModifyTime;

            NoName.NetShop.BLL.MemberModelBll bll = new NoName.NetShop.BLL.MemberModelBll();
            bll.Add(model);
        }