コード例 #1
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public bool Add(Maticsoft.Model.cccc.xsdan model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into xsdan(");
            strSql.Append("cpmc,cs,dunw,dj,je,bz,danw,jsr,ddbh,djbh,shijian,skfs,skjine,ye)");
            strSql.Append(" values (");
            strSql.Append("@cpmc,@cs,@dunw,@dj,@je,@bz,@danw,@jsr,@ddbh,@djbh,@shijian,@skfs,@skjine,@ye)");
            MySqlParameter[] parameters =
            {
                new MySqlParameter("@cpmc",    MySqlDbType.VarChar,   64),
                new MySqlParameter("@cs",      MySqlDbType.Int32,     64),
                new MySqlParameter("@dunw",    MySqlDbType.Int32,     64),
                new MySqlParameter("@dj",      MySqlDbType.Int32,     64),
                new MySqlParameter("@je",      MySqlDbType.Int32,     64),
                new MySqlParameter("@bz",      MySqlDbType.VarChar,   64),
                new MySqlParameter("@danw",    MySqlDbType.VarChar,   64),
                new MySqlParameter("@jsr",     MySqlDbType.VarChar,   64),
                new MySqlParameter("@ddbh",    MySqlDbType.VarChar,   64),
                new MySqlParameter("@djbh",    MySqlDbType.VarChar,   64),
                new MySqlParameter("@shijian", MySqlDbType.DateTime),
                new MySqlParameter("@skfs",    MySqlDbType.VarChar,   64),
                new MySqlParameter("@skjine",  MySqlDbType.Int32,     64),
                new MySqlParameter("@ye",      MySqlDbType.Int32, 64)
            };
            parameters[0].Value  = model.cpmc;
            parameters[1].Value  = model.cs;
            parameters[2].Value  = model.dunw;
            parameters[3].Value  = model.dj;
            parameters[4].Value  = model.je;
            parameters[5].Value  = model.bz;
            parameters[6].Value  = model.danw;
            parameters[7].Value  = model.jsr;
            parameters[8].Value  = model.ddbh;
            parameters[9].Value  = model.djbh;
            parameters[10].Value = model.shijian;
            parameters[11].Value = model.skfs;
            parameters[12].Value = model.skjine;
            parameters[13].Value = model.ye;

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

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
コード例 #2
0
ファイル: Show.aspx.cs プロジェクト: hubeizys/NepslidingTools
 private void ShowInfo(int id)
 {
     Maticsoft.BLL.cccc.xsdan   bll   = new Maticsoft.BLL.cccc.xsdan();
     Maticsoft.Model.cccc.xsdan model = bll.GetModel(id);
     this.lblid.Text      = model.id.ToString();
     this.lblcpmc.Text    = model.cpmc;
     this.lblcs.Text      = model.cs.ToString();
     this.lbldunw.Text    = model.dunw.ToString();
     this.lbldj.Text      = model.dj.ToString();
     this.lblje.Text      = model.je.ToString();
     this.lblbz.Text      = model.bz;
     this.lbldanw.Text    = model.danw;
     this.lbljsr.Text     = model.jsr;
     this.lblddbh.Text    = model.ddbh;
     this.lbldjbh.Text    = model.djbh;
     this.lblshijian.Text = model.shijian.ToString();
     this.lblskfs.Text    = model.skfs;
     this.lblskjine.Text  = model.skjine.ToString();
     this.lblye.Text      = model.ye.ToString();
 }
コード例 #3
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public Maticsoft.Model.cccc.xsdan GetModel(int id)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select id,cpmc,cs,dunw,dj,je,bz,danw,jsr,ddbh,djbh,shijian,skfs,skjine,ye from xsdan ");
            strSql.Append(" where id=@id");
            MySqlParameter[] parameters =
            {
                new MySqlParameter("@id", MySqlDbType.Int32)
            };
            parameters[0].Value = id;

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

            if (ds.Tables[0].Rows.Count > 0)
            {
                return(DataRowToModel(ds.Tables[0].Rows[0]));
            }
            else
            {
                return(null);
            }
        }
コード例 #4
0
        public void btnSave_Click(object sender, EventArgs e)
        {
            string strErr = "";

            if (this.txtcpmc.Text.Trim().Length == 0)
            {
                strErr += "cpmc不能为空!\\n";
            }
            if (!PageValidate.IsNumber(txtcs.Text))
            {
                strErr += "cs格式错误!\\n";
            }
            if (!PageValidate.IsNumber(txtdunw.Text))
            {
                strErr += "dunw格式错误!\\n";
            }
            if (!PageValidate.IsNumber(txtdj.Text))
            {
                strErr += "dj格式错误!\\n";
            }
            if (!PageValidate.IsNumber(txtje.Text))
            {
                strErr += "je格式错误!\\n";
            }
            if (this.txtbz.Text.Trim().Length == 0)
            {
                strErr += "bz不能为空!\\n";
            }
            if (this.txtdanw.Text.Trim().Length == 0)
            {
                strErr += "danw不能为空!\\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 (!PageValidate.IsDateTime(txtshijian.Text))
            {
                strErr += "shijian格式错误!\\n";
            }
            if (this.txtskfs.Text.Trim().Length == 0)
            {
                strErr += "skfs不能为空!\\n";
            }
            if (!PageValidate.IsNumber(txtskjine.Text))
            {
                strErr += "skjine格式错误!\\n";
            }
            if (!PageValidate.IsNumber(txtye.Text))
            {
                strErr += "ye格式错误!\\n";
            }

            if (strErr != "")
            {
                MessageBox.Show(this, strErr);
                return;
            }
            int      id      = int.Parse(this.lblid.Text);
            string   cpmc    = this.txtcpmc.Text;
            int      cs      = int.Parse(this.txtcs.Text);
            int      dunw    = int.Parse(this.txtdunw.Text);
            int      dj      = int.Parse(this.txtdj.Text);
            int      je      = int.Parse(this.txtje.Text);
            string   bz      = this.txtbz.Text;
            string   danw    = this.txtdanw.Text;
            string   jsr     = this.txtjsr.Text;
            string   ddbh    = this.txtddbh.Text;
            string   djbh    = this.txtdjbh.Text;
            DateTime shijian = DateTime.Parse(this.txtshijian.Text);
            string   skfs    = this.txtskfs.Text;
            int      skjine  = int.Parse(this.txtskjine.Text);
            int      ye      = int.Parse(this.txtye.Text);


            Maticsoft.Model.cccc.xsdan model = new Maticsoft.Model.cccc.xsdan();
            model.id      = id;
            model.cpmc    = cpmc;
            model.cs      = cs;
            model.dunw    = dunw;
            model.dj      = dj;
            model.je      = je;
            model.bz      = bz;
            model.danw    = danw;
            model.jsr     = jsr;
            model.ddbh    = ddbh;
            model.djbh    = djbh;
            model.shijian = shijian;
            model.skfs    = skfs;
            model.skjine  = skjine;
            model.ye      = ye;

            Maticsoft.BLL.cccc.xsdan bll = new Maticsoft.BLL.cccc.xsdan();
            bll.Update(model);
            Maticsoft.Common.MessageBox.ShowAndRedirect(this, "保存成功!", "list.aspx");
        }
コード例 #5
0
 /// <summary>
 /// 得到一个对象实体
 /// </summary>
 public Maticsoft.Model.cccc.xsdan DataRowToModel(DataRow row)
 {
     Maticsoft.Model.cccc.xsdan model = new Maticsoft.Model.cccc.xsdan();
     if (row != null)
     {
         if (row["id"] != null && row["id"].ToString() != "")
         {
             model.id = int.Parse(row["id"].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["dunw"] != null && row["dunw"].ToString() != "")
         {
             model.dunw = int.Parse(row["dunw"].ToString());
         }
         if (row["dj"] != null && row["dj"].ToString() != "")
         {
             model.dj = int.Parse(row["dj"].ToString());
         }
         if (row["je"] != null && row["je"].ToString() != "")
         {
             model.je = int.Parse(row["je"].ToString());
         }
         if (row["bz"] != null)
         {
             model.bz = row["bz"].ToString();
         }
         if (row["danw"] != null)
         {
             model.danw = row["danw"].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["shijian"] != null && row["shijian"].ToString() != "")
         {
             model.shijian = DateTime.Parse(row["shijian"].ToString());
         }
         if (row["skfs"] != null)
         {
             model.skfs = row["skfs"].ToString();
         }
         if (row["skjine"] != null && row["skjine"].ToString() != "")
         {
             model.skjine = int.Parse(row["skjine"].ToString());
         }
         if (row["ye"] != null && row["ye"].ToString() != "")
         {
             model.ye = int.Parse(row["ye"].ToString());
         }
     }
     return(model);
 }
コード例 #6
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(Maticsoft.Model.cccc.xsdan model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update xsdan set ");
            strSql.Append("cpmc=@cpmc,");
            strSql.Append("cs=@cs,");
            strSql.Append("dunw=@dunw,");
            strSql.Append("dj=@dj,");
            strSql.Append("je=@je,");
            strSql.Append("bz=@bz,");
            strSql.Append("danw=@danw,");
            strSql.Append("jsr=@jsr,");
            strSql.Append("ddbh=@ddbh,");
            strSql.Append("djbh=@djbh,");
            strSql.Append("shijian=@shijian,");
            strSql.Append("skfs=@skfs,");
            strSql.Append("skjine=@skjine,");
            strSql.Append("ye=@ye");
            strSql.Append(" where id=@id");
            MySqlParameter[] parameters =
            {
                new MySqlParameter("@cpmc",    MySqlDbType.VarChar,   64),
                new MySqlParameter("@cs",      MySqlDbType.Int32,     64),
                new MySqlParameter("@dunw",    MySqlDbType.Int32,     64),
                new MySqlParameter("@dj",      MySqlDbType.Int32,     64),
                new MySqlParameter("@je",      MySqlDbType.Int32,     64),
                new MySqlParameter("@bz",      MySqlDbType.VarChar,   64),
                new MySqlParameter("@danw",    MySqlDbType.VarChar,   64),
                new MySqlParameter("@jsr",     MySqlDbType.VarChar,   64),
                new MySqlParameter("@ddbh",    MySqlDbType.VarChar,   64),
                new MySqlParameter("@djbh",    MySqlDbType.VarChar,   64),
                new MySqlParameter("@shijian", MySqlDbType.DateTime),
                new MySqlParameter("@skfs",    MySqlDbType.VarChar,   64),
                new MySqlParameter("@skjine",  MySqlDbType.Int32,     64),
                new MySqlParameter("@ye",      MySqlDbType.Int32,     64),
                new MySqlParameter("@id",      MySqlDbType.Int32, 64)
            };
            parameters[0].Value  = model.cpmc;
            parameters[1].Value  = model.cs;
            parameters[2].Value  = model.dunw;
            parameters[3].Value  = model.dj;
            parameters[4].Value  = model.je;
            parameters[5].Value  = model.bz;
            parameters[6].Value  = model.danw;
            parameters[7].Value  = model.jsr;
            parameters[8].Value  = model.ddbh;
            parameters[9].Value  = model.djbh;
            parameters[10].Value = model.shijian;
            parameters[11].Value = model.skfs;
            parameters[12].Value = model.skjine;
            parameters[13].Value = model.ye;
            parameters[14].Value = model.id;

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

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }