Exemplo n.º 1
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(Jium.Model.systemparams model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update systemparams set ");
            strSql.Append("paramvalue=@paramvalue,");
            strSql.Append("remark=@remark,");
            strSql.Append("status=@status");
            strSql.Append(" where id=@id");
            MySqlParameter[] parameters =
            {
                new MySqlParameter("@paramvalue", MySqlDbType.VarChar, 256),
                new MySqlParameter("@remark",     MySqlDbType.VarChar, 100),
                new MySqlParameter("@status",     MySqlDbType.Int32,    11),
                new MySqlParameter("@id",         MySqlDbType.Int32,    11),
                new MySqlParameter("@paramname",  MySqlDbType.VarChar, 40)
            };
            parameters[0].Value = model.paramvalue;
            parameters[1].Value = model.remark;
            parameters[2].Value = model.status;
            parameters[3].Value = model.id;
            parameters[4].Value = model.paramname;

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

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

            strSql.Append("insert into systemparams(");
            strSql.Append("paramname,paramvalue,remark,status)");
            strSql.Append(" values (");
            strSql.Append("@paramname,@paramvalue,@remark,@status)");
            MySqlParameter[] parameters =
            {
                new MySqlParameter("@paramname",  MySqlDbType.VarChar,  40),
                new MySqlParameter("@paramvalue", MySqlDbType.VarChar, 256),
                new MySqlParameter("@remark",     MySqlDbType.VarChar, 100),
                new MySqlParameter("@status",     MySqlDbType.Int32, 11)
            };
            parameters[0].Value = model.paramname;
            parameters[1].Value = model.paramvalue;
            parameters[2].Value = model.remark;
            parameters[3].Value = model.status;

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

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Exemplo n.º 3
0
 /// <summary>
 /// 得到一个对象实体
 /// </summary>
 public Jium.Model.systemparams DataRowToModel(DataRow row)
 {
     Jium.Model.systemparams model = new Jium.Model.systemparams();
     if (row != null)
     {
         if (row["id"] != null && row["id"].ToString() != "")
         {
             model.id = int.Parse(row["id"].ToString());
         }
         if (row["paramname"] != null)
         {
             model.paramname = row["paramname"].ToString();
         }
         if (row["paramvalue"] != null)
         {
             model.paramvalue = row["paramvalue"].ToString();
         }
         if (row["remark"] != null)
         {
             model.remark = row["remark"].ToString();
         }
         if (row["status"] != null && row["status"].ToString() != "")
         {
             model.status = int.Parse(row["status"].ToString());
         }
     }
     return(model);
 }
Exemplo n.º 4
0
 private void ShowInfo(int id)
 {
     Jium.BLL.systemparams   bll   = new Jium.BLL.systemparams();
     Jium.Model.systemparams model = bll.GetModel(id);
     this.lblid.Text         = model.id.ToString();
     this.lblparamname.Text  = model.paramname;
     this.lblparamvalue.Text = model.paramvalue;
     this.lblremark.Text     = model.remark;
     this.lblstatus.Text     = model.status.ToString();
 }
Exemplo n.º 5
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            string strErr = "";

            if (this.txtparamname.Text.Trim().Length == 0)
            {
                strErr += "paramname不能为空!\\n";
            }
            if (this.txtparamvalue.Text.Trim().Length == 0)
            {
                strErr += "paramvalue不能为空!\\n";
            }
            if (this.txtremark.Text.Trim().Length == 0)
            {
                strErr += "remark不能为空!\\n";
            }
            if (!PageValidate.IsNumber(txtstatus.Text))
            {
                strErr += "status格式错误!\\n";
            }

            if (strErr != "")
            {
                MessageBox.Show(this, strErr);
                return;
            }
            string paramname  = this.txtparamname.Text;
            string paramvalue = this.txtparamvalue.Text;
            string remark     = this.txtremark.Text;
            int    status     = int.Parse(this.txtstatus.Text);

            Jium.Model.systemparams model = new Jium.Model.systemparams();
            model.paramname  = paramname;
            model.paramvalue = paramvalue;
            model.remark     = remark;
            model.status     = status;

            Jium.BLL.systemparams bll = new Jium.BLL.systemparams();
            bll.Add(model);
            Maticsoft.Common.MessageBox.ShowAndRedirect(this, "保存成功!", "add.aspx");
        }
Exemplo n.º 6
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public Jium.Model.systemparams GetModel(int id)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select id,paramname,paramvalue,remark,status from systemparams ");
            strSql.Append(" where id=@id");
            MySqlParameter[] parameters =
            {
                new MySqlParameter("@id", MySqlDbType.Int32)
            };
            parameters[0].Value = id;

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

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