Example #1
0
        protected void btnAdd_Click(object sender, EventArgs e)
        {
            string BrandId    = this.txtBrandId.Text;
            string Name       = this.txtName.Text;
            string Descn      = this.txtDescn.Text;
            string CategoryId = DropCategory.SelectedValue;


            Maticsoft.Model.Brand model = new Maticsoft.Model.Brand();
            model.BrandId    = BrandId;
            model.Name       = Name;
            model.Descn      = Descn;
            model.CategoryId = CategoryId;
            Maticsoft.BLL.Products.Brand bll = new Maticsoft.BLL.Products.Brand();
            if (bll.Exists(BrandId))
            {
                lblMsg.Visible = true;
                lblMsg.Text    = "±àºÅÒѾ­´æÔÚ£¡";
            }
            else
            {
                bll.Add(model);
                if (chkAddContinue.Checked)
                {
                    Response.Redirect("Add.aspx");
                }
                else
                {
                    Response.Redirect("index.aspx");
                }
            }
        }
Example #2
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public Maticsoft.Model.Brand GetModel(string BrandId)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select * from P_Brand ");
            strSql.Append(" where BrandId=@BrandId");
            SqlParameter[] parameters =
            {
                new SqlParameter("@BrandId", SqlDbType.VarChar)
            };
            parameters[0].Value = BrandId;
            Maticsoft.Model.Brand model = new Maticsoft.Model.Brand();
            DataSet ds = DbHelperSQL.Query(strSql.ToString(), parameters);

            model.BrandId = BrandId;
            if (ds.Tables[0].Rows.Count > 0)
            {
                model.Name       = ds.Tables[0].Rows[0]["Name"].ToString();
                model.Descn      = ds.Tables[0].Rows[0]["Descn"].ToString();
                model.CategoryId = ds.Tables[0].Rows[0]["CategoryId"].ToString();

                return(model);
            }
            else
            {
                return(null);
            }
        }
Example #3
0
        protected void btnAdd_Click(object sender, EventArgs e)
        {
            string BrandId = this.txtBrandId.Text;
            string Name = this.txtName.Text;
            string Descn = this.txtDescn.Text;
            string CategoryId = DropCategory.SelectedValue;


            Maticsoft.Model.Brand model = new Maticsoft.Model.Brand();
            model.BrandId = BrandId;
            model.Name = Name;
            model.Descn = Descn;
            model.CategoryId = CategoryId;
            Maticsoft.BLL.Products.Brand bll = new Maticsoft.BLL.Products.Brand();
            if (bll.Exists(BrandId))
            {
                lblMsg.Visible = true;
                lblMsg.Text = "±àºÅÒѾ­´æÔÚ£¡";
            }
            else
            {
                bll.Add(model);
                if (chkAddContinue.Checked)
                {
                    Response.Redirect("Add.aspx");
                }
                else
                {
                    Response.Redirect("index.aspx");
                }
            }

        }
Example #4
0
 private void ShowInfo(string BrandId)
 {
     Maticsoft.BLL.Products.Brand bll   = new Maticsoft.BLL.Products.Brand();
     Maticsoft.Model.Brand        model = bll.GetModel(BrandId);
     this.lblBrandId.Text = model.BrandId;
     this.txtName.Text    = model.Name;
     this.txtDescn.Text   = model.Descn;
     this.Label1.Text     = model.CategoryId;
 }
Example #5
0
        protected void btnAdd_Click(object sender, EventArgs e)
        {
            string BrandId = this.lblBrandId.Text;
            string Name = this.txtName.Text;
            string Descn = this.txtDescn.Text;

            Maticsoft.Model.Brand model = new Maticsoft.Model.Brand();
            model.CategoryId = Label1.Text;
            model.BrandId = BrandId;
            model.Name = Name;
            model.Descn = Descn;

            Maticsoft.BLL.Products.Brand bll = new Maticsoft.BLL.Products.Brand();
            bll.Update(model);
            Response.Redirect("index.aspx");
        }
Example #6
0
        protected void btnAdd_Click(object sender, EventArgs e)
        {
            string BrandId = this.lblBrandId.Text;
            string Name    = this.txtName.Text;
            string Descn   = this.txtDescn.Text;



            Maticsoft.Model.Brand model = new Maticsoft.Model.Brand();
            model.CategoryId = Label1.Text;
            model.BrandId    = BrandId;
            model.Name       = Name;
            model.Descn      = Descn;

            Maticsoft.BLL.Products.Brand bll = new Maticsoft.BLL.Products.Brand();
            bll.Update(model);
            Response.Redirect("index.aspx");
        }
Example #7
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public void Add(Maticsoft.Model.Brand model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into P_Brand(");
            strSql.Append("BrandId,Name,Descn,CategoryId)");
            strSql.Append(" values (");
            strSql.Append("@BrandId,@Name,@Descn,@CategoryId)");
            SqlParameter[] parameters =
            {
                new SqlParameter("@BrandId",    SqlDbType.VarChar,  20),
                new SqlParameter("@Name",       SqlDbType.VarChar,  80),
                new SqlParameter("@Descn",      SqlDbType.VarChar, 255),
                new SqlParameter("@CategoryId", SqlDbType.VarChar, 20)
            };
            parameters[0].Value = model.BrandId;
            parameters[1].Value = model.Name;
            parameters[2].Value = model.Descn;
            parameters[3].Value = model.CategoryId;

            DbHelperSQL.ExecuteSql(strSql.ToString(), parameters);
        }
Example #8
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public void Update(Maticsoft.Model.Brand model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update P_Brand set ");
            strSql.Append("Name=@Name,");
            strSql.Append("Descn=@Descn,");
            strSql.Append("CategoryId=@CategoryId");
            strSql.Append(" where BrandId=@BrandId");
            SqlParameter[] parameters =
            {
                new SqlParameter("@Name",       SqlDbType.VarChar,  80),
                new SqlParameter("@Descn",      SqlDbType.VarChar, 255),
                new SqlParameter("@BrandId",    SqlDbType.VarChar,  20),
                new SqlParameter("@CategoryId", SqlDbType.VarChar, 20)
            };
            parameters[0].Value = model.Name;
            parameters[1].Value = model.Descn;
            parameters[2].Value = model.BrandId;
            parameters[3].Value = model.CategoryId;

            DbHelperSQL.ExecuteSql(strSql.ToString(), parameters);
        }
Example #9
0
        /// <summary>
        /// �õ�һ������ʵ��
        /// </summary>
        public Maticsoft.Model.Brand GetModel(string BrandId)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("select * from P_Brand ");
            strSql.Append(" where BrandId=@BrandId");
            SqlParameter[] parameters = {
                    new SqlParameter("@BrandId", SqlDbType.VarChar)};
            parameters[0].Value = BrandId;
            Maticsoft.Model.Brand model = new Maticsoft.Model.Brand();
            DataSet ds = DbHelperSQL.Query(strSql.ToString(), parameters);
            model.BrandId = BrandId;
            if (ds.Tables[0].Rows.Count > 0)
            {
                model.Name = ds.Tables[0].Rows[0]["Name"].ToString();
                model.Descn = ds.Tables[0].Rows[0]["Descn"].ToString();
                model.CategoryId = ds.Tables[0].Rows[0]["CategoryId"].ToString();

                return model;
            }
            else
            {
                return null;
            }
        }