Пример #1
0
 private void ShowInfo(int si_id)
 {
     WalleProject.BLL.t_systeminterchange   bll   = new WalleProject.BLL.t_systeminterchange();
     WalleProject.Model.t_systeminterchange model = bll.GetModel(si_id);
     this.txtsi_sort.Text     = model.si_sort.ToString();
     this.txtsi_vaild.Text    = model.si_vaild;
     this.txtsi_date.Text     = model.si_date.ToString();
     this.txtsi_content.Text  = model.si_content;
     this.txtsi_per_type.Text = model.si_per_type;
     this.txtsi_pic_id.Text   = model.si_pic_id.ToString();
     this.txtsi_per_id.Text   = model.si_per_id.ToString();
     this.txtsi_sl_id.Text    = model.si_sl_id.ToString();
     this.lblsi_id.Text       = model.si_id.ToString();
 }
Пример #2
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(WalleProject.Model.t_systeminterchange model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update t_systeminterchange set ");
            strSql.Append("si_sort=@si_sort,");
            strSql.Append("si_vaild=@si_vaild,");
            strSql.Append("si_date=@si_date,");
            strSql.Append("si_content=@si_content,");
            strSql.Append("si_per_type=@si_per_type,");
            strSql.Append("si_pic_id=@si_pic_id,");
            strSql.Append("si_per_id=@si_per_id,");
            strSql.Append("si_sl_id=@si_sl_id");
            strSql.Append(" where si_id=@si_id");
            MySqlParameter[] parameters =
            {
                new MySqlParameter("@si_sort",     MySqlDbType.Int32,     10),
                new MySqlParameter("@si_vaild",    MySqlDbType.VarChar,   20),
                new MySqlParameter("@si_date",     MySqlDbType.DateTime),
                new MySqlParameter("@si_content",  MySqlDbType.Text),
                new MySqlParameter("@si_per_type", MySqlDbType.VarChar,   20),
                new MySqlParameter("@si_pic_id",   MySqlDbType.Int32,     10),
                new MySqlParameter("@si_per_id",   MySqlDbType.Int32,     10),
                new MySqlParameter("@si_sl_id",    MySqlDbType.Int32,     10),
                new MySqlParameter("@si_id",       MySqlDbType.Int32, 10)
            };
            parameters[0].Value = model.si_sort;
            parameters[1].Value = model.si_vaild;
            parameters[2].Value = model.si_date;
            parameters[3].Value = model.si_content;
            parameters[4].Value = model.si_per_type;
            parameters[5].Value = model.si_pic_id;
            parameters[6].Value = model.si_per_id;
            parameters[7].Value = model.si_sl_id;
            parameters[8].Value = model.si_id;

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

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Пример #3
0
 /// <summary>
 /// 得到一个对象实体
 /// </summary>
 public WalleProject.Model.t_systeminterchange DataRowToModel(DataRow row)
 {
     WalleProject.Model.t_systeminterchange model = new WalleProject.Model.t_systeminterchange();
     if (row != null)
     {
         if (row["si_sort"] != null && row["si_sort"].ToString() != "")
         {
             model.si_sort = int.Parse(row["si_sort"].ToString());
         }
         if (row["si_vaild"] != null)
         {
             model.si_vaild = row["si_vaild"].ToString();
         }
         if (row["si_date"] != null && row["si_date"].ToString() != "")
         {
             model.si_date = DateTime.Parse(row["si_date"].ToString());
         }
         if (row["si_content"] != null)
         {
             model.si_content = row["si_content"].ToString();
         }
         if (row["si_per_type"] != null)
         {
             model.si_per_type = row["si_per_type"].ToString();
         }
         if (row["si_pic_id"] != null && row["si_pic_id"].ToString() != "")
         {
             model.si_pic_id = int.Parse(row["si_pic_id"].ToString());
         }
         if (row["si_per_id"] != null && row["si_per_id"].ToString() != "")
         {
             model.si_per_id = int.Parse(row["si_per_id"].ToString());
         }
         if (row["si_sl_id"] != null && row["si_sl_id"].ToString() != "")
         {
             model.si_sl_id = int.Parse(row["si_sl_id"].ToString());
         }
         if (row["si_id"] != null && row["si_id"].ToString() != "")
         {
             model.si_id = int.Parse(row["si_id"].ToString());
         }
     }
     return(model);
 }
Пример #4
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public WalleProject.Model.t_systeminterchange GetModel(int si_id)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select si_sort,si_vaild,si_date,si_content,si_per_type,si_pic_id,si_per_id,si_sl_id,si_id from t_systeminterchange ");
            strSql.Append(" where si_id=@si_id");
            MySqlParameter[] parameters =
            {
                new MySqlParameter("@si_id", MySqlDbType.Int32)
            };
            parameters[0].Value = si_id;

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

            if (ds.Tables[0].Rows.Count > 0)
            {
                return(DataRowToModel(ds.Tables[0].Rows[0]));
            }
            else
            {
                return(null);
            }
        }
Пример #5
0
        public void btnSave_Click(object sender, EventArgs e)
        {
            string strErr = "";

            if (!PageValidate.IsNumber(txtsi_sort.Text))
            {
                strErr += "si_sort格式错误!\\n";
            }
            if (this.txtsi_vaild.Text.Trim().Length == 0)
            {
                strErr += "si_vaild不能为空!\\n";
            }
            if (!PageValidate.IsDateTime(txtsi_date.Text))
            {
                strErr += "si_date格式错误!\\n";
            }
            if (this.txtsi_content.Text.Trim().Length == 0)
            {
                strErr += "si_content不能为空!\\n";
            }
            if (this.txtsi_per_type.Text.Trim().Length == 0)
            {
                strErr += "si_per_type不能为空!\\n";
            }
            if (!PageValidate.IsNumber(txtsi_pic_id.Text))
            {
                strErr += "si_pic_id格式错误!\\n";
            }
            if (!PageValidate.IsNumber(txtsi_per_id.Text))
            {
                strErr += "si_per_id格式错误!\\n";
            }
            if (!PageValidate.IsNumber(txtsi_sl_id.Text))
            {
                strErr += "si_sl_id格式错误!\\n";
            }

            if (strErr != "")
            {
                MessageBox.Show(this, strErr);
                return;
            }
            int      si_sort     = int.Parse(this.txtsi_sort.Text);
            string   si_vaild    = this.txtsi_vaild.Text;
            DateTime si_date     = DateTime.Parse(this.txtsi_date.Text);
            string   si_content  = this.txtsi_content.Text;
            string   si_per_type = this.txtsi_per_type.Text;
            int      si_pic_id   = int.Parse(this.txtsi_pic_id.Text);
            int      si_per_id   = int.Parse(this.txtsi_per_id.Text);
            int      si_sl_id    = int.Parse(this.txtsi_sl_id.Text);
            int      si_id       = int.Parse(this.lblsi_id.Text);


            WalleProject.Model.t_systeminterchange model = new WalleProject.Model.t_systeminterchange();
            model.si_sort     = si_sort;
            model.si_vaild    = si_vaild;
            model.si_date     = si_date;
            model.si_content  = si_content;
            model.si_per_type = si_per_type;
            model.si_pic_id   = si_pic_id;
            model.si_per_id   = si_per_id;
            model.si_sl_id    = si_sl_id;
            model.si_id       = si_id;

            WalleProject.BLL.t_systeminterchange bll = new WalleProject.BLL.t_systeminterchange();
            bll.Update(model);
            Maticsoft.Common.MessageBox.ShowAndRedirect(this, "保存成功!", "list.aspx");
        }