/// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(WalleProject.Model.t_filecategory model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update t_filecategory set ");
            strSql.Append("filec_name=@filec_name,");
            strSql.Append("filec_path=@filec_path,");
            strSql.Append("file_ext=@file_ext");
            strSql.Append(" where filec_ID=@filec_ID");
            MySqlParameter[] parameters =
            {
                new MySqlParameter("@filec_name", MySqlDbType.VarChar, 10),
                new MySqlParameter("@filec_path", MySqlDbType.VarChar, 50),
                new MySqlParameter("@file_ext",   MySqlDbType.VarChar, 50),
                new MySqlParameter("@filec_ID",   MySqlDbType.Int32, 10)
            };
            parameters[0].Value = model.filec_name;
            parameters[1].Value = model.filec_path;
            parameters[2].Value = model.file_ext;
            parameters[3].Value = model.filec_ID;

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

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

            strSql.Append("insert into t_filecategory(");
            strSql.Append("filec_name,filec_path,file_ext)");
            strSql.Append(" values (");
            strSql.Append("@filec_name,@filec_path,@file_ext)");
            MySqlParameter[] parameters =
            {
                new MySqlParameter("@filec_name", MySqlDbType.VarChar, 10),
                new MySqlParameter("@filec_path", MySqlDbType.VarChar, 50),
                new MySqlParameter("@file_ext",   MySqlDbType.VarChar, 50)
            };
            parameters[0].Value = model.filec_name;
            parameters[1].Value = model.filec_path;
            parameters[2].Value = model.file_ext;

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

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Beispiel #3
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            string strErr = "";

            if (this.txtfilec_name.Text.Trim().Length == 0)
            {
                strErr += "filec_name不能为空!\\n";
            }
            if (this.txtfilec_path.Text.Trim().Length == 0)
            {
                strErr += "filec_path不能为空!\\n";
            }
            if (this.txtfile_ext.Text.Trim().Length == 0)
            {
                strErr += "file_ext不能为空!\\n";
            }

            if (strErr != "")
            {
                MessageBox.Show(this, strErr);
                return;
            }
            string filec_name = this.txtfilec_name.Text;
            string filec_path = this.txtfilec_path.Text;
            string file_ext   = this.txtfile_ext.Text;

            WalleProject.Model.t_filecategory model = new WalleProject.Model.t_filecategory();
            model.filec_name = filec_name;
            model.filec_path = filec_path;
            model.file_ext   = file_ext;

            WalleProject.BLL.t_filecategory bll = new WalleProject.BLL.t_filecategory();
            bll.Add(model);
            Maticsoft.Common.MessageBox.ShowAndRedirect(this, "保存成功!", "add.aspx");
        }
Beispiel #4
0
 private void ShowInfo(int filec_ID)
 {
     WalleProject.BLL.t_filecategory   bll   = new WalleProject.BLL.t_filecategory();
     WalleProject.Model.t_filecategory model = bll.GetModel(filec_ID);
     this.lblfilec_ID.Text   = model.filec_ID.ToString();
     this.lblfilec_name.Text = model.filec_name;
     this.lblfilec_path.Text = model.filec_path;
     this.lblfile_ext.Text   = model.file_ext;
 }
Beispiel #5
0
        public void btnSave_Click(object sender, EventArgs e)
        {
            string strErr = "";

            if (this.txtfilec_name.Text.Trim().Length == 0)
            {
                strErr += "文件名不能为空!\\n";
            }
            if (this.txtfilec_path.Text.Trim().Length == 0)
            {
                strErr += "文件类型不能为空!\\n";
            }
            if (this.txtfile_ext.Text.Trim().Length == 0)
            {
                strErr += "文件后缀不能为空!\\n";
            }

            if (strErr != "")
            {
                MessageBox.Show(this, strErr);
                return;
            }
            int    filec_ID   = int.Parse(this.lblfilec_ID.Text);
            string filec_name = this.txtfilec_name.Text;
            string filec_path = this.txtfilec_path.Text;
            string file_ext   = this.txtfile_ext.Text;


            WalleProject.Model.t_filecategory model = new WalleProject.Model.t_filecategory();
            model.filec_ID   = filec_ID;
            model.filec_name = filec_name;
            model.filec_path = filec_path;
            model.file_ext   = file_ext;

            WalleProject.BLL.t_filecategory bll = new WalleProject.BLL.t_filecategory();
            bll.Update(model);
            Maticsoft.Common.MessageBox.ShowAndRedirect(this, "保存成功!", "list.aspx");
        }
 /// <summary>
 /// 得到一个对象实体
 /// </summary>
 public WalleProject.Model.t_filecategory DataRowToModel(DataRow row)
 {
     WalleProject.Model.t_filecategory model = new WalleProject.Model.t_filecategory();
     if (row != null)
     {
         if (row["filec_ID"] != null && row["filec_ID"].ToString() != "")
         {
             model.filec_ID = int.Parse(row["filec_ID"].ToString());
         }
         if (row["filec_name"] != null)
         {
             model.filec_name = row["filec_name"].ToString();
         }
         if (row["filec_path"] != null)
         {
             model.filec_path = row["filec_path"].ToString();
         }
         if (row["file_ext"] != null)
         {
             model.file_ext = row["file_ext"].ToString();
         }
     }
     return(model);
 }
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public WalleProject.Model.t_filecategory GetModel(int filec_ID)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select filec_ID,filec_name,filec_path,file_ext from t_filecategory ");
            strSql.Append(" where filec_ID=@filec_ID");
            MySqlParameter[] parameters =
            {
                new MySqlParameter("@filec_ID", MySqlDbType.Int32)
            };
            parameters[0].Value = filec_ID;

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

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