Beispiel #1
0
        public void btnSave_Click(object sender, EventArgs e)
        {
            string strErr = "";

            if (this.txtpicca_name.Text.Trim().Length == 0)
            {
                strErr += "picca_name不能为空!\\n";
            }

            if (strErr != "")
            {
                MessageBox.Show(this, strErr);
                return;
            }
            int    picca_ID   = int.Parse(this.lblpicca_ID.Text);
            string picca_name = this.txtpicca_name.Text;


            WalleProject.Model.t_picturecategory model = new WalleProject.Model.t_picturecategory();
            model.picca_ID   = picca_ID;
            model.picca_name = picca_name;

            WalleProject.BLL.t_picturecategory bll = new WalleProject.BLL.t_picturecategory();
            bll.Update(model);
            Maticsoft.Common.MessageBox.ShowAndRedirect(this, "保存成功!", "list.aspx");
        }
Beispiel #2
0
 private void ShowInfo(int picca_ID)
 {
     WalleProject.BLL.t_picturecategory   bll   = new WalleProject.BLL.t_picturecategory();
     WalleProject.Model.t_picturecategory model = bll.GetModel(picca_ID);
     this.lblpicca_ID.Text   = model.picca_ID.ToString();
     this.txtpicca_name.Text = model.picca_name;
 }
Beispiel #3
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(WalleProject.Model.t_picturecategory model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update t_picturecategory set ");
            strSql.Append("picca_name=@picca_name");
            strSql.Append(" where picca_ID=@picca_ID");
            MySqlParameter[] parameters =
            {
                new MySqlParameter("@picca_name", MySqlDbType.VarChar, 10),
                new MySqlParameter("@picca_ID",   MySqlDbType.Int32, 10)
            };
            parameters[0].Value = model.picca_name;
            parameters[1].Value = model.picca_ID;

            int rows = DbHelperMySQL.ExecuteSql(strSql.ToString(), parameters);

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Beispiel #4
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public bool Add(WalleProject.Model.t_picturecategory model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into t_picturecategory(");
            strSql.Append("picca_name)");
            strSql.Append(" values (");
            strSql.Append("@picca_name)");
            MySqlParameter[] parameters =
            {
                new MySqlParameter("@picca_name", MySqlDbType.VarChar, 10)
            };
            parameters[0].Value = model.picca_name;

            int rows = DbHelperMySQL.ExecuteSql(strSql.ToString(), parameters);

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Beispiel #5
0
 /// <summary>
 /// 得到一个对象实体
 /// </summary>
 public WalleProject.Model.t_picturecategory DataRowToModel(DataRow row)
 {
     WalleProject.Model.t_picturecategory model = new WalleProject.Model.t_picturecategory();
     if (row != null)
     {
         if (row["picca_ID"] != null && row["picca_ID"].ToString() != "")
         {
             model.picca_ID = int.Parse(row["picca_ID"].ToString());
         }
         if (row["picca_name"] != null)
         {
             model.picca_name = row["picca_name"].ToString();
         }
     }
     return(model);
 }
Beispiel #6
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public WalleProject.Model.t_picturecategory GetModel(int picca_ID)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select picca_ID,picca_name from t_picturecategory ");
            strSql.Append(" where picca_ID=@picca_ID");
            MySqlParameter[] parameters =
            {
                new MySqlParameter("@picca_ID", MySqlDbType.Int32)
            };
            parameters[0].Value = picca_ID;

            WalleProject.Model.t_picturecategory model = new WalleProject.Model.t_picturecategory();
            DataSet ds = DbHelperMySQL.Query(strSql.ToString(), parameters);

            if (ds.Tables[0].Rows.Count > 0)
            {
                return(DataRowToModel(ds.Tables[0].Rows[0]));
            }
            else
            {
                return(null);
            }
        }