Example #1
0
    /// <summary>
    /// Mail for Approval
    /// </summary>
    private void ApprovalMail()
    {
        mrfDetail = (BusinessEntities.MRFDetail)Session[SessionNames.MRFDETAIL_APPREJMRF];
        BusinessEntities.MRFDetail          mailDetail   = new BusinessEntities.MRFDetail();
        Rave.HR.BusinessLayer.MRF.MRFDetail mrfSummaryBL = new Rave.HR.BusinessLayer.MRF.MRFDetail();
        mailDetail      = mrfSummaryBL.GetMailingDetails(mrfDetail);
        EmployeeEmailId = mailDetail.EmailId;
        RaisedByEmailId = mailDetail.RaisedBy;
        int[]   IDs;
        Boolean B_ClientName = false;
        string  ClientName   = string.Empty;

        //Added by Kanchan for the requirment specified in the Discussion with Sawita Kamath and Gaurav Thakkar.
        // Requirment raised: When a mrf is approved the approval mail should go to the reporting to.
        if (mailDetail.ReportingToId != null)
        {
            if (mailDetail.ReportingToId.Contains(","))
            {
                // countOfReportingTo = mailDetail.ReportingToId.LastIndexOf(",");
                string[] allReportingTo;
                allReportingTo     = mailDetail.ReportingToId.Split(',');
                countOfReportingTo = allReportingTo.Length;
                IDs = new int[countOfReportingTo];
                ReportingToByEmailId_PM = new string[countOfReportingTo];

                for (int i = 0; i < countOfReportingTo; i++)
                {
                    IDs[i] = Convert.ToInt32(allReportingTo[i].ToString());
                    ReportingToByEmailId_PM[i] = getMailID(IDs[i]);
                }
            }
            else
            {
                ReportingToByEmailId = getMailID(Convert.ToInt32(mailDetail.ReportingToId));
            }
            raveHRCollection = new BusinessEntities.RaveHRCollection();

            raveHRCollection = mrfSummaryBL.GetProjectManagerByProjectId(mailDetail);
            BusinessEntities.MRFDetail forPm = new BusinessEntities.MRFDetail();
            string Mail = string.Empty;
            MailPM = string.Empty;
            foreach (BusinessEntities.MRFDetail mrf in raveHRCollection)
            {
                Mail  = string.Empty;
                forPm = (BusinessEntities.MRFDetail)raveHRCollection.Item(0);
                if (!forPm.PmID.Contains(","))
                {
                    Mail = getMailID(Convert.ToInt32(forPm.EmployeeId));
                }
                else
                {
                    string[] MailsForPm = forPm.PmID.Split(',');
                    foreach (string id in MailsForPm)
                    {
                        Mail += getMailID(Convert.ToInt32(id)) + ",";
                    }
                }
                MailPM += "," + Mail;
                if (MailPM.EndsWith(","))
                {
                    MailPM = MailPM.TrimEnd(',');
                }
            }
        }

        //Siddharth 26-02-2015 Start
        ClientName = mrfDetail.ClientName;
        if (ClientName.ToUpper().Contains("NPS") || ClientName.ToUpper().Contains("NORTHGATE"))
        {
            B_ClientName = true;
        }
        //Siddharth 26-02-2015 End

        #region Coded By Sameer For New MailFunctionality

        Rave.HR.BusinessLayer.MRF.MRFDetail objBLMRF = new Rave.HR.BusinessLayer.MRF.MRFDetail();
        objBLMRF.SendMailToWhizibleForInternalResourceAllocation(mrfDetail, mailDetail, B_ClientName);

        #endregion Coded By Sameer For New MailFunctionality
    }