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

            strSql.Append("update xsddan set ");
            strSql.Append("rq=@rq,");
            strSql.Append("cpmc=@cpmc,");
            strSql.Append("cs=@cs,");
            strSql.Append("dwei=@dwei,");
            strSql.Append("dj=@dj,");
            strSql.Append("jine=@jine,");
            strSql.Append("danwei=@danwei,");
            strSql.Append("jsr=@jsr,");
            strSql.Append("ddbh=@ddbh,");
            strSql.Append("djbh=@djbh,");
            strSql.Append("bz=@bz");
            strSql.Append(" where xh=@xh");
            MySqlParameter[] parameters =
            {
                new MySqlParameter("@rq",     MySqlDbType.DateTime),
                new MySqlParameter("@cpmc",   MySqlDbType.VarChar,   64),
                new MySqlParameter("@cs",     MySqlDbType.Int32,     64),
                new MySqlParameter("@dwei",   MySqlDbType.Int32,     64),
                new MySqlParameter("@dj",     MySqlDbType.Int32,     64),
                new MySqlParameter("@jine",   MySqlDbType.Int32,     64),
                new MySqlParameter("@danwei", MySqlDbType.VarChar,   64),
                new MySqlParameter("@jsr",    MySqlDbType.VarChar,   64),
                new MySqlParameter("@ddbh",   MySqlDbType.VarChar,   64),
                new MySqlParameter("@djbh",   MySqlDbType.VarChar,   64),
                new MySqlParameter("@bz",     MySqlDbType.VarChar,   64),
                new MySqlParameter("@xh",     MySqlDbType.Int32, 64)
            };
            parameters[0].Value  = model.rq;
            parameters[1].Value  = model.cpmc;
            parameters[2].Value  = model.cs;
            parameters[3].Value  = model.dwei;
            parameters[4].Value  = model.dj;
            parameters[5].Value  = model.jine;
            parameters[6].Value  = model.danwei;
            parameters[7].Value  = model.jsr;
            parameters[8].Value  = model.ddbh;
            parameters[9].Value  = model.djbh;
            parameters[10].Value = model.bz;
            parameters[11].Value = model.xh;

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

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Ejemplo n.º 2
0
 /// <summary>
 /// 得到一个对象实体
 /// </summary>
 public Maticsoft.Model.cccc.xsddan DataRowToModel(DataRow row)
 {
     Maticsoft.Model.cccc.xsddan model = new Maticsoft.Model.cccc.xsddan();
     if (row != null)
     {
         if (row["xh"] != null && row["xh"].ToString() != "")
         {
             model.xh = int.Parse(row["xh"].ToString());
         }
         if (row["rq"] != null && row["rq"].ToString() != "")
         {
             model.rq = DateTime.Parse(row["rq"].ToString());
         }
         if (row["cpmc"] != null)
         {
             model.cpmc = row["cpmc"].ToString();
         }
         if (row["cs"] != null && row["cs"].ToString() != "")
         {
             model.cs = int.Parse(row["cs"].ToString());
         }
         if (row["dwei"] != null && row["dwei"].ToString() != "")
         {
             model.dwei = int.Parse(row["dwei"].ToString());
         }
         if (row["dj"] != null && row["dj"].ToString() != "")
         {
             model.dj = int.Parse(row["dj"].ToString());
         }
         if (row["jine"] != null && row["jine"].ToString() != "")
         {
             model.jine = int.Parse(row["jine"].ToString());
         }
         if (row["danwei"] != null)
         {
             model.danwei = row["danwei"].ToString();
         }
         if (row["jsr"] != null)
         {
             model.jsr = row["jsr"].ToString();
         }
         if (row["ddbh"] != null)
         {
             model.ddbh = row["ddbh"].ToString();
         }
         if (row["djbh"] != null)
         {
             model.djbh = row["djbh"].ToString();
         }
         if (row["bz"] != null)
         {
             model.bz = row["bz"].ToString();
         }
     }
     return(model);
 }
Ejemplo n.º 3
0
 private void ShowInfo(int xh)
 {
     Maticsoft.BLL.cccc.xsddan   bll   = new Maticsoft.BLL.cccc.xsddan();
     Maticsoft.Model.cccc.xsddan model = bll.GetModel(xh);
     this.lblxh.Text     = model.xh.ToString();
     this.txtrq.Text     = model.rq.ToString();
     this.txtcpmc.Text   = model.cpmc;
     this.txtcs.Text     = model.cs.ToString();
     this.txtdwei.Text   = model.dwei.ToString();
     this.txtdj.Text     = model.dj.ToString();
     this.txtjine.Text   = model.jine.ToString();
     this.txtdanwei.Text = model.danwei;
     this.txtjsr.Text    = model.jsr;
     this.txtddbh.Text   = model.ddbh;
     this.txtdjbh.Text   = model.djbh;
     this.txtbz.Text     = model.bz;
 }
