Esempio n. 1
0
        /// <summary>
        /// 保存一条记录
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public bool Save(FishEntity.CustomStandardTableEntity model, string name)
        {
            Hashtable SQLString = new Hashtable( );

            SQLString = ReviewInfo.getSQLString(name, model.code, string.Empty, SQLString);
            StringBuilder strSql = new StringBuilder( );

            strSql.Append("insert into t_customstandardtable(");
            strSql.Append("code,ash,protein,xd,fat,ffa,water,histamine,shy,level,fishId,xsCode,TVN)");
            strSql.Append(" values (");
            strSql.Append("@code,@ash,@protein,@xd,@fat,@ffa,@water,@histamine,@shy,@level,@fishId,@xsCode,@TVN)");
            MySqlParameter [] parameters =
            {
                new MySqlParameter("@code",      MySqlDbType.VarChar, 45),
                new MySqlParameter("@ash",       MySqlDbType.VarChar, 45),
                new MySqlParameter("@protein",   MySqlDbType.VarChar, 45),
                new MySqlParameter("@xd",        MySqlDbType.VarChar, 45),
                new MySqlParameter("@fat",       MySqlDbType.VarChar, 45),
                new MySqlParameter("@ffa",       MySqlDbType.VarChar, 45),
                new MySqlParameter("@water",     MySqlDbType.VarChar, 45),
                new MySqlParameter("@histamine", MySqlDbType.VarChar, 45),
                new MySqlParameter("@shy",       MySqlDbType.VarChar, 45),
                new MySqlParameter("@level",     MySqlDbType.VarChar, 45),
                new MySqlParameter("@fishId",    MySqlDbType.VarChar, 45),
                new MySqlParameter("@xsCode",    MySqlDbType.VarChar, 45),
                new MySqlParameter("@TVN",       MySqlDbType.VarChar, 45)
            };
            parameters [0].Value  = model.code;
            parameters [1].Value  = model.ash;
            parameters [2].Value  = model.protein;
            parameters [3].Value  = model.xd;
            parameters [4].Value  = model.fat;
            parameters [5].Value  = model.ffa;
            parameters [6].Value  = model.water;
            parameters [7].Value  = model.histamine;
            parameters [8].Value  = model.shy;
            parameters [9].Value  = model.level;
            parameters [10].Value = model.fishId;
            parameters [11].Value = model.xsCode;
            parameters[12].Value  = model.TVN;
            SQLString.Add(strSql, parameters);
            return(MySqlHelper.ExecuteSqlTran(SQLString));
        }
 private void dataGridView1_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
 {
     if (e.ColumnIndex < 0 && e.RowIndex < 0)
     {
         this.DialogResult = DialogResult.Cancel;
     }
     _model            = new FishEntity.CustomStandardTableEntity();
     _model.code       = dataGridView1.Rows[e.RowIndex].Cells["code"].Value.ToString();
     _model.level      = dataGridView1.Rows[e.RowIndex].Cells["level"].Value.ToString();
     _model.ash        = dataGridView1.Rows[e.RowIndex].Cells["ash"].Value.ToString();
     _model.protein    = dataGridView1.Rows[e.RowIndex].Cells["protein"].Value.ToString();
     _model.xd         = dataGridView1.Rows[e.RowIndex].Cells["xd"].Value.ToString();;
     _model.TVN        = dataGridView1.Rows[e.RowIndex].Cells["TVN"].Value.ToString();
     _model.fat        = dataGridView1.Rows[e.RowIndex].Cells["fat"].Value.ToString();
     _model.ffa        = dataGridView1.Rows[e.RowIndex].Cells["ffa"].Value.ToString();
     _model.water      = dataGridView1.Rows[e.RowIndex].Cells["water"].Value.ToString();
     _model.histamine  = dataGridView1.Rows[e.RowIndex].Cells["histamine"].Value.ToString();
     _model.shy        = dataGridView1.Rows[e.RowIndex].Cells["shy"].Value.ToString();
     _model.fishId     = dataGridView1.Rows[e.RowIndex].Cells["fishId"].Value.ToString();
     this.DialogResult = DialogResult.OK;
 }
Esempio n. 3
0
 /// <summary>
 /// 保存一条记录
 /// </summary>
 /// <param name="model"></param>
 /// <returns></returns>
 public bool Save ( FishEntity . CustomStandardTableEntity model ,string name)
 {
     return dal . Save ( model ,name );
 }
Esempio n. 4
0
 /// <summary>
 /// 编辑一条记录
 /// </summary>
 /// <param name="model"></param>
 /// <returns></returns>
 public bool Edit ( FishEntity . CustomStandardTableEntity model )
 {
     return dal . Edit ( model );
 }
Esempio n. 5
0
 public FishEntity.CustomStandardTableEntity getModel(DataRow row)
 {
     FishEntity.CustomStandardTableEntity model = new FishEntity.CustomStandardTableEntity( );
     if (row != null)
     {
         if (row ["id"] != null && row ["id"].ToString( ) != "")
         {
             model.id = int.Parse(row ["id"].ToString( ));
         }
         if (row ["code"] != null)
         {
             model.code = row ["code"].ToString( );
         }
         if (row["TVN"] != null)
         {
             model.TVN = row["tvn"].ToString();
         }
         if (row ["ash"] != null)
         {
             model.ash = row ["ash"].ToString( );
         }
         if (row ["protein"] != null)
         {
             model.protein = row ["protein"].ToString( );
         }
         if (row ["xd"] != null)
         {
             model.xd = row ["xd"].ToString( );
         }
         if (row ["fat"] != null)
         {
             model.fat = row ["fat"].ToString( );
         }
         if (row ["ffa"] != null)
         {
             model.ffa = row ["ffa"].ToString( );
         }
         if (row ["water"] != null)
         {
             model.water = row ["water"].ToString( );
         }
         if (row ["histamine"] != null)
         {
             model.histamine = row ["histamine"].ToString( );
         }
         if (row ["shy"] != null)
         {
             model.shy = row ["shy"].ToString( );
         }
         if (row ["level"] != null)
         {
             model.level = row ["level"].ToString( );
         }
         if (row ["fishId"] != null)
         {
             model.fishId = row ["fishId"].ToString( );
         }
         if (row ["xsCode"] != null)
         {
             model.xsCode = row ["xsCode"].ToString( );
         }
     }
     return(model);
 }