protected void btnAdd_Click(object sender, EventArgs e)
        {
            string strErr = "";

            if (!PageValidate.IsDateTime(txtLoginTime.Text))
            {
                strErr += "LoginTime不是时间格式!\\n";
            }
            if (this.txtIP.Text == "")
            {
                strErr += "IP不能为空!\\n";
            }

            if (strErr != "")
            {
                MessageBox.Show(this, strErr);
                return;
            }
            DateTime LoginTime = DateTime.Parse(this.txtLoginTime.Text);
            string   IP        = this.txtIP.Text;


            NoName.NetShop.Model.LoginLogModel model = new NoName.NetShop.Model.LoginLogModel();
            model.LoginTime = LoginTime;
            model.IP        = IP;

            NoName.NetShop.BLL.LoginLogModelBll bll = new NoName.NetShop.BLL.LoginLogModelBll();
            bll.Update(model);
        }
        protected void btnAdd_Click(object sender, EventArgs e)
        {
            string strErr="";
            if(!PageValidate.IsDateTime(txtLoginTime.Text))
            {
            strErr+="LoginTime����ʱ���ʽ��\\n";
            }
            if(this.txtIP.Text =="")
            {
            strErr+="IP����Ϊ�գ�\\n";
            }

            if(strErr!="")
            {
            MessageBox.Show(this,strErr);
            return;
            }
            DateTime LoginTime=DateTime.Parse(this.txtLoginTime.Text);
            string IP=this.txtIP.Text;

            NoName.NetShop.Model.LoginLogModel model=new NoName.NetShop.Model.LoginLogModel();
            model.LoginTime=LoginTime;
            model.IP=IP;

            NoName.NetShop.BLL.LoginLogModelBll bll=new NoName.NetShop.BLL.LoginLogModelBll();
            bll.Update(model);
        }
Exemple #3
0
 private void ShowInfo(int UserId)
 {
     NoName.NetShop.BLL.LoginLogModelBll bll   = new NoName.NetShop.BLL.LoginLogModelBll();
     NoName.NetShop.Model.LoginLogModel  model = bll.GetModel(UserId);
     this.lblLoginTime.Text = model.LoginTime.ToString();
     this.lblIP.Text        = model.IP;
 }
Exemple #4
0
        /// <summary>
        ///  更新一条数据
        /// </summary>
        public void Update(NoName.NetShop.Model.LoginLogModel model)
        {
            Database  db        = DatabaseFactory.CreateDatabase();
            DbCommand dbCommand = db.GetStoredProcCommand("UP_umLoginLog_Update");

            db.AddInParameter(dbCommand, "UserId", DbType.Int32, model.UserId);
            db.AddInParameter(dbCommand, "LoginTime", DbType.DateTime, model.LoginTime);
            db.AddInParameter(dbCommand, "IP", DbType.AnsiString, model.IP);
            db.ExecuteNonQuery(dbCommand);
        }
Exemple #5
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public NoName.NetShop.Model.LoginLogModel GetModel(int UserId)
        {
            Database  db        = DatabaseFactory.CreateDatabase();
            DbCommand dbCommand = db.GetStoredProcCommand("UP_umLoginLog_GetModel");

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

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

            ojb = dataReader["UserId"];
            if (ojb != null && ojb != DBNull.Value)
            {
                model.UserId = (int)ojb;
            }
            ojb = dataReader["LoginTime"];
            if (ojb != null && ojb != DBNull.Value)
            {
                model.LoginTime = (DateTime)ojb;
            }
            model.IP = dataReader["IP"].ToString();
            return(model);
        }
 /// <summary>
 /// ����ʵ�������
 /// </summary>
 public NoName.NetShop.Model.LoginLogModel ReaderBind(IDataReader dataReader)
 {
     NoName.NetShop.Model.LoginLogModel model=new NoName.NetShop.Model.LoginLogModel();
     object ojb;
     ojb = dataReader["UserId"];
     if(ojb != null && ojb != DBNull.Value)
     {
         model.UserId=(int)ojb;
     }
     ojb = dataReader["LoginTime"];
     if(ojb != null && ojb != DBNull.Value)
     {
         model.LoginTime=(DateTime)ojb;
     }
     model.IP=dataReader["IP"].ToString();
     return model;
 }