Ejemplo n.º 4
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public bool Add(Maticsoft.Model.cccc.xsddan model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into xsddan(");
            strSql.Append("rq,cpmc,cs,dwei,dj,jine,danwei,jsr,ddbh,djbh,bz)");
            strSql.Append(" values (");
            strSql.Append("@rq,@cpmc,@cs,@dwei,@dj,@jine,@danwei,@jsr,@ddbh,@djbh,@bz)");
            MySqlParameter[] parameters =
            {
                new MySqlParameter("@rq",     MySqlDbType.DateTime),
                new MySqlParameter("@cpmc",   MySqlDbType.VarChar,   64),
                new MySqlParameter("@cs",     MySqlDbType.Int32,     64),
                new MySqlParameter("@dwei",   MySqlDbType.Int32,     64),
                new MySqlParameter("@dj",     MySqlDbType.Int32,     64),
                new MySqlParameter("@jine",   MySqlDbType.Int32,     64),
                new MySqlParameter("@danwei", MySqlDbType.VarChar,   64),
                new MySqlParameter("@jsr",    MySqlDbType.VarChar,   64),
                new MySqlParameter("@ddbh",   MySqlDbType.VarChar,   64),
                new MySqlParameter("@djbh",   MySqlDbType.VarChar,   64),
                new MySqlParameter("@bz",     MySqlDbType.VarChar, 64)
            };
            parameters[0].Value  = model.rq;
            parameters[1].Value  = model.cpmc;
            parameters[2].Value  = model.cs;
            parameters[3].Value  = model.dwei;
            parameters[4].Value  = model.dj;
            parameters[5].Value  = model.jine;
            parameters[6].Value  = model.danwei;
            parameters[7].Value  = model.jsr;
            parameters[8].Value  = model.ddbh;
            parameters[9].Value  = model.djbh;
            parameters[10].Value = model.bz;

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

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Ejemplo n.º 5
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public Maticsoft.Model.cccc.xsddan GetModel(int xh)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select xh,rq,cpmc,cs,dwei,dj,jine,danwei,jsr,ddbh,djbh,bz from xsddan ");
            strSql.Append(" where xh=@xh");
            MySqlParameter[] parameters =
            {
                new MySqlParameter("@xh", MySqlDbType.Int32)
            };
            parameters[0].Value = xh;

            Maticsoft.Model.cccc.xsddan model = new Maticsoft.Model.cccc.xsddan();
            DataSet ds = DbHelperMySQL.Query(strSql.ToString(), parameters);

            if (ds.Tables[0].Rows.Count > 0)
            {
                return(DataRowToModel(ds.Tables[0].Rows[0]));
            }
            else
            {
                return(null);
            }
        }
Ejemplo n.º 6
0
        public void btnSave_Click(object sender, EventArgs e)
        {
            string strErr = "";

            if (!PageValidate.IsDateTime(txtrq.Text))
            {
                strErr += "rq格式错误!\\n";
            }
            if (this.txtcpmc.Text.Trim().Length == 0)
            {
                strErr += "cpmc不能为空!\\n";
            }
            if (!PageValidate.IsNumber(txtcs.Text))
            {
                strErr += "cs格式错误!\\n";
            }
            if (!PageValidate.IsNumber(txtdwei.Text))
            {
                strErr += "dwei格式错误!\\n";
            }
            if (!PageValidate.IsNumber(txtdj.Text))
            {
                strErr += "dj格式错误!\\n";
            }
            if (!PageValidate.IsNumber(txtjine.Text))
            {
                strErr += "jine格式错误!\\n";
            }
            if (this.txtdanwei.Text.Trim().Length == 0)
            {
                strErr += "danwei不能为空!\\n";
            }
            if (this.txtjsr.Text.Trim().Length == 0)
            {
                strErr += "jsr不能为空!\\n";
            }
            if (this.txtddbh.Text.Trim().Length == 0)
            {
                strErr += "ddbh不能为空!\\n";
            }
            if (this.txtdjbh.Text.Trim().Length == 0)
            {
                strErr += "djbh不能为空!\\n";
            }
            if (this.txtbz.Text.Trim().Length == 0)
            {
                strErr += "bz不能为空!\\n";
            }

            if (strErr != "")
            {
                MessageBox.Show(this, strErr);
                return;
            }
            int      xh     = int.Parse(this.lblxh.Text);
            DateTime rq     = DateTime.Parse(this.txtrq.Text);
            string   cpmc   = this.txtcpmc.Text;
            int      cs     = int.Parse(this.txtcs.Text);
            int      dwei   = int.Parse(this.txtdwei.Text);
            int      dj     = int.Parse(this.txtdj.Text);
            int      jine   = int.Parse(this.txtjine.Text);
            string   danwei = this.txtdanwei.Text;
            string   jsr    = this.txtjsr.Text;
            string   ddbh   = this.txtddbh.Text;
            string   djbh   = this.txtdjbh.Text;
            string   bz     = this.txtbz.Text;


            Maticsoft.Model.cccc.xsddan model = new Maticsoft.Model.cccc.xsddan();
            model.xh     = xh;
            model.rq     = rq;
            model.cpmc   = cpmc;
            model.cs     = cs;
            model.dwei   = dwei;
            model.dj     = dj;
            model.jine   = jine;
            model.danwei = danwei;
            model.jsr    = jsr;
            model.ddbh   = ddbh;
            model.djbh   = djbh;
            model.bz     = bz;

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