示例#1
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(XHD.Model.scm_spe_supply_set model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update scm_spe_supply_set set ");
            strSql.Append("suppliers_id=@suppliers_id,");
            strSql.Append("suppliers_name=@suppliers_name,");
            strSql.Append("limit_money=@limit_money,");
            strSql.Append("limit_date=@limit_date,");
            strSql.Append("operation_id=@operation_id,");
            strSql.Append("operation_name=@operation_name,");
            strSql.Append("factory_id=@factory_id");
            strSql.Append(" where id=@id ");
            MySqlParameter[] parameters =
            {
                new MySqlParameter("@suppliers_id",   MySqlDbType.Int32,   11),
                new MySqlParameter("@suppliers_name", MySqlDbType.VarChar, 50),
                new MySqlParameter("@limit_money",    MySqlDbType.Decimal, 18),
                new MySqlParameter("@limit_date",     MySqlDbType.Int32,   11),
                new MySqlParameter("@operation_id",   MySqlDbType.Int32,   11),
                new MySqlParameter("@operation_name", MySqlDbType.VarChar, 50),
                new MySqlParameter("@factory_id",     MySqlDbType.VarChar, 50),
                new MySqlParameter("@id",             MySqlDbType.Int32, 11)
            };
            parameters[0].Value = model.suppliers_id;
            parameters[1].Value = model.suppliers_name;
            parameters[2].Value = model.limit_money;
            parameters[3].Value = model.limit_date;
            parameters[4].Value = model.operation_id;
            parameters[5].Value = model.operation_name;
            parameters[6].Value = model.factory_id;
            parameters[7].Value = model.id;

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

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
示例#2
0
 /// <summary>
 /// 得到一个对象实体
 /// </summary>
 public XHD.Model.scm_spe_supply_set DataRowToModel(DataRow row)
 {
     XHD.Model.scm_spe_supply_set model = new XHD.Model.scm_spe_supply_set();
     if (row != null)
     {
         if (row["id"] != null && row["id"].ToString() != "")
         {
             model.id = int.Parse(row["id"].ToString());
         }
         if (row["factory_id"] != null)
         {
             model.factory_id = row["factory_id"].ToString();
         }
         if (row["suppliers_id"] != null && row["suppliers_id"].ToString() != "")
         {
             model.suppliers_id = int.Parse(row["suppliers_id"].ToString());
         }
         if (row["suppliers_name"] != null)
         {
             model.suppliers_name = row["suppliers_name"].ToString();
         }
         if (row["limit_money"] != null && row["limit_money"].ToString() != "")
         {
             model.limit_money = decimal.Parse(row["limit_money"].ToString());
         }
         if (row["limit_date"] != null && row["limit_date"].ToString() != "")
         {
             model.limit_date = int.Parse(row["limit_date"].ToString());
         }
         if (row["operation_id"] != null && row["operation_id"].ToString() != "")
         {
             model.operation_id = int.Parse(row["operation_id"].ToString());
         }
         if (row["operation_name"] != null)
         {
             model.operation_name = row["operation_name"].ToString();
         }
     }
     return(model);
 }
示例#3
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public bool Add(XHD.Model.scm_spe_supply_set model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into scm_spe_supply_set(");
            strSql.Append("id,suppliers_id,suppliers_name,limit_money,limit_date,operation_id,operation_name,factory_id)");
            strSql.Append(" values (");
            strSql.Append("@id,@suppliers_id,@suppliers_name,@limit_money,@limit_date,@operation_id,@operation_name,@factory_id)");
            MySqlParameter[] parameters =
            {
                new MySqlParameter("@id",             MySqlDbType.Int32,   11),
                new MySqlParameter("@suppliers_id",   MySqlDbType.Int32,   11),
                new MySqlParameter("@suppliers_name", MySqlDbType.VarChar, 50),
                new MySqlParameter("@limit_money",    MySqlDbType.Decimal, 18),
                new MySqlParameter("@limit_date",     MySqlDbType.Int32,   11),
                new MySqlParameter("@operation_id",   MySqlDbType.Int32,   11),
                new MySqlParameter("@operation_name", MySqlDbType.VarChar, 50),
                new MySqlParameter("@factory_id",     MySqlDbType.VarChar, 50)
            };
            parameters[0].Value = model.id;
            parameters[1].Value = model.suppliers_id;
            parameters[2].Value = model.suppliers_name;
            parameters[3].Value = model.limit_money;
            parameters[4].Value = model.limit_date;
            parameters[5].Value = model.operation_id;
            parameters[6].Value = model.operation_name;
            parameters[7].Value = model.factory_id;

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

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

            strSql.Append("select id,suppliers_id,suppliers_name,limit_money,limit_date,operation_id,operation_name,factory_id from scm_spe_supply_set ");
            strSql.Append(" where id=@id ");
            MySqlParameter[] parameters =
            {
                new MySqlParameter("@id", MySqlDbType.Int32, 11)
            };
            parameters[0].Value = id;

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

            if (ds.Tables[0].Rows.Count > 0)
            {
                return(DataRowToModel(ds.Tables[0].Rows[0]));
            }
            else
            {
                return(null);
            }
        }