/// <summary>
        /// 对象实体绑定数据
        /// </summary>
        public NoName.NetShop.Model.PagesModel ReaderBind(IDataReader dataReader)
        {
            NoName.NetShop.Model.PagesModel model = new NoName.NetShop.Model.PagesModel();
            object ojb;

            ojb = dataReader["PageId"];
            if (ojb != null && ojb != DBNull.Value)
            {
                model.PageId = (int)ojb;
            }
            model.TemplateFile = dataReader["TemplateFile"].ToString();
            model.PageUrl      = dataReader["PageUrl"].ToString();
            model.PagePhyPath  = dataReader["PagePhyPath"].ToString();
            ojb = dataReader["Status"];
            if (ojb != null && ojb != DBNull.Value)
            {
                model.Status = (int)ojb;
            }
            ojb = dataReader["LastPubTime"];
            if (ojb != null && ojb != DBNull.Value)
            {
                model.LastPubTime = (DateTime)ojb;
            }
            return(model);
        }
 private void ShowInfo()
 {
     NoName.NetShop.BLL.PagesModelBll bll   = new NoName.NetShop.BLL.PagesModelBll();
     NoName.NetShop.Model.PagesModel  model = bll.GetModel();
     this.txtPageId.Text       = model.PageId.ToString();
     this.txtTemplateFile.Text = model.TemplateFile;
     this.txtPageUrl.Text      = model.PageUrl;
     this.txtPagePhyPath.Text  = model.PagePhyPath;
     this.txtStatus.Text       = model.Status.ToString();
     this.txtLastPubTime.Text  = model.LastPubTime.ToString();
 }
        protected void btnAdd_Click(object sender, EventArgs e)
        {
            string strErr = "";

            if (!PageValidate.IsNumber(txtPageId.Text))
            {
                strErr += "PageId不是数字!\\n";
            }
            if (this.txtTemplateFile.Text == "")
            {
                strErr += "TemplateFile不能为空!\\n";
            }
            if (this.txtPageUrl.Text == "")
            {
                strErr += "PageUrl不能为空!\\n";
            }
            if (this.txtPagePhyPath.Text == "")
            {
                strErr += "PagePhyPath不能为空!\\n";
            }
            if (!PageValidate.IsNumber(txtStatus.Text))
            {
                strErr += "Status不是数字!\\n";
            }
            if (!PageValidate.IsDateTime(txtLastPubTime.Text))
            {
                strErr += "LastPubTime不是时间格式!\\n";
            }

            if (strErr != "")
            {
                MessageBox.Show(this, strErr);
                return;
            }
            int      PageId       = int.Parse(this.txtPageId.Text);
            string   TemplateFile = this.txtTemplateFile.Text;
            string   PageUrl      = this.txtPageUrl.Text;
            string   PagePhyPath  = this.txtPagePhyPath.Text;
            int      Status       = int.Parse(this.txtStatus.Text);
            DateTime LastPubTime  = DateTime.Parse(this.txtLastPubTime.Text);


            NoName.NetShop.Model.PagesModel model = new NoName.NetShop.Model.PagesModel();
            model.PageId       = PageId;
            model.TemplateFile = TemplateFile;
            model.PageUrl      = PageUrl;
            model.PagePhyPath  = PagePhyPath;
            model.Status       = Status;
            model.LastPubTime  = LastPubTime;

            NoName.NetShop.BLL.PagesModelBll bll = new NoName.NetShop.BLL.PagesModelBll();
            bll.Update(model);
        }
        /// <summary>
        ///  更新一条数据
        /// </summary>
        public void Update(NoName.NetShop.Model.PagesModel model)
        {
            Database  db        = DatabaseFactory.CreateDatabase();
            DbCommand dbCommand = db.GetStoredProcCommand("UP_cmsPages_Update");

            db.AddInParameter(dbCommand, "PageId", DbType.Int32, model.PageId);
            db.AddInParameter(dbCommand, "TemplateFile", DbType.AnsiString, model.TemplateFile);
            db.AddInParameter(dbCommand, "PageUrl", DbType.AnsiString, model.PageUrl);
            db.AddInParameter(dbCommand, "PagePhyPath", DbType.AnsiString, model.PagePhyPath);
            db.AddInParameter(dbCommand, "Status", DbType.Byte, model.Status);
            db.AddInParameter(dbCommand, "LastPubTime", DbType.DateTime, model.LastPubTime);
            db.ExecuteNonQuery(dbCommand);
        }
        protected void btnAdd_Click(object sender, EventArgs e)
        {
            string strErr="";
            if(!PageValidate.IsNumber(txtPageId.Text))
            {
            strErr+="PageId�������֣�\\n";
            }
            if(this.txtTemplateFile.Text =="")
            {
            strErr+="TemplateFile����Ϊ�գ�\\n";
            }
            if(this.txtPageUrl.Text =="")
            {
            strErr+="PageUrl����Ϊ�գ�\\n";
            }
            if(this.txtPagePhyPath.Text =="")
            {
            strErr+="PagePhyPath����Ϊ�գ�\\n";
            }
            if(!PageValidate.IsNumber(txtStatus.Text))
            {
            strErr+="Status�������֣�\\n";
            }
            if(!PageValidate.IsDateTime(txtLastPubTime.Text))
            {
            strErr+="LastPubTime����ʱ���ʽ��\\n";
            }

            if(strErr!="")
            {
            MessageBox.Show(this,strErr);
            return;
            }
            int PageId=int.Parse(this.txtPageId.Text);
            string TemplateFile=this.txtTemplateFile.Text;
            string PageUrl=this.txtPageUrl.Text;
            string PagePhyPath=this.txtPagePhyPath.Text;
            int Status=int.Parse(this.txtStatus.Text);
            DateTime LastPubTime=DateTime.Parse(this.txtLastPubTime.Text);

            NoName.NetShop.Model.PagesModel model=new NoName.NetShop.Model.PagesModel();
            model.PageId=PageId;
            model.TemplateFile=TemplateFile;
            model.PageUrl=PageUrl;
            model.PagePhyPath=PagePhyPath;
            model.Status=Status;
            model.LastPubTime=LastPubTime;

            NoName.NetShop.BLL.PagesModelBll bll=new NoName.NetShop.BLL.PagesModelBll();
            bll.Update(model);
        }
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public NoName.NetShop.Model.PagesModel GetModel()
        {
            Database  db        = DatabaseFactory.CreateDatabase();
            DbCommand dbCommand = db.GetStoredProcCommand("UP_cmsPages_GetModel");

            NoName.NetShop.Model.PagesModel model = null;
            using (IDataReader dataReader = db.ExecuteReader(dbCommand))
            {
                if (dataReader.Read())
                {
                    model = ReaderBind(dataReader);
                }
            }
            return(model);
        }
 /// <summary>
 /// ����ʵ�������
 /// </summary>
 public NoName.NetShop.Model.PagesModel ReaderBind(IDataReader dataReader)
 {
     NoName.NetShop.Model.PagesModel model=new NoName.NetShop.Model.PagesModel();
     object ojb;
     ojb = dataReader["PageId"];
     if(ojb != null && ojb != DBNull.Value)
     {
         model.PageId=(int)ojb;
     }
     model.TemplateFile=dataReader["TemplateFile"].ToString();
     model.PageUrl=dataReader["PageUrl"].ToString();
     model.PagePhyPath=dataReader["PagePhyPath"].ToString();
     ojb = dataReader["Status"];
     if(ojb != null && ojb != DBNull.Value)
     {
         model.Status=(int)ojb;
     }
     ojb = dataReader["LastPubTime"];
     if(ojb != null && ojb != DBNull.Value)
     {
         model.LastPubTime=(DateTime)ojb;
     }
     return model;
 }