Exemplo n.º 1
0
        private void SendSubmitMail(int loggedinUser, int empId, string msg)
        {
            var objApr = new Appraisal();
            EmailActivityBOL objEmailActivityBOL = new EmailActivityBOL();
            DataSet          dsGetMailInfo       = new DataSet();
            EmailActivityBLL objEmailActivityBLL = new EmailActivityBLL();
            EmailActivity    objEmailActivity    = new EmailActivity();

            char[] separator = new char[] { ';' };

            if (msg.ToLower().Contains("appraisal submitted to closure"))
            {
                dsGetMailInfo = objApr.GetMailDetails(loggedinUser, empId, "complete");
            }
            else
            {
                dsGetMailInfo = objApr.GetMailDetails(loggedinUser, empId, "");
            }

            objEmailActivityBOL.FromAddress = (dsGetMailInfo.Tables[0].Rows[0]["FromAddress"].ToString());
            objEmailActivityBOL.CCID        = ConfigurationManager.AppSettings["HR-ADMIN"].ToString();

            //string[] cc = ConfigurationManager.AppSettings["HR-ADMIN"].ToString().Split(';');

            //for (int i = 0; i < cc.Length; i++)
            //{
            //    if (cc[i] != "")
            //    {
            //        objEmailActivityBOL.CCAddress[i] =cc[i];
            //    }
            //}

            objEmailActivityBOL.EmailTemplateName = (dsGetMailInfo.Tables[0].Rows[0]["EmailTemplateName"].ToString());

            // dsGetMailInfo = objEmailActivityBLL.GetMailInfo(objEmailActivityBOL);
            objEmailActivityBOL.ToAddress = (dsGetMailInfo.Tables[0].Rows[0]["ToAddress"].ToString()).Split(separator);
            objEmailActivityBOL.Subject   = (dsGetMailInfo.Tables[0].Rows[0]["EmailSubject"].ToString());
            objEmailActivityBOL.Body      = (dsGetMailInfo.Tables[0].Rows[0]["EmailBody"].ToString());

            try
            {
                objEmailActivity.SendSubmitMail(objEmailActivityBOL, (dsGetMailInfo.Tables[0].Rows[0]["toName"].ToString()), (dsGetMailInfo.Tables[0].Rows[0]["EmployeeName"].ToString()), (dsGetMailInfo.Tables[0].Rows[0]["EmployeeCode"].ToString()));
            }
            catch (System.Exception ex)
            {
                throw new Exception("Appraisal Submitted to next stage but failed to send mail.");
            }
        }
Exemplo n.º 2
0
        private void SendInitiationMail(List <ProbableList> lstAppr)
        {
            try
            {
                EmailActivityBOL objEmailActivityBOL = new EmailActivityBOL();
                DataSet          dsGetMailInfo       = new DataSet();
                EmailActivityBLL objEmailActivityBLL = new EmailActivityBLL();
                EmailActivity    objEmailActivity    = new EmailActivity();

                char[] separator  = new char[] { ';' };
                string failureMsg = "\r\nCandidates initiated but mail sending failed for : ";
                foreach (ProbableList itemAppr in lstAppr)
                {
                    objEmailActivityBOL.ToID = objEmailActivityBOL.ToID + itemAppr.EID.ToString() + ";";
                    //objApr.getMailID(itemAppr.EID);
                }
                objEmailActivityBOL.FromAddress       = "*****@*****.**";
                objEmailActivityBOL.CCID              = ConfigurationManager.AppSettings["HR-ADMIN"].ToString();
                objEmailActivityBOL.EmailTemplateName = "Appraisal Initiate";

                dsGetMailInfo = objEmailActivityBLL.GetMailInfo(objEmailActivityBOL);
                objEmailActivityBOL.ToAddress = (dsGetMailInfo.Tables[0].Rows[0]["ToAddress"].ToString()).Split(separator);
                objEmailActivityBOL.Subject   = (dsGetMailInfo.Tables[0].Rows[0]["EmailSubject"].ToString());
                objEmailActivityBOL.Body      = (dsGetMailInfo.Tables[0].Rows[0]["EmailBody"].ToString());
                objEmailActivityBOL.CCAddress = (dsGetMailInfo.Tables[0].Rows[0]["CCAddress"].ToString()).Split(separator);

                try
                {
                    objEmailActivity.SendMail(objEmailActivityBOL);
                }
                catch (System.Exception ex)
                {
                    failureMsg = failureMsg + objEmailActivityBOL.ToAddress;
                }
            }
            catch (Exception ex) { throw ex; }
        }