private void ShowInfo(int SchemeId, int CateId)
 {
     NoName.NetShop.BLL.RuleModelBll bll   = new NoName.NetShop.BLL.RuleModelBll();
     NoName.NetShop.Model.RuleModel  model = bll.GetModel(SchemeId, CateId);
     this.lblSchemeId.Text = model.SchemeId.ToString();
     this.lblCateId.Text   = model.CateId.ToString();
     this.txtRule.Text     = model.Rule;
 }
        /// <summary>
        ///  更新一条数据
        /// </summary>
        public void Update(NoName.NetShop.Model.RuleModel model)
        {
            Database  db        = DatabaseFactory.CreateDatabase();
            DbCommand dbCommand = db.GetStoredProcCommand("UP_ssRule_Update");

            db.AddInParameter(dbCommand, "SchemeId", DbType.Int32, model.SchemeId);
            db.AddInParameter(dbCommand, "CateId", DbType.Int32, model.CateId);
            db.AddInParameter(dbCommand, "Rule", DbType.AnsiString, model.Rule);
            db.ExecuteNonQuery(dbCommand);
        }
        /// <summary>
        /// 对象实体绑定数据
        /// </summary>
        public NoName.NetShop.Model.RuleModel ReaderBind(IDataReader dataReader)
        {
            NoName.NetShop.Model.RuleModel model = new NoName.NetShop.Model.RuleModel();
            object ojb;

            ojb = dataReader["SchemeId"];
            if (ojb != null && ojb != DBNull.Value)
            {
                model.SchemeId = (int)ojb;
            }
            ojb = dataReader["CateId"];
            if (ojb != null && ojb != DBNull.Value)
            {
                model.CateId = (int)ojb;
            }
            model.Rule = dataReader["Rule"].ToString();
            return(model);
        }
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public NoName.NetShop.Model.RuleModel GetModel(int SchemeId, int CateId)
        {
            Database  db        = DatabaseFactory.CreateDatabase();
            DbCommand dbCommand = db.GetStoredProcCommand("UP_ssRule_GetModel");

            db.AddInParameter(dbCommand, "SchemeId", DbType.Int32, SchemeId);
            db.AddInParameter(dbCommand, "CateId", DbType.Int32, CateId);

            NoName.NetShop.Model.RuleModel model = null;
            using (IDataReader dataReader = db.ExecuteReader(dbCommand))
            {
                if (dataReader.Read())
                {
                    model = ReaderBind(dataReader);
                }
            }
            return(model);
        }
        protected void btnAdd_Click(object sender, EventArgs e)
        {
            string strErr="";
            if(this.txtRule.Text =="")
            {
            strErr+="Rule����Ϊ�գ�\\n";
            }

            if(strErr!="")
            {
            MessageBox.Show(this,strErr);
            return;
            }
            string Rule=this.txtRule.Text;

            NoName.NetShop.Model.RuleModel model=new NoName.NetShop.Model.RuleModel();
            model.Rule=Rule;

            NoName.NetShop.BLL.RuleModelBll bll=new NoName.NetShop.BLL.RuleModelBll();
            bll.Add(model);
        }
        protected void btnAdd_Click(object sender, EventArgs e)
        {
            string strErr = "";

            if (this.txtRule.Text == "")
            {
                strErr += "Rule不能为空!\\n";
            }

            if (strErr != "")
            {
                MessageBox.Show(this, strErr);
                return;
            }
            string Rule = this.txtRule.Text;

            NoName.NetShop.Model.RuleModel model = new NoName.NetShop.Model.RuleModel();
            model.Rule = Rule;

            NoName.NetShop.BLL.RuleModelBll bll = new NoName.NetShop.BLL.RuleModelBll();
            bll.Add(model);
        }
 /// <summary>
 /// ����ʵ�������
 /// </summary>
 public NoName.NetShop.Model.RuleModel ReaderBind(IDataReader dataReader)
 {
     NoName.NetShop.Model.RuleModel model=new NoName.NetShop.Model.RuleModel();
     object ojb;
     ojb = dataReader["SchemeId"];
     if(ojb != null && ojb != DBNull.Value)
     {
         model.SchemeId=(int)ojb;
     }
     ojb = dataReader["CateId"];
     if(ojb != null && ojb != DBNull.Value)
     {
         model.CateId=(int)ojb;
     }
     model.Rule=dataReader["Rule"].ToString();
     return model;
 }