/// <summary> /// 将DataRedar转换为List /// </summary> private List <MyCreek.Data.Model.UsersInfo> DataReaderToList(OracleDataReader dataReader) { List <MyCreek.Data.Model.UsersInfo> List = new List <MyCreek.Data.Model.UsersInfo>(); MyCreek.Data.Model.UsersInfo model = null; while (dataReader.Read()) { model = new MyCreek.Data.Model.UsersInfo(); model.UserID = dataReader.GetString(0).ToGuid(); if (!dataReader.IsDBNull(1)) { model.Officer = dataReader.GetString(1); } if (!dataReader.IsDBNull(2)) { model.Tel = dataReader.GetString(2); } if (!dataReader.IsDBNull(3)) { model.Fax = dataReader.GetString(3); } if (!dataReader.IsDBNull(4)) { model.Address = dataReader.GetString(4); } if (!dataReader.IsDBNull(5)) { model.Email = dataReader.GetString(5); } if (!dataReader.IsDBNull(6)) { model.QQ = dataReader.GetString(6); } if (!dataReader.IsDBNull(7)) { model.MSN = dataReader.GetString(7); } if (!dataReader.IsDBNull(8)) { model.Note = dataReader.GetString(8); } List.Add(model); } return(List); }
/// <summary> /// 更新记录 /// </summary> /// <param name="model">MyCreek.Data.Model.UsersInfo实体类</param> public int Update(MyCreek.Data.Model.UsersInfo model) { string sql = @"UPDATE UsersInfo SET Officer=:Officer,Tel=:Tel,Fax=:Fax,Address=:Address,Email=:Email,QQ=:QQ,MSN=:MSN,Note=:Note WHERE UserID=:UserID" ; OracleParameter[] parameters = new OracleParameter[] { model.Officer == null ? new OracleParameter(":Officer", OracleDbType.NVarchar2, 1000) { Value = DBNull.Value } : new OracleParameter(":Officer", OracleDbType.NVarchar2, 1000) { Value = model.Officer }, model.Tel == null ? new OracleParameter(":Tel", OracleDbType.Varchar2, 500) { Value = DBNull.Value } : new OracleParameter(":Tel", OracleDbType.Varchar2, 500) { Value = model.Tel }, model.Fax == null ? new OracleParameter(":Fax", OracleDbType.Varchar2, 500) { Value = DBNull.Value } : new OracleParameter(":Fax", OracleDbType.Varchar2, 500) { Value = model.Fax }, model.Address == null ? new OracleParameter(":Address", OracleDbType.Varchar2, 500) { Value = DBNull.Value } : new OracleParameter(":Address", OracleDbType.Varchar2, 500) { Value = model.Address }, model.Email == null ? new OracleParameter(":Email", OracleDbType.Varchar2, 50) { Value = DBNull.Value } : new OracleParameter(":Email", OracleDbType.Varchar2, 50) { Value = model.Email }, model.QQ == null ? new OracleParameter(":QQ", OracleDbType.Varchar2, 50) { Value = DBNull.Value } : new OracleParameter(":QQ", OracleDbType.Varchar2, 50) { Value = model.QQ }, model.MSN == null ? new OracleParameter(":MSN", OracleDbType.Varchar2, 50) { Value = DBNull.Value } : new OracleParameter(":MSN", OracleDbType.Varchar2, 50) { Value = model.MSN }, model.Note == null ? new OracleParameter(":Note", OracleDbType.NVarchar2) { Value = DBNull.Value } : new OracleParameter(":Note", OracleDbType.NVarchar2) { Value = model.Note }, new OracleParameter(":UserID", OracleDbType.Varchar2, 40) { Value = model.UserID } }; return(dbHelper.Execute(sql, parameters)); }
/// <summary> /// 添加记录 /// </summary> /// <param name="model">MyCreek.Data.Model.UsersInfo实体类</param> /// <returns>操作所影响的行数</returns> public int Add(MyCreek.Data.Model.UsersInfo model) { string sql = @"INSERT INTO UsersInfo (UserID,Officer,Tel,Fax,Address,Email,QQ,MSN,Note) VALUES(:UserID,:Officer,:Tel,:Fax,:Address,:Email,:QQ,:MSN,:Note)" ; OracleParameter[] parameters = new OracleParameter[] { new OracleParameter(":UserID", OracleDbType.Varchar2, 40) { Value = model.UserID }, model.Officer == null ? new OracleParameter(":Officer", OracleDbType.NVarchar2, 1000) { Value = DBNull.Value } : new OracleParameter(":Officer", OracleDbType.NVarchar2, 1000) { Value = model.Officer }, model.Tel == null ? new OracleParameter(":Tel", OracleDbType.Varchar2, 500) { Value = DBNull.Value } : new OracleParameter(":Tel", OracleDbType.Varchar2, 500) { Value = model.Tel }, model.Fax == null ? new OracleParameter(":Fax", OracleDbType.Varchar2, 500) { Value = DBNull.Value } : new OracleParameter(":Fax", OracleDbType.Varchar2, 500) { Value = model.Fax }, model.Address == null ? new OracleParameter(":Address", OracleDbType.Varchar2, 500) { Value = DBNull.Value } : new OracleParameter(":Address", OracleDbType.Varchar2, 500) { Value = model.Address }, model.Email == null ? new OracleParameter(":Email", OracleDbType.Varchar2, 50) { Value = DBNull.Value } : new OracleParameter(":Email", OracleDbType.Varchar2, 50) { Value = model.Email }, model.QQ == null ? new OracleParameter(":QQ", OracleDbType.Varchar2, 50) { Value = DBNull.Value } : new OracleParameter(":QQ", OracleDbType.Varchar2, 50) { Value = model.QQ }, model.MSN == null ? new OracleParameter(":MSN", OracleDbType.Varchar2, 50) { Value = DBNull.Value } : new OracleParameter(":MSN", OracleDbType.Varchar2, 50) { Value = model.MSN }, model.Note == null ? new OracleParameter(":Note", OracleDbType.NVarchar2) { Value = DBNull.Value } : new OracleParameter(":Note", OracleDbType.NVarchar2) { Value = model.Note } }; return(dbHelper.Execute(sql, parameters)); }
/// <summary> /// 更新记录 /// </summary> /// <param name="model">MyCreek.Data.Model.UsersInfo实体类</param> public int Update(MyCreek.Data.Model.UsersInfo model) { string sql = @"UPDATE UsersInfo SET Officer=@Officer,Tel=@Tel,Fax=@Fax,Address=@Address,Email=@Email,QQ=@QQ,MSN=@MSN,Note=@Note WHERE UserID=@UserID" ; SqlParameter[] parameters = new SqlParameter[] { model.Officer == null ? new SqlParameter("@Officer", SqlDbType.NVarChar, 1000) { Value = DBNull.Value } : new SqlParameter("@Officer", SqlDbType.NVarChar, 1000) { Value = model.Officer }, model.Tel == null ? new SqlParameter("@Tel", SqlDbType.VarChar, 500) { Value = DBNull.Value } : new SqlParameter("@Tel", SqlDbType.VarChar, 500) { Value = model.Tel }, model.Fax == null ? new SqlParameter("@Fax", SqlDbType.VarChar, 500) { Value = DBNull.Value } : new SqlParameter("@Fax", SqlDbType.VarChar, 500) { Value = model.Fax }, model.Address == null ? new SqlParameter("@Address", SqlDbType.VarChar, 500) { Value = DBNull.Value } : new SqlParameter("@Address", SqlDbType.VarChar, 500) { Value = model.Address }, model.Email == null ? new SqlParameter("@Email", SqlDbType.VarChar, 50) { Value = DBNull.Value } : new SqlParameter("@Email", SqlDbType.VarChar, 50) { Value = model.Email }, model.QQ == null ? new SqlParameter("@QQ", SqlDbType.VarChar, 50) { Value = DBNull.Value } : new SqlParameter("@QQ", SqlDbType.VarChar, 50) { Value = model.QQ }, model.MSN == null ? new SqlParameter("@MSN", SqlDbType.VarChar, 50) { Value = DBNull.Value } : new SqlParameter("@MSN", SqlDbType.VarChar, 50) { Value = model.MSN }, model.Note == null ? new SqlParameter("@Note", SqlDbType.NVarChar, -1) { Value = DBNull.Value } : new SqlParameter("@Note", SqlDbType.NVarChar, -1) { Value = model.Note }, new SqlParameter("@UserID", SqlDbType.UniqueIdentifier, -1) { Value = model.UserID } }; return(dbHelper.Execute(sql, parameters)); }
/// <summary> /// 添加记录 /// </summary> /// <param name="model">MyCreek.Data.Model.UsersInfo实体类</param> /// <returns>操作所影响的行数</returns> public int Add(MyCreek.Data.Model.UsersInfo model) { string sql = @"INSERT INTO UsersInfo (UserID,Officer,Tel,Fax,Address,Email,QQ,MSN,Note) VALUES(@UserID,@Officer,@Tel,@Fax,@Address,@Email,@QQ,@MSN,@Note)" ; SqlParameter[] parameters = new SqlParameter[] { new SqlParameter("@UserID", SqlDbType.UniqueIdentifier, -1) { Value = model.UserID }, model.Officer == null ? new SqlParameter("@Officer", SqlDbType.NVarChar, 1000) { Value = DBNull.Value } : new SqlParameter("@Officer", SqlDbType.NVarChar, 1000) { Value = model.Officer }, model.Tel == null ? new SqlParameter("@Tel", SqlDbType.VarChar, 500) { Value = DBNull.Value } : new SqlParameter("@Tel", SqlDbType.VarChar, 500) { Value = model.Tel }, model.Fax == null ? new SqlParameter("@Fax", SqlDbType.VarChar, 500) { Value = DBNull.Value } : new SqlParameter("@Fax", SqlDbType.VarChar, 500) { Value = model.Fax }, model.Address == null ? new SqlParameter("@Address", SqlDbType.VarChar, 500) { Value = DBNull.Value } : new SqlParameter("@Address", SqlDbType.VarChar, 500) { Value = model.Address }, model.Email == null ? new SqlParameter("@Email", SqlDbType.VarChar, 50) { Value = DBNull.Value } : new SqlParameter("@Email", SqlDbType.VarChar, 50) { Value = model.Email }, model.QQ == null ? new SqlParameter("@QQ", SqlDbType.VarChar, 50) { Value = DBNull.Value } : new SqlParameter("@QQ", SqlDbType.VarChar, 50) { Value = model.QQ }, model.MSN == null ? new SqlParameter("@MSN", SqlDbType.VarChar, 50) { Value = DBNull.Value } : new SqlParameter("@MSN", SqlDbType.VarChar, 50) { Value = model.MSN }, model.Note == null ? new SqlParameter("@Note", SqlDbType.NVarChar, -1) { Value = DBNull.Value } : new SqlParameter("@Note", SqlDbType.NVarChar, -1) { Value = model.Note } }; return(dbHelper.Execute(sql, parameters)); }
/// <summary> /// 更新 /// </summary> public int Update(MyCreek.Data.Model.UsersInfo model) { return(dataUsersInfo.Update(model)); }
/// <summary> /// 新增 /// </summary> public int Add(MyCreek.Data.Model.UsersInfo model) { return(dataUsersInfo.Add(model)); }