示例#1
0
 /// <summary>
 /// 得到一个对象实体
 /// </summary>
 public FishEntity.InventoryAccountEntity DataRowToModel(DataRow row)
 {
     FishEntity.InventoryAccountEntity model = new FishEntity.InventoryAccountEntity();
     if (row != null)
     {
         if (row["id"] != null && row["id"].ToString() != "")
         {
             model.id = int.Parse(row["id"].ToString());
         }
         if (row["mid"] != null && row["mid"].ToString() != "")
         {
             model.mid = int.Parse(row["mid"].ToString());
         }
         if (row["accountdate"] != null && row["accountdate"].ToString() != "")
         {
             model.accountdate = DateTime.Parse(row["accountdate"].ToString());
         }
         if (row["productid"] != null && row["productid"].ToString() != "")
         {
             model.productid = int.Parse(row["productid"].ToString());
         }
         if (row["remainweight"] != null && row["remainweight"].ToString() != "")
         {
             model.remainweight = decimal.Parse(row["remainweight"].ToString());
         }
         if (row["remainquantity"] != null && row["remainquantity"].ToString() != "")
         {
             model.remainquantity = int.Parse(row["remainquantity"].ToString());
         }
         if (row["homemadeweight"] != null && row["homemadeweight"].ToString() != "")
         {
             model.homemadeweight = decimal.Parse(row["homemadeweight"].ToString());
         }
         if (row["homemadepackages"] != null && row["homemadepackages"].ToString() != "")
         {
             model.homemadepackages = int.Parse(row["homemadepackages"].ToString());
         }
         if (row["createman"] != null)
         {
             model.createman = row["createman"].ToString();
         }
         if (row["createtime"] != null && row["createtime"].ToString() != "")
         {
             model.createtime = DateTime.Parse(row["createtime"].ToString());
         }
         if (row["modifyman"] != null)
         {
             model.modifyman = row["modifyman"].ToString();
         }
         if (row["modifytime"] != null && row["modifytime"].ToString() != "")
         {
             model.modifytime = DateTime.Parse(row["modifytime"].ToString());
         }
     }
     return(model);
 }
示例#2
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(FishEntity.InventoryAccountEntity model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update t_inventoryaccount set ");
            strSql.Append("accountdate=@accountdate,");
            strSql.Append("productid=@productid,");
            strSql.Append("remainweight=@remainweight,");
            strSql.Append("remainquantity=@remainquantity,");
            strSql.Append("homemadeweight=@homemadeweight,");
            strSql.Append("homemadepackages=@homemadepackages,");
            strSql.Append("createman=@createman,");
            strSql.Append("modifyman=@modifyman,");
            strSql.Append("mid=@mid");
            strSql.Append(" where id=@id");
            MySqlParameter[] parameters =
            {
                new MySqlParameter("@accountdate",      MySqlDbType.Date),
                new MySqlParameter("@productid",        MySqlDbType.Int32,   11),
                new MySqlParameter("@remainweight",     MySqlDbType.Decimal, 12),
                new MySqlParameter("@remainquantity",   MySqlDbType.Int32,    8),
                new MySqlParameter("@homemadeweight",   MySqlDbType.Decimal, 12),
                new MySqlParameter("@homemadepackages", MySqlDbType.Int32,    8),
                new MySqlParameter("@createman",        MySqlDbType.VarChar, 45),
                new MySqlParameter("@modifyman",        MySqlDbType.VarChar, 45),
                new MySqlParameter("@mid",              MySqlDbType.Int32,    8),
                new MySqlParameter("@id",               MySqlDbType.Int32, 11)
            };
            parameters[0].Value = model.accountdate;
            parameters[1].Value = model.productid;
            parameters[2].Value = model.remainweight;
            parameters[3].Value = model.remainquantity;
            parameters[4].Value = model.homemadeweight;
            parameters[5].Value = model.homemadepackages;
            parameters[6].Value = model.createman;
            parameters[7].Value = model.modifyman;
            parameters[8].Value = model.mid;
            parameters[9].Value = model.id;

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

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
示例#3
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public bool Add(FishEntity.InventoryAccountEntity model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into t_inventoryaccount(");
            strSql.Append("accountdate,productid,remainweight,remainquantity,homemadeweight,homemadepackages,createman,createtime,modifyman,modifytime,mid)");
            strSql.Append(" values (");
            strSql.Append("@accountdate,@productid,@remainweight,@remainquantity,@homemadeweight,@homemadepackages,@createman,@createtime,@modifyman,@modifytime,@mid)");
            MySqlParameter[] parameters =
            {
                new MySqlParameter("@accountdate",      MySqlDbType.Date),
                new MySqlParameter("@productid",        MySqlDbType.Int32,      11),
                new MySqlParameter("@remainweight",     MySqlDbType.Decimal,    12),
                new MySqlParameter("@remainquantity",   MySqlDbType.Int32,       8),
                new MySqlParameter("@homemadeweight",   MySqlDbType.Decimal,    12),
                new MySqlParameter("@homemadepackages", MySqlDbType.Int32,       8),
                new MySqlParameter("@createman",        MySqlDbType.VarChar,    45),
                new MySqlParameter("@createtime",       MySqlDbType.Timestamp),
                new MySqlParameter("@modifyman",        MySqlDbType.VarChar,    45),
                new MySqlParameter("@modifytime",       MySqlDbType.Timestamp),
                new MySqlParameter("@mid",              MySqlDbType.Int32, 8)
            };
            parameters[0].Value  = model.accountdate;
            parameters[1].Value  = model.productid;
            parameters[2].Value  = model.remainweight;
            parameters[3].Value  = model.remainquantity;
            parameters[4].Value  = model.homemadeweight;
            parameters[5].Value  = model.homemadepackages;
            parameters[6].Value  = model.createman;
            parameters[7].Value  = model.createtime;
            parameters[8].Value  = model.modifyman;
            parameters[9].Value  = model.modifytime;
            parameters[10].Value = model.mid;

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

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
示例#4
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public FishEntity.InventoryAccountEntity GetModel(int id)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select id,mid,accountdate,productid,remainweight,remainquantity,homemadeweight,homemadepackages,createman,createtime,modifyman,modifytime from t_inventoryaccount ");
            strSql.Append(" where id=@id");
            MySqlParameter[] parameters =
            {
                new MySqlParameter("@id", MySqlDbType.Int32)
            };
            parameters[0].Value = id;

            FishEntity.InventoryAccountEntity model = new FishEntity.InventoryAccountEntity();
            DataSet ds = MySqlHelper.Query(strSql.ToString(), parameters);

            if (ds.Tables[0].Rows.Count > 0)
            {
                return(DataRowToModel(ds.Tables[0].Rows[0]));
            }
            else
            {
                return(null);
            }
        }
示例#5
0
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public bool Update(FishEntity.InventoryAccountEntity model)
 {
     return(dal.Update(model));
 }
示例#6
0
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public bool Add(FishEntity.InventoryAccountEntity model)
 {
     return(dal.Add(model));
 }