Пример #1
0
        protected void btnAdd_Click(object sender, EventArgs e)
        {
            string strErr="";
            if(this.txtActionName.Text =="")
            {
            strErr+="ActionName����Ϊ�գ�\\n";
            }
            if(!PageValidate.IsDateTime(txtActionTime.Text))
            {
            strErr+="ActionTime����ʱ���ʽ��\\n";
            }
            if(this.txtRemark.Text =="")
            {
            strErr+="Remark����Ϊ�գ�\\n";
            }

            if(strErr!="")
            {
            MessageBox.Show(this,strErr);
            return;
            }
            string ActionName=this.txtActionName.Text;
            DateTime ActionTime=DateTime.Parse(this.txtActionTime.Text);
            string Remark=this.txtRemark.Text;

            NoName.NetShop.Model.UserActionLogModel model=new NoName.NetShop.Model.UserActionLogModel();
            model.ActionName=ActionName;
            model.ActionTime=ActionTime;
            model.Remark=Remark;

            NoName.NetShop.BLL.UserActionLogModelBll bll=new NoName.NetShop.BLL.UserActionLogModelBll();
            bll.Add(model);
        }
Пример #2
0
        protected void btnAdd_Click(object sender, EventArgs e)
        {
            string strErr = "";

            if (this.txtActionName.Text == "")
            {
                strErr += "ActionName不能为空!\\n";
            }
            if (!PageValidate.IsDateTime(txtActionTime.Text))
            {
                strErr += "ActionTime不是时间格式!\\n";
            }
            if (this.txtRemark.Text == "")
            {
                strErr += "Remark不能为空!\\n";
            }

            if (strErr != "")
            {
                MessageBox.Show(this, strErr);
                return;
            }
            string   ActionName = this.txtActionName.Text;
            DateTime ActionTime = DateTime.Parse(this.txtActionTime.Text);
            string   Remark     = this.txtRemark.Text;

            NoName.NetShop.Model.UserActionLogModel model = new NoName.NetShop.Model.UserActionLogModel();
            model.ActionName = ActionName;
            model.ActionTime = ActionTime;
            model.Remark     = Remark;

            NoName.NetShop.BLL.UserActionLogModelBll bll = new NoName.NetShop.BLL.UserActionLogModelBll();
            bll.Add(model);
        }
Пример #3
0
 private void ShowInfo(int UserId)
 {
     NoName.NetShop.BLL.UserActionLogModelBll bll   = new NoName.NetShop.BLL.UserActionLogModelBll();
     NoName.NetShop.Model.UserActionLogModel  model = bll.GetModel(UserId);
     this.lblActionName.Text = model.ActionName;
     this.lblActionTime.Text = model.ActionTime.ToString();
     this.lblRemark.Text     = model.Remark;
 }
        /// <summary>
        ///  更新一条数据
        /// </summary>
        public void Update(NoName.NetShop.Model.UserActionLogModel model)
        {
            Database  db        = DatabaseFactory.CreateDatabase();
            DbCommand dbCommand = db.GetStoredProcCommand("UP_maUserActionLog_Update");

            db.AddInParameter(dbCommand, "UserId", DbType.Int32, model.UserId);
            db.AddInParameter(dbCommand, "ActionName", DbType.AnsiString, model.ActionName);
            db.AddInParameter(dbCommand, "ActionTime", DbType.DateTime, model.ActionTime);
            db.AddInParameter(dbCommand, "Remark", DbType.AnsiString, model.Remark);
            db.ExecuteNonQuery(dbCommand);
        }
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public NoName.NetShop.Model.UserActionLogModel GetModel(int UserId)
        {
            Database  db        = DatabaseFactory.CreateDatabase();
            DbCommand dbCommand = db.GetStoredProcCommand("UP_maUserActionLog_GetModel");

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

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

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