public int UpdatePartnerUserPasswordByUserID_Modified(PartnerUserPassword obj) { string sql = @"UPDATE [BE_PartnerUserPassword] SET [Password]=@Password , [ModifiedBy]=@ModifiedBy WHERE [UserID]=@UserID AND [Modified]=@Modified" ; SqlCommand cmd = new SqlCommand(sql, this.conn, this.trans); SqlParameter pPassword = new SqlParameter("Password", Convert2DBnull(obj.Password)); pPassword.SqlDbType = SqlDbType.NVarChar; cmd.Parameters.Add(pPassword); SqlParameter pModifiedBy = new SqlParameter("ModifiedBy", Convert2DBnull(obj.ModifiedBy)); pModifiedBy.SqlDbType = SqlDbType.NVarChar; cmd.Parameters.Add(pModifiedBy); SqlParameter pUserID = new SqlParameter("UserID", Convert2DBnull(obj.UserID)); pUserID.SqlDbType = SqlDbType.UniqueIdentifier; cmd.Parameters.Add(pUserID); SqlParameter pModified = new SqlParameter("Modified", Convert2DBnull(obj.Modified)); pModified.SqlDbType = SqlDbType.DateTime; cmd.Parameters.Add(pModified); return(cmd.ExecuteNonQuery()); }
public int InsertPartnerUserPassword(PartnerUserPassword obj) { string sql = @"INSERT INTO[BE_PartnerUserPassword]([UserID] , [Password] , [Modified] , [ModifiedBy] ) VALUES(@UserID , @Password , @Modified , @ModifiedBy )" ; SqlCommand cmd = new SqlCommand(sql, this.conn, this.trans); SqlParameter pUserID = new SqlParameter("UserID", Convert2DBnull(obj.UserID)); pUserID.SqlDbType = SqlDbType.UniqueIdentifier; cmd.Parameters.Add(pUserID); SqlParameter pPassword = new SqlParameter("Password", Convert2DBnull(obj.Password)); pPassword.SqlDbType = SqlDbType.NVarChar; cmd.Parameters.Add(pPassword); SqlParameter pModified = new SqlParameter("Modified", Convert2DBnull(obj.Modified)); pModified.SqlDbType = SqlDbType.DateTime; cmd.Parameters.Add(pModified); SqlParameter pModifiedBy = new SqlParameter("ModifiedBy", Convert2DBnull(obj.ModifiedBy)); pModifiedBy.SqlDbType = SqlDbType.NVarChar; cmd.Parameters.Add(pModifiedBy); return(cmd.ExecuteNonQuery()); }
public int LoadPartnerUserPasswordByUserID_Modified(PartnerUserPassword obj) { string sql = @"SELECT [UserID] , [Password] , [Modified] , [ModifiedBy] FROM [BE_PartnerUserPassword] WITH(NOLOCK) WHERE [UserID]=@UserID AND [Modified]=@Modified" ; SqlCommand cmd = new SqlCommand(sql, this.conn, this.trans); SqlParameter pUserID = new SqlParameter("UserID", Convert2DBnull(obj.UserID)); pUserID.SqlDbType = SqlDbType.UniqueIdentifier; cmd.Parameters.Add(pUserID); SqlParameter pModified = new SqlParameter("Modified", Convert2DBnull(obj.Modified)); pModified.SqlDbType = SqlDbType.DateTime; cmd.Parameters.Add(pModified); int ret = 0; SqlDataReader dr = cmd.ExecuteReader(); try { while (dr.Read()) { if (!Convert.IsDBNull(dr["UserID"])) { obj.UserID = (Guid)dr["UserID"]; } obj.Password = dr["Password"].ToString(); if (!Convert.IsDBNull(dr["Modified"])) { obj.Modified = (DateTime)dr["Modified"]; } obj.ModifiedBy = dr["ModifiedBy"].ToString(); ret += 1; } } finally { dr.Close(); } return(ret); }
public List <PartnerUserPassword> LoadPartnerUserPasswordsByModifiedBy(string modifiedBy) { string sql = @"SELECT [UserID] , [Password] , [Modified] , [ModifiedBy] FROM [BE_PartnerUserPassword] WHERE [ModifiedBy]=@ModifiedBy" ; SqlCommand cmd = new SqlCommand(sql, this.conn, this.trans); SqlParameter pModifiedBy = new SqlParameter("ModifiedBy", modifiedBy); pModifiedBy.SqlDbType = SqlDbType.NVarChar; cmd.Parameters.Add(pModifiedBy); List <PartnerUserPassword> ret = new List <PartnerUserPassword>(); SqlDataReader dr = cmd.ExecuteReader(); try { while (dr.Read()) { PartnerUserPassword iret = new PartnerUserPassword(); if (!Convert.IsDBNull(dr["UserID"])) { iret.UserID = (Guid)dr["UserID"]; } iret.Password = dr["Password"].ToString(); if (!Convert.IsDBNull(dr["Modified"])) { iret.Modified = (DateTime)dr["Modified"]; } iret.ModifiedBy = dr["ModifiedBy"].ToString(); ret.Add(iret); } } finally { dr.Close(); } return(ret); }