Ejemplo n.º 1
0
 private void ShowInfo(int ProductId, int ParaId)
 {
     NoName.NetShop.BLL.ProductParaModelBll bll   = new NoName.NetShop.BLL.ProductParaModelBll();
     NoName.NetShop.Model.ProductParaModel  model = bll.GetModel(ProductId, ParaId);
     this.lblProductId.Text = model.ProductId.ToString();
     this.lblParaId.Text    = model.ParaId.ToString();
     this.txtParaValue.Text = model.ParaValue;
 }
Ejemplo n.º 2
0
        /// <summary>
        ///  更新一条数据
        /// </summary>
        public void Update(NoName.NetShop.Model.ProductParaModel model)
        {
            Database  db        = DatabaseFactory.CreateDatabase();
            DbCommand dbCommand = db.GetStoredProcCommand("UP_pdProductPara_Update");

            db.AddInParameter(dbCommand, "ProductId", DbType.Int32, model.ProductId);
            db.AddInParameter(dbCommand, "ParaId", DbType.Int32, model.ParaId);
            db.AddInParameter(dbCommand, "ParaValue", DbType.AnsiString, model.ParaValue);
            db.ExecuteNonQuery(dbCommand);
        }
Ejemplo n.º 3
0
        /// <summary>
        /// 对象实体绑定数据
        /// </summary>
        public NoName.NetShop.Model.ProductParaModel ReaderBind(IDataReader dataReader)
        {
            NoName.NetShop.Model.ProductParaModel model = new NoName.NetShop.Model.ProductParaModel();
            object ojb;

            ojb = dataReader["ProductId"];
            if (ojb != null && ojb != DBNull.Value)
            {
                model.ProductId = (int)ojb;
            }
            ojb = dataReader["ParaId"];
            if (ojb != null && ojb != DBNull.Value)
            {
                model.ParaId = (int)ojb;
            }
            model.ParaValue = dataReader["ParaValue"].ToString();
            return(model);
        }
Ejemplo n.º 4
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public NoName.NetShop.Model.ProductParaModel GetModel(int ProductId, int ParaId)
        {
            Database  db        = DatabaseFactory.CreateDatabase();
            DbCommand dbCommand = db.GetStoredProcCommand("UP_pdProductPara_GetModel");

            db.AddInParameter(dbCommand, "ProductId", DbType.Int32, ProductId);
            db.AddInParameter(dbCommand, "ParaId", DbType.Int32, ParaId);

            NoName.NetShop.Model.ProductParaModel 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.txtParaValue.Text =="")
            {
            strErr+="ParaValue����Ϊ�գ�\\n";
            }

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

            NoName.NetShop.Model.ProductParaModel model=new NoName.NetShop.Model.ProductParaModel();
            model.ParaValue=ParaValue;

            NoName.NetShop.BLL.ProductParaModelBll bll=new NoName.NetShop.BLL.ProductParaModelBll();
            bll.Update(model);
        }
Ejemplo n.º 6
0
        protected void btnAdd_Click(object sender, EventArgs e)
        {
            string strErr = "";

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

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

            NoName.NetShop.Model.ProductParaModel model = new NoName.NetShop.Model.ProductParaModel();
            model.ParaValue = ParaValue;

            NoName.NetShop.BLL.ProductParaModelBll bll = new NoName.NetShop.BLL.ProductParaModelBll();
            bll.Add(model);
        }
 /// <summary>
 /// ����ʵ�������
 /// </summary>
 public NoName.NetShop.Model.ProductParaModel ReaderBind(IDataReader dataReader)
 {
     NoName.NetShop.Model.ProductParaModel model=new NoName.NetShop.Model.ProductParaModel();
     object ojb;
     ojb = dataReader["ProductId"];
     if(ojb != null && ojb != DBNull.Value)
     {
         model.ProductId=(int)ojb;
     }
     ojb = dataReader["ParaId"];
     if(ojb != null && ojb != DBNull.Value)
     {
         model.ParaId=(int)ojb;
     }
     model.ParaValue=dataReader["ParaValue"].ToString();
     return model;
 }