private void ShowInfo(long id)
 {
     Jium.BLL.pgroup   bll   = new Jium.BLL.pgroup();
     Jium.Model.pgroup model = bll.GetModel(id);
     this.lblid.Text     = model.id.ToString();
     this.txtgid.Text    = model.gid.ToString();
     this.txtgindex.Text = model.gindex.ToString();
     this.txtgpid.Text   = model.gpid.ToString();
     this.txtgpcnt.Text  = model.gpcnt.ToString();
     this.txtgdesc.Text  = model.gdesc;
     this.txtgs1.Text    = model.gs1;
     this.txtgs2.Text    = model.gs2;
     this.txtgs3.Text    = model.gs3;
     this.txtgs4.Text    = model.gs4;
     this.txtgs5.Text    = model.gs5;
     this.txtgd1.Text    = model.gd1.ToString();
     this.txtgd2.Text    = model.gd2.ToString();
     this.txtgd3.Text    = model.gd3.ToString();
     this.txtgd4.Text    = model.gd4.ToString();
     this.txtgd5.Text    = model.gd5.ToString();
     this.txtgdc1.Text   = model.gdc1.ToString();
     this.txtgdc2.Text   = model.gdc2.ToString();
     this.txtgdc3.Text   = model.gdc3.ToString();
     this.txtgdc4.Text   = model.gdc4.ToString();
     this.txtgdc5.Text   = model.gdc5.ToString();
 }
Exemple #2
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public Jium.Model.pgroup GetModel(long id)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select id,gid,gindex,gpid,gpcnt,gdesc,gs1,gs2,gs3,gs4,gs5,gd1,gd2,gd3,gd4,gd5,gdc1,gdc2,gdc3,gdc4,gdc5 from pgroup ");
            strSql.Append(" where id=@id ");
            MySqlParameter[] parameters =
            {
                new MySqlParameter("@id", MySqlDbType.Int64, 20)
            };
            parameters[0].Value = id;

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

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

            if (!PageValidate.IsNumber(txtgid.Text))
            {
                strErr += "gid格式错误!\\n";
            }
            if (!PageValidate.IsNumber(txtgindex.Text))
            {
                strErr += "gindex格式错误!\\n";
            }
            if (!PageValidate.IsNumber(txtgpid.Text))
            {
                strErr += "gpid格式错误!\\n";
            }
            if (!PageValidate.IsNumber(txtgpcnt.Text))
            {
                strErr += "gpcnt格式错误!\\n";
            }
            if (this.txtgdesc.Text.Trim().Length == 0)
            {
                strErr += "gdesc不能为空!\\n";
            }
            if (this.txtgs1.Text.Trim().Length == 0)
            {
                strErr += "gs1不能为空!\\n";
            }
            if (this.txtgs2.Text.Trim().Length == 0)
            {
                strErr += "gs2不能为空!\\n";
            }
            if (this.txtgs3.Text.Trim().Length == 0)
            {
                strErr += "gs3不能为空!\\n";
            }
            if (this.txtgs4.Text.Trim().Length == 0)
            {
                strErr += "gs4不能为空!\\n";
            }
            if (this.txtgs5.Text.Trim().Length == 0)
            {
                strErr += "gs5不能为空!\\n";
            }
            if (!PageValidate.IsNumber(txtgd1.Text))
            {
                strErr += "gd1格式错误!\\n";
            }
            if (!PageValidate.IsNumber(txtgd2.Text))
            {
                strErr += "gd2格式错误!\\n";
            }
            if (!PageValidate.IsNumber(txtgd3.Text))
            {
                strErr += "gd3格式错误!\\n";
            }
            if (!PageValidate.IsNumber(txtgd4.Text))
            {
                strErr += "gd4格式错误!\\n";
            }
            if (!PageValidate.IsNumber(txtgd5.Text))
            {
                strErr += "gd5格式错误!\\n";
            }
            if (!PageValidate.IsDecimal(txtgdc1.Text))
            {
                strErr += "gdc1格式错误!\\n";
            }
            if (!PageValidate.IsDecimal(txtgdc2.Text))
            {
                strErr += "gdc2格式错误!\\n";
            }
            if (!PageValidate.IsDecimal(txtgdc3.Text))
            {
                strErr += "gdc3格式错误!\\n";
            }
            if (!PageValidate.IsDecimal(txtgdc4.Text))
            {
                strErr += "gdc4格式错误!\\n";
            }
            if (!PageValidate.IsDecimal(txtgdc5.Text))
            {
                strErr += "gdc5格式错误!\\n";
            }

            if (strErr != "")
            {
                MessageBox.Show(this, strErr);
                return;
            }
            long    id     = long.Parse(this.lblid.Text);
            int     gid    = int.Parse(this.txtgid.Text);
            int     gindex = int.Parse(this.txtgindex.Text);
            int     gpid   = int.Parse(this.txtgpid.Text);
            int     gpcnt  = int.Parse(this.txtgpcnt.Text);
            string  gdesc  = this.txtgdesc.Text;
            string  gs1    = this.txtgs1.Text;
            string  gs2    = this.txtgs2.Text;
            string  gs3    = this.txtgs3.Text;
            string  gs4    = this.txtgs4.Text;
            string  gs5    = this.txtgs5.Text;
            int     gd1    = int.Parse(this.txtgd1.Text);
            int     gd2    = int.Parse(this.txtgd2.Text);
            int     gd3    = int.Parse(this.txtgd3.Text);
            int     gd4    = int.Parse(this.txtgd4.Text);
            int     gd5    = int.Parse(this.txtgd5.Text);
            decimal gdc1   = decimal.Parse(this.txtgdc1.Text);
            decimal gdc2   = decimal.Parse(this.txtgdc2.Text);
            decimal gdc3   = decimal.Parse(this.txtgdc3.Text);
            decimal gdc4   = decimal.Parse(this.txtgdc4.Text);
            decimal gdc5   = decimal.Parse(this.txtgdc5.Text);


            Jium.Model.pgroup model = new Jium.Model.pgroup();
            model.id     = id;
            model.gid    = gid;
            model.gindex = gindex;
            model.gpid   = gpid;
            model.gpcnt  = gpcnt;
            model.gdesc  = gdesc;
            model.gs1    = gs1;
            model.gs2    = gs2;
            model.gs3    = gs3;
            model.gs4    = gs4;
            model.gs5    = gs5;
            model.gd1    = gd1;
            model.gd2    = gd2;
            model.gd3    = gd3;
            model.gd4    = gd4;
            model.gd5    = gd5;
            model.gdc1   = gdc1;
            model.gdc2   = gdc2;
            model.gdc3   = gdc3;
            model.gdc4   = gdc4;
            model.gdc5   = gdc5;

            Jium.BLL.pgroup bll = new Jium.BLL.pgroup();
            bll.Update(model);
            Maticsoft.Common.MessageBox.ShowAndRedirect(this, "保存成功!", "list.aspx");
        }
