/// <summary> /// 更新一条数据 /// </summary> public bool Update(Model.syn_queue model) { StringBuilder strSql = new StringBuilder(); strSql.Append("update syn_queue set "); strSql.Append("queid=@queid,"); strSql.Append("syn_state=@syn_state,"); strSql.Append("exc_state=@exc_state,"); strSql.Append("syn_direction=@syn_direction,"); strSql.Append("syn_times=@syn_times,"); strSql.Append("create_time=@create_time"); strSql.Append(" where snowid=@snowid "); MySqlParameter[] parameters = { new MySqlParameter("@queid", MySqlDbType.VarChar, 20), new MySqlParameter("@syn_state", MySqlDbType.Int32, 2), new MySqlParameter("@exc_state", MySqlDbType.Int32, 2), new MySqlParameter("@syn_direction", MySqlDbType.Int32, 2), new MySqlParameter("@syn_times", MySqlDbType.Int32, 2), new MySqlParameter("@create_time", MySqlDbType.DateTime), new MySqlParameter("@snowid", MySqlDbType.VarChar, 20) }; parameters[0].Value = model.queid; parameters[1].Value = model.syn_state; parameters[2].Value = model.exc_state; parameters[3].Value = model.syn_direction; parameters[4].Value = model.syn_times; parameters[5].Value = model.create_time; parameters[6].Value = model.snowid; int rows = DbHelperMySQL.ExecuteSql(strSql.ToString(), parameters); if (rows > 0) { return(true); } else { return(false); } }
/// <summary> /// 增加一条数据 /// </summary> public bool Add(Model.syn_queue model) { StringBuilder strSql = new StringBuilder(); strSql.Append("insert into syn_queue("); strSql.Append("snowid,queid,syn_state,exc_state,syn_direction,syn_times,create_time)"); strSql.Append(" values ("); strSql.Append("@snowid,@queid,@syn_state,@exc_state,@syn_direction,@syn_times,@create_time)"); MySqlParameter[] parameters = { new MySqlParameter("@snowid", MySqlDbType.VarChar, 20), new MySqlParameter("@queid", MySqlDbType.VarChar, 20), new MySqlParameter("@syn_state", MySqlDbType.Int32, 2), new MySqlParameter("@exc_state", MySqlDbType.Int32, 2), new MySqlParameter("@syn_direction", MySqlDbType.Int32, 2), new MySqlParameter("@syn_times", MySqlDbType.Int32, 2), new MySqlParameter("@create_time", MySqlDbType.DateTime) }; parameters[0].Value = model.snowid; parameters[1].Value = model.queid; parameters[2].Value = model.syn_state; parameters[3].Value = model.exc_state; parameters[4].Value = model.syn_direction; parameters[5].Value = model.syn_times; parameters[6].Value = model.create_time; int rows = DbHelperMySQL.ExecuteSql(strSql.ToString(), parameters); if (rows > 0) { return(true); } else { return(false); } }
/// <summary> /// 得到一个对象实体 /// </summary> public Model.syn_queue DataRowToModel(DataRow row) { Model.syn_queue model = new Model.syn_queue(); if (row != null) { if (row["snowid"] != null) { model.snowid = row["snowid"].ToString(); } if (row["queid"] != null) { model.queid = row["queid"].ToString(); } if (row["syn_state"] != null && row["syn_state"].ToString() != "") { model.syn_state = int.Parse(row["syn_state"].ToString()); } if (row["exc_state"] != null && row["exc_state"].ToString() != "") { model.exc_state = int.Parse(row["exc_state"].ToString()); } if (row["syn_direction"] != null && row["syn_direction"].ToString() != "") { model.syn_direction = int.Parse(row["syn_direction"].ToString()); } if (row["syn_times"] != null && row["syn_times"].ToString() != "") { model.syn_times = int.Parse(row["syn_times"].ToString()); } if (row["create_time"] != null && row["create_time"].ToString() != "") { model.create_time = DateTime.Parse(row["create_time"].ToString()); } } return(model); }
/// <summary> /// 得到一个对象实体 /// </summary> public Model.syn_queue GetModel(string snowid) { StringBuilder strSql = new StringBuilder(); strSql.Append("select snowid,queid,syn_state,exc_state,syn_direction,syn_times,create_time from syn_queue "); strSql.Append(" where snowid=@snowid "); MySqlParameter[] parameters = { new MySqlParameter("@snowid", MySqlDbType.VarChar, 20) }; parameters[0].Value = snowid; Model.syn_queue model = new Model.syn_queue(); DataSet ds = DbHelperMySQL.Query(strSql.ToString(), parameters); if (ds.Tables[0].Rows.Count > 0) { return(DataRowToModel(ds.Tables[0].Rows[0])); } else { return(null); } }
/// <summary> /// 更新一条数据 /// </summary> public bool Update(Model.syn_queue model) { return(dal.Update(model)); }
/// <summary> /// 增加一条数据 /// </summary> public bool Add(Model.syn_queue model) { return(dal.Add(model)); }