/// <summary> /// 查找为删除的邮件数量 /// </summary> /// <param name="userid"></param> /// <param name="tran"></param> /// <returns></returns> public CounntModel GetUnReadEmailDeleteCount(string userid, IDbTransaction tran) { //总共有多少发件和多少未读取的邮件 StringBuilder sqlStr_Count = new StringBuilder(); sqlStr_Count.AppendFormat(@"SELECT count(*) as readCount from B_Email where whosEmailId='{0}' and Mail_Deleted='1' union all ( SELECT count(*) as totalcount from B_Email a where whosEmailId='{0}' and Mail_Deleted='1' and Mail_IsSee='0')", userid); DataSet CountDataSet = Utility.Database.ExcuteDataSet(sqlStr_Count.ToString(), tran); DataTable countDataTable = CountDataSet.Tables[0]; CounntModel countModel = new B_Email_One_Svc.CounntModel(); countModel.totalCount = countDataTable.Rows[0][0].ToString(); countModel.unReadCount = countDataTable.Rows[1][0].ToString(); return countModel; }
/// <summary> /// 读取未读取的发件数量 /// </summary> /// <param name="userid"></param> /// <returns></returns> public CounntModel GetUnReadEmailCount(string userid, IDbTransaction tran, string emailType) { //总共有多少发件和多少未读取的邮件 StringBuilder sqlStr_Count = new StringBuilder(); //草稿箱 if (emailType == "chaogao") { sqlStr_Count.AppendFormat(@"SELECT count(*) as readCount from B_Email where whosEmailId='{0}' and Mail_Deleted='1' union all ( SELECT count(*) as totalcount from B_Email a where whosEmailId='{0}' and Mail_Deleted='1' and Mail_IsSee='0')", userid); } //我的文件夹 else if (emailType == "emailDocument") { return null; } else { sqlStr_Count.AppendFormat(@"SELECT count(*) as readCount from B_Email a where Mail_Deleted=0 and whosEmailId='{0}' and MailDocumentType = '{1}' union all ( SELECT count(*) as totalcount from B_Email a where Mail_Deleted=0 and whosEmailId='{0}' and MailDocumentType = '{1}' and Mail_IsSee =0)", userid, emailType); } DataSet CountDataSet = Utility.Database.ExcuteDataSet(sqlStr_Count.ToString(), tran); DataTable countDataTable = CountDataSet.Tables[0]; CounntModel countModel = new B_Email_One_Svc.CounntModel(); countModel.totalCount = countDataTable.Rows[0][0].ToString(); countModel.unReadCount = countDataTable.Rows[1][0].ToString(); return countModel; }