Exemple #4
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public bool Add(Jium.Model.pgroup model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into pgroup(");
            strSql.Append("id,gid,gindex,gpid,gpcnt,gdesc,gs1,gs2,gs3,gs4,gs5,gd1,gd2,gd3,gd4,gd5,gdc1,gdc2,gdc3,gdc4,gdc5)");
            strSql.Append(" values (");
            strSql.Append("@id,@gid,@gindex,@gpid,@gpcnt,@gdesc,@gs1,@gs2,@gs3,@gs4,@gs5,@gd1,@gd2,@gd3,@gd4,@gd5,@gdc1,@gdc2,@gdc3,@gdc4,@gdc5)");
            MySqlParameter[] parameters =
            {
                new MySqlParameter("@id",     MySqlDbType.Int64,    20),
                new MySqlParameter("@gid",    MySqlDbType.Int32,    11),
                new MySqlParameter("@gindex", MySqlDbType.Int32,    11),
                new MySqlParameter("@gpid",   MySqlDbType.Int32,    11),
                new MySqlParameter("@gpcnt",  MySqlDbType.Int32,    11),
                new MySqlParameter("@gdesc",  MySqlDbType.VarChar, 200),
                new MySqlParameter("@gs1",    MySqlDbType.VarChar,  20),
                new MySqlParameter("@gs2",    MySqlDbType.VarChar,  20),
                new MySqlParameter("@gs3",    MySqlDbType.VarChar,  20),
                new MySqlParameter("@gs4",    MySqlDbType.VarChar,  20),
                new MySqlParameter("@gs5",    MySqlDbType.VarChar,  20),
                new MySqlParameter("@gd1",    MySqlDbType.Int32,    11),
                new MySqlParameter("@gd2",    MySqlDbType.Int32,    11),
                new MySqlParameter("@gd3",    MySqlDbType.Int32,    11),
                new MySqlParameter("@gd4",    MySqlDbType.Int32,    11),
                new MySqlParameter("@gd5",    MySqlDbType.Int32,    11),
                new MySqlParameter("@gdc1",   MySqlDbType.Decimal,  20),
                new MySqlParameter("@gdc2",   MySqlDbType.Decimal,  20),
                new MySqlParameter("@gdc3",   MySqlDbType.Decimal,  20),
                new MySqlParameter("@gdc4",   MySqlDbType.Decimal,  20),
                new MySqlParameter("@gdc5",   MySqlDbType.Decimal, 20)
            };
            parameters[0].Value  = model.id;
            parameters[1].Value  = model.gid;
            parameters[2].Value  = model.gindex;
            parameters[3].Value  = model.gpid;
            parameters[4].Value  = model.gpcnt;
            parameters[5].Value  = model.gdesc;
            parameters[6].Value  = model.gs1;
            parameters[7].Value  = model.gs2;
            parameters[8].Value  = model.gs3;
            parameters[9].Value  = model.gs4;
            parameters[10].Value = model.gs5;
            parameters[11].Value = model.gd1;
            parameters[12].Value = model.gd2;
            parameters[13].Value = model.gd3;
            parameters[14].Value = model.gd4;
            parameters[15].Value = model.gd5;
            parameters[16].Value = model.gdc1;
            parameters[17].Value = model.gdc2;
            parameters[18].Value = model.gdc3;
            parameters[19].Value = model.gdc4;
            parameters[20].Value = model.gdc5;

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

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Exemple #5
0
 /// <summary>
 /// 得到一个对象实体
 /// </summary>
 public Jium.Model.pgroup DataRowToModel(DataRow row)
 {
     Jium.Model.pgroup model = new Jium.Model.pgroup();
     if (row != null)
     {
         if (row["id"] != null && row["id"].ToString() != "")
         {
             model.id = long.Parse(row["id"].ToString());
         }
         if (row["gid"] != null && row["gid"].ToString() != "")
         {
             model.gid = int.Parse(row["gid"].ToString());
         }
         if (row["gindex"] != null && row["gindex"].ToString() != "")
         {
             model.gindex = int.Parse(row["gindex"].ToString());
         }
         if (row["gpid"] != null && row["gpid"].ToString() != "")
         {
             model.gpid = int.Parse(row["gpid"].ToString());
         }
         if (row["gpcnt"] != null && row["gpcnt"].ToString() != "")
         {
             model.gpcnt = int.Parse(row["gpcnt"].ToString());
         }
         if (row["gdesc"] != null)
         {
             model.gdesc = row["gdesc"].ToString();
         }
         if (row["gs1"] != null)
         {
             model.gs1 = row["gs1"].ToString();
         }
         if (row["gs2"] != null)
         {
             model.gs2 = row["gs2"].ToString();
         }
         if (row["gs3"] != null)
         {
             model.gs3 = row["gs3"].ToString();
         }
         if (row["gs4"] != null)
         {
             model.gs4 = row["gs4"].ToString();
         }
         if (row["gs5"] != null)
         {
             model.gs5 = row["gs5"].ToString();
         }
         if (row["gd1"] != null && row["gd1"].ToString() != "")
         {
             model.gd1 = int.Parse(row["gd1"].ToString());
         }
         if (row["gd2"] != null && row["gd2"].ToString() != "")
         {
             model.gd2 = int.Parse(row["gd2"].ToString());
         }
         if (row["gd3"] != null && row["gd3"].ToString() != "")
         {
             model.gd3 = int.Parse(row["gd3"].ToString());
         }
         if (row["gd4"] != null && row["gd4"].ToString() != "")
         {
             model.gd4 = int.Parse(row["gd4"].ToString());
         }
         if (row["gd5"] != null && row["gd5"].ToString() != "")
         {
             model.gd5 = int.Parse(row["gd5"].ToString());
         }
         if (row["gdc1"] != null && row["gdc1"].ToString() != "")
         {
             model.gdc1 = decimal.Parse(row["gdc1"].ToString());
         }
         if (row["gdc2"] != null && row["gdc2"].ToString() != "")
         {
             model.gdc2 = decimal.Parse(row["gdc2"].ToString());
         }
         if (row["gdc3"] != null && row["gdc3"].ToString() != "")
         {
             model.gdc3 = decimal.Parse(row["gdc3"].ToString());
         }
         if (row["gdc4"] != null && row["gdc4"].ToString() != "")
         {
             model.gdc4 = decimal.Parse(row["gdc4"].ToString());
         }
         if (row["gdc5"] != null && row["gdc5"].ToString() != "")
         {
             model.gdc5 = decimal.Parse(row["gdc5"].ToString());
         }
     }
     return(model);
 }
Exemple #6
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(Jium.Model.pgroup model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update pgroup set ");
            strSql.Append("gid=@gid,");
            strSql.Append("gindex=@gindex,");
            strSql.Append("gpid=@gpid,");
            strSql.Append("gpcnt=@gpcnt,");
            strSql.Append("gdesc=@gdesc,");
            strSql.Append("gs1=@gs1,");
            strSql.Append("gs2=@gs2,");
            strSql.Append("gs3=@gs3,");
            strSql.Append("gs4=@gs4,");
            strSql.Append("gs5=@gs5,");
            strSql.Append("gd1=@gd1,");
            strSql.Append("gd2=@gd2,");
            strSql.Append("gd3=@gd3,");
            strSql.Append("gd4=@gd4,");
            strSql.Append("gd5=@gd5,");
            strSql.Append("gdc1=@gdc1,");
            strSql.Append("gdc2=@gdc2,");
            strSql.Append("gdc3=@gdc3,");
            strSql.Append("gdc4=@gdc4,");
            strSql.Append("gdc5=@gdc5");
            strSql.Append(" where id=@id ");
            MySqlParameter[] parameters =
            {
                new MySqlParameter("@gid",    MySqlDbType.Int32,    11),
                new MySqlParameter("@gindex", MySqlDbType.Int32,    11),
                new MySqlParameter("@gpid",   MySqlDbType.Int32,    11),
                new MySqlParameter("@gpcnt",  MySqlDbType.Int32,    11),
                new MySqlParameter("@gdesc",  MySqlDbType.VarChar, 200),
                new MySqlParameter("@gs1",    MySqlDbType.VarChar,  20),
                new MySqlParameter("@gs2",    MySqlDbType.VarChar,  20),
                new MySqlParameter("@gs3",    MySqlDbType.VarChar,  20),
                new MySqlParameter("@gs4",    MySqlDbType.VarChar,  20),
                new MySqlParameter("@gs5",    MySqlDbType.VarChar,  20),
                new MySqlParameter("@gd1",    MySqlDbType.Int32,    11),
                new MySqlParameter("@gd2",    MySqlDbType.Int32,    11),
                new MySqlParameter("@gd3",    MySqlDbType.Int32,    11),
                new MySqlParameter("@gd4",    MySqlDbType.Int32,    11),
                new MySqlParameter("@gd5",    MySqlDbType.Int32,    11),
                new MySqlParameter("@gdc1",   MySqlDbType.Decimal,  20),
                new MySqlParameter("@gdc2",   MySqlDbType.Decimal,  20),
                new MySqlParameter("@gdc3",   MySqlDbType.Decimal,  20),
                new MySqlParameter("@gdc4",   MySqlDbType.Decimal,  20),
                new MySqlParameter("@gdc5",   MySqlDbType.Decimal,  20),
                new MySqlParameter("@id",     MySqlDbType.Int64, 20)
            };
            parameters[0].Value  = model.gid;
            parameters[1].Value  = model.gindex;
            parameters[2].Value  = model.gpid;
            parameters[3].Value  = model.gpcnt;
            parameters[4].Value  = model.gdesc;
            parameters[5].Value  = model.gs1;
            parameters[6].Value  = model.gs2;
            parameters[7].Value  = model.gs3;
            parameters[8].Value  = model.gs4;
            parameters[9].Value  = model.gs5;
            parameters[10].Value = model.gd1;
            parameters[11].Value = model.gd2;
            parameters[12].Value = model.gd3;
            parameters[13].Value = model.gd4;
            parameters[14].Value = model.gd5;
            parameters[15].Value = model.gdc1;
            parameters[16].Value = model.gdc2;
            parameters[17].Value = model.gdc3;
            parameters[18].Value = model.gdc4;
            parameters[19].Value = model.gdc5;
            parameters[20].Value = model.id;

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

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