Esempio n. 1
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public bool Add(Maticsoft.Model.cccc.Jx_fapiao model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into Jx_fapiao(");
            strSql.Append("cgdbhao,kaipr,fpneixing,jbanr,cal,fphao,riqi,kpdanw,kpdunwei,kpjine,shuinv,shuie,bz)");
            strSql.Append(" values (");
            strSql.Append("@cgdbhao,@kaipr,@fpneixing,@jbanr,@cal,@fphao,@riqi,@kpdanw,@kpdunwei,@kpjine,@shuinv,@shuie,@bz)");
            MySqlParameter[] parameters =
            {
                new MySqlParameter("@cgdbhao",   MySqlDbType.VarChar,   64),
                new MySqlParameter("@kaipr",     MySqlDbType.VarChar,   64),
                new MySqlParameter("@fpneixing", MySqlDbType.VarChar,   64),
                new MySqlParameter("@jbanr",     MySqlDbType.VarChar,   64),
                new MySqlParameter("@cal",       MySqlDbType.Int32,     64),
                new MySqlParameter("@fphao",     MySqlDbType.Int32,     64),
                new MySqlParameter("@riqi",      MySqlDbType.DateTime),
                new MySqlParameter("@kpdanw",    MySqlDbType.VarChar,   64),
                new MySqlParameter("@kpdunwei",  MySqlDbType.Int32,     64),
                new MySqlParameter("@kpjine",    MySqlDbType.Int32,     64),
                new MySqlParameter("@shuinv",    MySqlDbType.VarChar,   64),
                new MySqlParameter("@shuie",     MySqlDbType.Int32,     64),
                new MySqlParameter("@bz",        MySqlDbType.VarChar, 64)
            };
            parameters[0].Value  = model.cgdbhao;
            parameters[1].Value  = model.kaipr;
            parameters[2].Value  = model.fpneixing;
            parameters[3].Value  = model.jbanr;
            parameters[4].Value  = model.cal;
            parameters[5].Value  = model.fphao;
            parameters[6].Value  = model.riqi;
            parameters[7].Value  = model.kpdanw;
            parameters[8].Value  = model.kpdunwei;
            parameters[9].Value  = model.kpjine;
            parameters[10].Value = model.shuinv;
            parameters[11].Value = model.shuie;
            parameters[12].Value = model.bz;

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

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Esempio n. 2
0
 private void ShowInfo(int id)
 {
     Maticsoft.BLL.cccc.Jx_fapiao   bll   = new Maticsoft.BLL.cccc.Jx_fapiao();
     Maticsoft.Model.cccc.Jx_fapiao model = bll.GetModel(id);
     this.lblid.Text        = model.id.ToString();
     this.lblcgdbhao.Text   = model.cgdbhao;
     this.lblkaipr.Text     = model.kaipr;
     this.lblfpneixing.Text = model.fpneixing;
     this.lbljbanr.Text     = model.jbanr;
     this.lblcal.Text       = model.cal.ToString();
     this.lblfphao.Text     = model.fphao.ToString();
     this.lblriqi.Text      = model.riqi.ToString();
     this.lblkpdanw.Text    = model.kpdanw;
     this.lblkpdunwei.Text  = model.kpdunwei.ToString();
     this.lblkpjine.Text    = model.kpjine.ToString();
     this.lblshuinv.Text    = model.shuinv;
     this.lblshuie.Text     = model.shuie.ToString();
     this.lblbz.Text        = model.bz;
 }
Esempio n. 3
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public Maticsoft.Model.cccc.Jx_fapiao GetModel(int id)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select id,cgdbhao,kaipr,fpneixing,jbanr,cal,fphao,riqi,kpdanw,kpdunwei,kpjine,shuinv,shuie,bz from Jx_fapiao ");
            strSql.Append(" where id=@id");
            MySqlParameter[] parameters =
            {
                new MySqlParameter("@id", MySqlDbType.Int32)
            };
            parameters[0].Value = id;

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

            if (ds.Tables[0].Rows.Count > 0)
            {
                return(DataRowToModel(ds.Tables[0].Rows[0]));
            }
            else
            {
                return(null);
            }
        }
Esempio n. 4
0
 /// <summary>
 /// 得到一个对象实体
 /// </summary>
 public Maticsoft.Model.cccc.Jx_fapiao DataRowToModel(DataRow row)
 {
     Maticsoft.Model.cccc.Jx_fapiao model = new Maticsoft.Model.cccc.Jx_fapiao();
     if (row != null)
     {
         if (row["id"] != null && row["id"].ToString() != "")
         {
             model.id = int.Parse(row["id"].ToString());
         }
         if (row["cgdbhao"] != null)
         {
             model.cgdbhao = row["cgdbhao"].ToString();
         }
         if (row["kaipr"] != null)
         {
             model.kaipr = row["kaipr"].ToString();
         }
         if (row["fpneixing"] != null)
         {
             model.fpneixing = row["fpneixing"].ToString();
         }
         if (row["jbanr"] != null)
         {
             model.jbanr = row["jbanr"].ToString();
         }
         if (row["cal"] != null && row["cal"].ToString() != "")
         {
             model.cal = int.Parse(row["cal"].ToString());
         }
         if (row["fphao"] != null && row["fphao"].ToString() != "")
         {
             model.fphao = int.Parse(row["fphao"].ToString());
         }
         if (row["riqi"] != null && row["riqi"].ToString() != "")
         {
             model.riqi = DateTime.Parse(row["riqi"].ToString());
         }
         if (row["kpdanw"] != null)
         {
             model.kpdanw = row["kpdanw"].ToString();
         }
         if (row["kpdunwei"] != null && row["kpdunwei"].ToString() != "")
         {
             model.kpdunwei = int.Parse(row["kpdunwei"].ToString());
         }
         if (row["kpjine"] != null && row["kpjine"].ToString() != "")
         {
             model.kpjine = int.Parse(row["kpjine"].ToString());
         }
         if (row["shuinv"] != null)
         {
             model.shuinv = row["shuinv"].ToString();
         }
         if (row["shuie"] != null && row["shuie"].ToString() != "")
         {
             model.shuie = int.Parse(row["shuie"].ToString());
         }
         if (row["bz"] != null)
         {
             model.bz = row["bz"].ToString();
         }
     }
     return(model);
 }
Esempio n. 5
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(Maticsoft.Model.cccc.Jx_fapiao model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update Jx_fapiao set ");
            strSql.Append("cgdbhao=@cgdbhao,");
            strSql.Append("kaipr=@kaipr,");
            strSql.Append("fpneixing=@fpneixing,");
            strSql.Append("jbanr=@jbanr,");
            strSql.Append("cal=@cal,");
            strSql.Append("fphao=@fphao,");
            strSql.Append("riqi=@riqi,");
            strSql.Append("kpdanw=@kpdanw,");
            strSql.Append("kpdunwei=@kpdunwei,");
            strSql.Append("kpjine=@kpjine,");
            strSql.Append("shuinv=@shuinv,");
            strSql.Append("shuie=@shuie,");
            strSql.Append("bz=@bz");
            strSql.Append(" where id=@id");
            MySqlParameter[] parameters =
            {
                new MySqlParameter("@cgdbhao",   MySqlDbType.VarChar,   64),
                new MySqlParameter("@kaipr",     MySqlDbType.VarChar,   64),
                new MySqlParameter("@fpneixing", MySqlDbType.VarChar,   64),
                new MySqlParameter("@jbanr",     MySqlDbType.VarChar,   64),
                new MySqlParameter("@cal",       MySqlDbType.Int32,     64),
                new MySqlParameter("@fphao",     MySqlDbType.Int32,     64),
                new MySqlParameter("@riqi",      MySqlDbType.DateTime),
                new MySqlParameter("@kpdanw",    MySqlDbType.VarChar,   64),
                new MySqlParameter("@kpdunwei",  MySqlDbType.Int32,     64),
                new MySqlParameter("@kpjine",    MySqlDbType.Int32,     64),
                new MySqlParameter("@shuinv",    MySqlDbType.VarChar,   64),
                new MySqlParameter("@shuie",     MySqlDbType.Int32,     64),
                new MySqlParameter("@bz",        MySqlDbType.VarChar,   64),
                new MySqlParameter("@id",        MySqlDbType.Int32, 64)
            };
            parameters[0].Value  = model.cgdbhao;
            parameters[1].Value  = model.kaipr;
            parameters[2].Value  = model.fpneixing;
            parameters[3].Value  = model.jbanr;
            parameters[4].Value  = model.cal;
            parameters[5].Value  = model.fphao;
            parameters[6].Value  = model.riqi;
            parameters[7].Value  = model.kpdanw;
            parameters[8].Value  = model.kpdunwei;
            parameters[9].Value  = model.kpjine;
            parameters[10].Value = model.shuinv;
            parameters[11].Value = model.shuie;
            parameters[12].Value = model.bz;
            parameters[13].Value = model.id;

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

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Esempio n. 6
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            string strErr = "";

            if (this.txtcgdbhao.Text.Trim().Length == 0)
            {
                strErr += "cgdbhao不能为空!\\n";
            }
            if (this.txtkaipr.Text.Trim().Length == 0)
            {
                strErr += "kaipr不能为空!\\n";
            }
            if (this.txtfpneixing.Text.Trim().Length == 0)
            {
                strErr += "fpneixing不能为空!\\n";
            }
            if (this.txtjbanr.Text.Trim().Length == 0)
            {
                strErr += "jbanr不能为空!\\n";
            }
            if (!PageValidate.IsNumber(txtcal.Text))
            {
                strErr += "cal格式错误!\\n";
            }
            if (!PageValidate.IsNumber(txtfphao.Text))
            {
                strErr += "fphao格式错误!\\n";
            }
            if (!PageValidate.IsDateTime(txtriqi.Text))
            {
                strErr += "riqi格式错误!\\n";
            }
            if (this.txtkpdanw.Text.Trim().Length == 0)
            {
                strErr += "kpdanw不能为空!\\n";
            }
            if (!PageValidate.IsNumber(txtkpdunwei.Text))
            {
                strErr += "kpdunwei格式错误!\\n";
            }
            if (!PageValidate.IsNumber(txtkpjine.Text))
            {
                strErr += "kpjine格式错误!\\n";
            }
            if (this.txtshuinv.Text.Trim().Length == 0)
            {
                strErr += "shuinv不能为空!\\n";
            }
            if (!PageValidate.IsNumber(txtshuie.Text))
            {
                strErr += "shuie格式错误!\\n";
            }
            if (this.txtbz.Text.Trim().Length == 0)
            {
                strErr += "bz不能为空!\\n";
            }

            if (strErr != "")
            {
                MessageBox.Show(this, strErr);
                return;
            }
            string   cgdbhao   = this.txtcgdbhao.Text;
            string   kaipr     = this.txtkaipr.Text;
            string   fpneixing = this.txtfpneixing.Text;
            string   jbanr     = this.txtjbanr.Text;
            int      cal       = int.Parse(this.txtcal.Text);
            int      fphao     = int.Parse(this.txtfphao.Text);
            DateTime riqi      = DateTime.Parse(this.txtriqi.Text);
            string   kpdanw    = this.txtkpdanw.Text;
            int      kpdunwei  = int.Parse(this.txtkpdunwei.Text);
            int      kpjine    = int.Parse(this.txtkpjine.Text);
            string   shuinv    = this.txtshuinv.Text;
            int      shuie     = int.Parse(this.txtshuie.Text);
            string   bz        = this.txtbz.Text;

            Maticsoft.Model.cccc.Jx_fapiao model = new Maticsoft.Model.cccc.Jx_fapiao();
            model.cgdbhao   = cgdbhao;
            model.kaipr     = kaipr;
            model.fpneixing = fpneixing;
            model.jbanr     = jbanr;
            model.cal       = cal;
            model.fphao     = fphao;
            model.riqi      = riqi;
            model.kpdanw    = kpdanw;
            model.kpdunwei  = kpdunwei;
            model.kpjine    = kpjine;
            model.shuinv    = shuinv;
            model.shuie     = shuie;
            model.bz        = bz;

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