/// <summary> /// Contracts Event Mail reminder /// </summary> /// <createdBy>Bobis</createdBy> /// <createdDate>Apr 15 2014</createdDate> public static void ContractsEventsMailSending() { List <int> recevierIds = null; List <MailMatrixResponseParam> lstContractEventsDetails = new List <MailMatrixResponseParam>(); MailMatrixResponseParam lstreceipentUserID = new MailMatrixResponseParam(); try { string url = DecisionPointRepository.GetSiteUrl(); var location = System.Reflection.Assembly.GetEntryAssembly().Location; var directoryPath = Path.GetDirectoryName(location); DecisionPointRepository objdecisionPointRepository = new DecisionPointRepository(); lstContractEventsDetails = objdecisionPointRepository.ContractsEventsMailSending().Select(x => new MailMatrixResponseParam { Recevier = x.OwnerName, Sender = x.ManagerName, TblId = x.Id, SenderId = x.CreatedBy }).ToList(); string body = string.Empty; string subject = string.Empty; for (int iCounter = 0; iCounter < lstContractEventsDetails.Count; iCounter++) { if (!object.Equals(lstContractEventsDetails[iCounter].Recevier, null)) { recevierIds = lstContractEventsDetails[iCounter].Recevier.Split(',').Select(x => int.Parse(x)).ToList(); foreach (int item in recevierIds) { lstreceipentUserID = objdecisionPointRepository.GetAdminProfile(item).Select(x => new MailMatrixResponseParam { Recevier = x.FirstName, RecevierEmail = x.Email, }).FirstOrDefault(); string signature = objdecisionPointRepository.GetSignature(lstContractEventsDetails[iCounter].SenderId); if (signature != null) { string[] sign = signature.Split(new string[] { "body>" }, StringSplitOptions.None); subject = "Contract Reminder Mail"; signature = sign[1].Substring(0, sign[1].Length - 2); MailInviteFormat objMailInviteFormat = new MailInviteFormat() { PersonName = lstContractEventsDetails[iCounter].Recevier, Signature = signature, InviteeCompanyName = lstContractEventsDetails[iCounter].Sender, DueDate = Convert.ToString(lstContractEventsDetails[iCounter].DueDate, CultureInfo.InvariantCulture), DomainUrl = url }; objMailInviteFormat.FilePath = directoryPath + Convert.ToString(ConfigurationManager.AppSettings["StaffInviteMailAlert"], CultureInfo.InvariantCulture); if (!string.IsNullOrEmpty(lstreceipentUserID.Recevier)) { objMailInviteFormat.Action = "You have received " + subject + " from " + lstContractEventsDetails[iCounter].Sender + ". Please complete it."; body = DPInviteMailFormat.PersonInviteMailFormat(objMailInviteFormat); //body = "<div style='line-height:25px'>To: " + lstreceipentUserID.Recevier + "<br/>From: " + // lstContractEventsDetails[iCounter].Sender + "<br/>Subject: '" + subject + "'<br/><br/>" + lstreceipentUserID.Recevier + // "Dear " + lstreceipentUserID.Recevier + ",<br/> you have received a '" + subject + "' from " + lstContractEventsDetails[iCounter].Sender + ". Please log at compliance tracker and review.<br/><br/></br></br>" + // signature + "</div>"; } BusinessCore.GetSmtpDetail(lstreceipentUserID.RecevierEmail, body, subject); //update last invite date and next mail sending date in contracts log UpdateContractLogInviteDate(lstContractEventsDetails[iCounter].TblId); } } } } } catch { throw; } }