/// <summary> /// This function extracts the smses and emails /// </summary> /// <param name="dr"></param> /// <returns></returns> // ReSharper disable once FunctionComplexityOverflow private static ContactEmailSms ExtractEmailSms(DataRow dr) { var obj = new ContactEmailSms { TotalCount = (int)dr["RECORDCOUNT"], ContactName = (dr["Contact"] ?? "").ToString(), UserName = (dr["Username"] ?? "").ToString(), ConsultantName = (dr["ConsultantName"] ?? "").ToString(), Email = null, Sms = null }; if (dr["IsEmail"].ToString() == "true") { obj.Email = new ContactEmail { UserId = dr["UserId"] is DBNull ? 0 : (int)dr["UserId"], ConsultantId = dr["ConsultantId"] is DBNull ? 0 : (int)dr["ConsultantId"], RefId = (int)dr["CandidateId"], RefType = (dr["RefType"] ?? "").ToString(), EmailId = (int)dr["Id"], Subject = (dr["Subject"] ?? "").ToString(), SentDate = (DateTime)dr["SentDate"], HasAttachments = (bool)dr["HasAttachments"], EmailType = (dr["EmailType"] ?? "OUT").ToString(), }; } else { obj.Sms = new ContactSms { UserId = (int)dr["UserId"], ContactId = (int)dr["CandidateId"], SmsId = (int)dr["Id"], Message = (dr["Message"] ?? "").ToString(), SentDate = (DateTime)dr["SentDate"] }; } return obj; }
private static ContactEmailSms ExtractClientEmail(DataRow dr) { var obj = new ContactEmailSms { TotalCount = (int)dr["RECORDCOUNT"], ClientName = (dr["Client"] ?? "").ToString(), UserName = (dr["Username"] ?? "").ToString(), ConsultantName = (dr["ConsultantName"] ?? "").ToString(), Email = null, Sms = null }; obj.Email = new ContactEmail { UserId = (int)dr["UserId"], ConsultantId = (int)dr["ConsultantId"], RefId = (int)dr["ClientId"], RefType = (dr["RefType"] ?? "").ToString(), EmailId = (int)dr["Id"], Subject = (dr["Subject"] ?? "").ToString(), SentDate = (DateTime)dr["SentDate"], HasAttachments = (bool)dr["HasAttachments"] }; return obj; }