Ejemplo n.º 1
0
    private bool SendEmail
    (
        string vVendorname,
        string vVendoremail,
        string vVendoraddress,
        string vVendoraddress1,
        string vVendoraddress2,
        string vVendoraddress3,
        string vVendorcontactperson,
        string vVendorphone,
        string vVendorfax,
        int vStatus,
        string subj
    )
    {
        bool   success  = false;
        string fullname = vVendorname;
        string subject;

        //vVendoremail = "*****@*****.**";

        subject = subj;

        if (MailHelper.SendEmail(MailTemplate.GetDefaultSMTPServer(),
                                 MailHelper.ChangeToFriendlyName(ConfigurationManager.AppSettings["AdminEmailName"], ConfigurationManager.AppSettings["AdminEmailAddress"]),
                                 MailHelper.ChangeToFriendlyName(vVendorname, vVendoremail),
                                 subject,
                                 CreateBody(vStatus, vVendorname, vVendoraddress, vVendoraddress1, vVendoraddress2, vVendoraddress3, vVendorcontactperson, vVendorphone, vVendorfax),
                                 MailTemplate.GetTemplateLinkedResources(this)))
        {
            success = true;
        }

        return(success);
    }
Ejemplo n.º 2
0
        private bool SendEmailNotification(BidDetails biddetails, PurchaseOfficerInfo info)
        {
            bool success = false;

            string subject = "Trans-Asia  : Notification";

            try
            {
                if (!MailHelper.SendEmail(MailTemplate.GetDefaultSMTPServer(),
                                          MailHelper.ChangeToFriendlyName(biddetails.Creator, biddetails.CreatorEmail),
                                          MailHelper.ChangeToFriendlyName(info.Supervisor, info.EmailAdd),
                                          subject,
                                          CreateNotificationBody(),
                                          MailTemplate.GetTemplateLinkedResources(this)))
                {       // if sending failed
                    LogHelper.EventLogHelper.Log("Bid > Send Notification : Sending Failed to " + info.EmailAdd, System.Diagnostics.EventLogEntryType.Error);
                }
                else
                {       // if sending successful
                    LogHelper.EventLogHelper.Log("Bid > Send Notification : Email Sent to " + info.EmailAdd, System.Diagnostics.EventLogEntryType.Information);
                }
                success = true;
            }
            catch (Exception ex)
            {
                success = false;
                LogHelper.EventLogHelper.Log("Bid > Send Notification : " + ex.Message, System.Diagnostics.EventLogEntryType.Error);
            }

            return(success);
        }
Ejemplo n.º 3
0
    //############################################################
    //############################################################
    // SEND EMAIL NOTIFICATION TO VM RECO
    private bool SendEmailNotification(string sfromName, string sfromEmail, string stoName, string stoEmail, string sAuthenticationTicket, string sVendorName)
    {
        bool success = false;

        string from    = sfromName + "<" + sfromEmail + ">";
        string to      = stoName + "<" + stoEmail + ">";
        string subject = "";

        try
        {
            subject = "Trans-Asia VMS Accreditation application reviewed for your approval.";
            if (!MailHelper.SendEmail(MailTemplate.GetDefaultSMTPServer(),
                                      from,
                                      to,
                                      subject,
                                      CreateNotificationBody(sfromName, stoName, sAuthenticationTicket, sVendorName),
                                      MailTemplate.GetTemplateLinkedResources(this)))
            {   //if sending failed
                LogHelper.EventLogHelper.Log("Bid > Send Notification : Sending Failed to " + from, System.Diagnostics.EventLogEntryType.Error);
            }
            else
            {   //if sending successful
                LogHelper.EventLogHelper.Log("Bid > Send Notification : Email Sent to " + from, System.Diagnostics.EventLogEntryType.Information);
            }
            success = true;
        }
        catch (Exception ex)
        {
            success = false;
            LogHelper.EventLogHelper.Log("Bid > Send Notification : " + ex.Message, System.Diagnostics.EventLogEntryType.Error);
            //Response.Write(ex.ToString());
        }
        return(success);
    }
Ejemplo n.º 4
0
    private bool SendEmailInvitation(AuctionDetails auctiondetails, ArrayList recipients, ref int failedcount, ref int successcount)
    {
        bool   success = false;
        string subject = "Trans-Asia / Commnunications : Invitation to Auction";

        failedcount  = 0;
        successcount = 0;

        try
        {
            for (int i = 0; i < recipients.Count; i++)
            {
                AuctionParticipant p = (AuctionParticipant)recipients[i];

                if (!MailHelper.SendEmail(MailTemplate.GetDefaultSMTPServer(),
                                          MailHelper.ChangeToFriendlyName(auctiondetails.Creator, auctiondetails.CreatorEmail),
                                          MailHelper.ChangeToFriendlyName(p.Name, p.EmailAddress),
                                          subject,
                                          CreateInvitationBody(auctiondetails, p),
                                          MailTemplate.GetTemplateLinkedResources(this)))
                {                       // if sending failed
                    failedcount++;
                    LogHelper.EventLogHelper.Log("Auction > Send Invitation : Sending Failed to " + p.EmailAddress, System.Diagnostics.EventLogEntryType.Error);
                }
                else
                {                       // if sending successful
                    successcount++;
                    LogHelper.EventLogHelper.Log("Auction > Send Invitation : Email Sent to " + p.EmailAddress, System.Diagnostics.EventLogEntryType.Information);
                    // update sent mail count
                    SqlHelper.ExecuteNonQuery(connstring, "sp_SendEmailInvitation", new SqlParameter[] { new SqlParameter("@ParticipantId", p.ID) });
                }
            }

            success = true;
        }
        catch (Exception ex)
        {
            success = false;
            LogHelper.EventLogHelper.Log("Auction > Send Invitation : " + ex.Message, System.Diagnostics.EventLogEntryType.Error);
        }

        try
        {
            for (int j = 0; j < recipients.Count; j++)
            {
                AuctionParticipant p = (AuctionParticipant)recipients[j];

                if (SMSHelper.AreValidMobileNumbers(p.MobileNo.Trim()))
                {
                    SMSHelper.SendSMS(new SMSMessage(CreateSMSInvitationBody(auctiondetails, p).Trim(), p.MobileNo.Trim())).ToString();
                }
            }
        }
        catch (Exception ex)
        {
            LogHelper.EventLogHelper.Log("Auction > Send SMS Invitation : " + ex.Message, System.Diagnostics.EventLogEntryType.Error);
        }

        return(success);
    }
Ejemplo n.º 5
0
    private bool SendEmail(int userid)
    {
        bool   success  = false;
        string fullname = tbFirstName.Text.Trim() + " " + tbLastName.Text.Trim();

        string subject = "";

        if ((Request.QueryString["userID"] != null) && (Request.QueryString["userType"] != null))
        {
            subject = "Trans-Asias : User Profile Changed";
        }
        else
        {
            subject = "Trans-Asias : User Profile Created";
        }

        if (MailHelper.SendEmail(MailTemplate.GetDefaultSMTPServer(),
                                 MailHelper.ChangeToFriendlyName(ConfigurationManager.AppSettings["AdminEmailName"], ConfigurationManager.AppSettings["AdminEmailAddress"]),
                                 MailHelper.ChangeToFriendlyName(fullname, tbEmail.Text.Trim()),
                                 subject,
                                 CreateBody(userid),
                                 MailTemplate.GetTemplateLinkedResources(this)))
        {
            success = true;
        }

        return(success);
    }
Ejemplo n.º 6
0
    private bool SendEmail(string From, string To, string Cc, string Bcc, string Subject, string Body)
    {
        bool success = false;

        if (MailHelper.SendEmail(MailTemplate.GetDefaultSMTPServer(), From, To, Subject, Body, MailTemplate.GetTemplateLinkedResources(this)))
        {
            success = true;
        }
        return(success);
    }
Ejemplo n.º 7
0
    protected void btnSend_Click(object sender, EventArgs e)
    {
        SqlParameter[] sqlparams = new SqlParameter[1];
        sqlparams[0]       = new SqlParameter("@UserName", SqlDbType.NVarChar, 100);
        sqlparams[0].Value = txtUserName2.Text.Trim();

        DataTable dt;

        try
        {
            dt = SqlHelper.ExecuteDataset(connstring, "sp_GetUserPasswordAndEmail", sqlparams).Tables[0];

            string ePwd = dt.Rows[0]["Password"].ToString();
            string eAdd = dt.Rows[0]["EmailAddress"].ToString();

            if (ePwd.Equals("NONE") || eAdd.Equals("NONE"))
            {
                txtNote2.Text = "Username not found.";
            }
            else
            {
                string from = System.Configuration.ConfigurationManager.AppSettings["AdminEmailAddress"];
                string to   = eAdd;

                string subject = "Trans - Asia : Password Request";

                try
                {
                    if (MailHelper.SendEmail(MailTemplate.GetDefaultSMTPServer(), from, to, subject,
                                             MailTemplate.IntegrateBodyIntoTemplate(CreateRequestPasswordBody(ePwd)),
                                             MailTemplate.GetTemplateLinkedResources(this)))
                    {
                        Session["msg"] = "Password was sent to your email!";
                        LogHelper.TextLogHelper.Log("User Login > Send Password : Email Sent to " + to, LogHelper.TextLogHelper.LogType.Information);
                    }
                    else
                    {
                        Session["msg"] = "Password not sent this time.";
                        LogHelper.TextLogHelper.Log("User Login > Send Password : Sending Failed to " + to, LogHelper.TextLogHelper.LogType.Error);
                    }
                }
                catch (Exception ex)
                {
                    Session["msg"] = "Password not sent this time.";
                    LogHelper.TextLogHelper.Log("User Login > Send Password : "******"login.aspx?t=1");
            }
        }
        catch (Exception ex)
        {
            LogHelper.TextLogHelper.Log("User Login : " + ex.Message, LogHelper.TextLogHelper.LogType.Error);
        }
    }
Ejemplo n.º 8
0
    protected void btnForgotPwd_Click(object sender, EventArgs e)
    {
        DataTable dt;

        SqlParameter[] sqlparams = new SqlParameter[1];
        sqlparams[0]       = new SqlParameter("@UserName", SqlDbType.NVarChar, 100);
        sqlparams[0].Value = txtUserName.Text.Trim();

        try
        {
            dt = SqlHelper.ExecuteDataset(connString, "sp_GetUserPasswordAndEmail", sqlparams).Tables[0];

            string Pwd      = dt.Rows[0]["Password"].ToString();
            string EmailAdd = dt.Rows[0]["EmailAddress"].ToString();

            if (Pwd.Equals("NONE") || EmailAdd.Equals("NONE"))
            {
                txtNote.Text = "Username not found.";
            }
            else
            {
                string from = MailHelper.ChangeToFriendlyName(ConfigurationManager.AppSettings["AdminEmailName"], ConfigurationManager.AppSettings["AdminEmailAddress"]);
                string to   = EmailAdd;

                string subject = "Globe Telecom Vendor Accreditation : Password Request";
                try
                {
                    if (MailHelper.SendEmail(MailTemplate.GetDefaultSMTPServer(), from, to, subject, MailTemplate.IntegrateBodyIntoTemplate(CreateRequestPasswordBody(Pwd)), MailTemplate.GetTemplateLinkedResources(this)))
                    {
                        txtNote.Text = "Password sent!";
                    }
                    else
                    {
                        txtNote.Text = "Password not sent this time.";
                    }
                }
                catch
                {
                    txtNote.Text = "Password not sent this time.";
                }
                txtUserName.Text = "";
            }
        }
        catch (Exception ex)
        {
            txtNote.Text = ex.Message.ToString();
        }
    }
Ejemplo n.º 9
0
    //############################################################
    //############################################################
    // SEND EMAIL NOTIFICATION TO VENDOR IF REJECTED

    private bool SendEmailNotification()
    {
        //"From Test", "*****@*****.**", "To Test", "*****@*****.**", "13412341234", "Test CompanyName", "1000999"
        //"Judith Mercado. Ponce" <*****@*****.**>
        //"Consolacion G.. Lim" <*****@*****.**>
        //string sCommand;
        //string connstring = HttpContext.Current.Session["ConnectionString"].ToString();
        SqlDataReader oReader;
        bool          success = false;


        string fromName  = "From TestName";
        string fromEmail = "*****@*****.**";
        string from      = '"' + "From TestName" + '"' + "<*****@*****.**>";
        string toName    = "To Testname";
        string toEmail   = "*****@*****.**>";
        string to        = '"' + "To Testname" + '"' + "<*****@*****.**>";
        string subject   = "Test eMail";


        try
        {
            if (!MailHelper.SendEmail(MailTemplate.GetDefaultSMTPServer(),
                                      from,
                                      to,
                                      subject,
                                      CreateNotificationBody(),
                                      MailTemplate.GetTemplateLinkedResources(this)))
            {   //if sending failed
                LogHelper.EventLogHelper.Log("Bid > Send Notification : Sending Failed to " + from, System.Diagnostics.EventLogEntryType.Error);
            }
            else
            {   //if sending successful
                LogHelper.EventLogHelper.Log("Bid > Send Notification : Email Sent to " + from, System.Diagnostics.EventLogEntryType.Information);
            }
            success = true;
        }
        catch (Exception ex)
        {
            success = false;
            LogHelper.EventLogHelper.Log("Bid > Send Notification : " + ex.Message, System.Diagnostics.EventLogEntryType.Error);
        }

        return(success);
    }
Ejemplo n.º 10
0
    private bool SendEmailInvitation(int userid)
    {
        bool success = false;

        string subject = "Trans-Asias : New User Profile Created";

        if (MailHelper.SendEmail(MailTemplate.GetDefaultSMTPServer(),
                                 MailHelper.ChangeToFriendlyName(ConfigurationManager.AppSettings["AdminEmailName"], ConfigurationManager.AppSettings["AdminEmailAddress"]),
                                 MailHelper.ChangeToFriendlyName(tbFirstName.Text.Trim() + " " + tbLastName.Text.Trim(), tbEmail.Text.Trim()),
                                 subject,
                                 CreateInvitationBody(userid),
                                 MailTemplate.GetTemplateLinkedResources(this)))
        {
            success = true;
        }

        return(success);
    }
Ejemplo n.º 11
0
    private bool SendEmail()
    {
        bool   success  = false;
        string fullname = txtVendorName.Text.Trim();
        string subject;

        subject = "Trans-Asia  : User Profile Created";

        if (MailHelper.SendEmail(MailTemplate.GetDefaultSMTPServer(),
                                 MailHelper.ChangeToFriendlyName(ConfigurationManager.AppSettings["AdminEmailName"], ConfigurationManager.AppSettings["AdminEmailAddress"]),
                                 MailHelper.ChangeToFriendlyName(fullname, txtEmailAddress.Text.Trim()),
                                 subject,
                                 CreateBody(),
                                 MailTemplate.GetTemplateLinkedResources(this)))
        {
            success = true;
        }

        return(success);
    }
Ejemplo n.º 12
0
    //############################################################
    //############################################################
    private bool SendEmailNotification(string strVSFId)
    {
        SqlDataReader oReader;
        string        connstring = HttpContext.Current.Session["ConnectionString"].ToString();
        string        query;
        SqlCommand    cmd;
        SqlConnection conn;
        bool          success = false;

        string fromName     = "";
        string fromEmail    = "";
        string from         = "";
        string toName       = "";
        string toEmail      = "";
        string to           = "";
        string subject      = "";
        string oProjectName = "";
        string oVSFId       = "";

        query = "SELECT t1.VSFId, t1.ProjectName, t2.BuyerFirstName + ' ' + t2.BuyerMidName + ' ' + t2.BuyerLastName AS BuyerName, t2.EmailAdd as BuyerEmail, t3.FirstName + ' ' + t3.MiddleName + ' ' + t3.LastName AS PurchasingName, t3.EmailAdd as PurchasingEmail FROM tblVendorShortlistingForm t1, tblBuyers t2, tblPurchasing t3 WHERE t1.VSFId=@VSFId AND t2.BuyerId = t1.BuyerId AND t3.PurchasingId = t1.PurchasingId";
        //query = "sp_GetVendorInformation"; //##storedProcedure
        using (conn = new SqlConnection(connstring))
        {
            using (cmd = new SqlCommand(query, conn))
            {
                //cmd.CommandType = CommandType.StoredProcedure; //##storedProcedure
                cmd.Parameters.AddWithValue("@VSFId", Convert.ToInt32(strVSFId));
                conn.Open();
                //Process results
                oReader = cmd.ExecuteReader();
                if (oReader.HasRows)
                {
                    while (oReader.Read())
                    {
                        oVSFId       = oReader["VSFId"].ToString();
                        oProjectName = oReader["ProjectName"].ToString();

                        fromName  = oReader["PurchasingName"].ToString();
                        fromEmail = oReader["PurchasingEmail"].ToString();
                        from      = '"' + oReader["PurchasingName"].ToString() + '"' + " <" + oReader["BuyerEmail"].ToString() + ">";

                        toName  = oReader["BuyerName"].ToString();
                        toEmail = oReader["BuyerEmail"].ToString();
                        to      = '"' + oReader["BuyerName"].ToString() + '"' + " <" + oReader["PurchasingEmail"].ToString() + ">";
                    }
                }
            }
        }

        try
        {
            subject = "VSF Approved";
            if (!MailHelper.SendEmail(MailTemplate.GetDefaultSMTPServer(),
                                      from,
                                      to,
                                      subject,
                                      CreateNotificationBody(oVSFId, oProjectName, fromName, toName),
                                      MailTemplate.GetTemplateLinkedResources(this)))
            {   //if sending failed
                LogHelper.EventLogHelper.Log("Bid > Send Notification : Sending Failed to " + from, System.Diagnostics.EventLogEntryType.Error);
            }
            else
            {   //if sending successful
                LogHelper.EventLogHelper.Log("Bid > Send Notification : Email Sent to " + from, System.Diagnostics.EventLogEntryType.Information);
            }
            success = true;
        }
        catch (Exception ex)
        {
            success = false;
            LogHelper.EventLogHelper.Log("Bid > Send Notification : " + ex.Message, System.Diagnostics.EventLogEntryType.Error);
        }
        return(success);
    }
Ejemplo n.º 13
0
    protected void btnSend_Click(object sender, EventArgs e)
    {
        SqlParameter[] sqlparams = new SqlParameter[1];
        sqlparams[0]       = new SqlParameter("@UserName", SqlDbType.NVarChar, 100);
        sqlparams[0].Value = txtUserName2.Text.Trim();

        DataTable dt;

        try
        {
            SqlDataReader oReader;
            string        query;
            string        userPP = "", userEE = "";
            SqlCommand    cmd;
            SqlConnection conn;
            query = "sp_GetUserPasswordAndEmail";
            using (conn = new SqlConnection(ConfigurationManager.ConnectionStrings["EBidConnectionString"].ConnectionString))
            {
                using (cmd = new SqlCommand(query, conn))
                {
                    cmd.CommandType = CommandType.StoredProcedure;
                    cmd.Parameters.AddWithValue("@Username", txtUserName2.Text.Trim());
                    conn.Open();
                    oReader = cmd.ExecuteReader();
                    if (oReader.HasRows)
                    {
                        while (oReader.Read())
                        {
                            userPP = oReader["Password"].ToString();
                            userEE = oReader["EmailAddress"].ToString();
                        }
                    }
                }
            }

            //dt = SqlHelper.ExecuteDataset(connstring, "sp_GetUserPasswordAndEmail", sqlparams).Tables[0];

            //string ePwd = dt.Rows[0]["Password"].ToString();
            //string eAdd = dt.Rows[0]["EmailAddress"].ToString();
            string ePwd = userPP;
            string eAdd = userEE;


            if (userPP == "" || userEE == "")
            {
                txtNote2.Text = "Username not found.";
            }
            else
            {
                string from = MailHelper.ChangeToFriendlyName(ConfigurationManager.AppSettings["AdminEmailName"], ConfigurationManager.AppSettings["AdminEmailAddress"]);
                string to   = eAdd;

                string subject = "Trans-Asia  : Password Request";

                try
                {
                    if (MailHelper.SendEmail(MailTemplate.GetDefaultSMTPServer(), from, to, subject,
                                             MailTemplate.IntegrateBodyIntoTemplate(CreateRequestPasswordBody(ePwd)),
                                             MailTemplate.GetTemplateLinkedResources(this)))
                    {
                        Session["msg"] = "Password sent!";
                        LogHelper.EventLogHelper.Log("User Login > Send Password : Email Sent to " + to, EventLogEntryType.Information);
                    }
                    else
                    {
                        Session["msg"] = "Password not sent this time.";
                        LogHelper.EventLogHelper.Log("User Login > Send Password : Sending Failed to " + to, EventLogEntryType.Error);
                    }
                }
                catch (Exception ex)
                {
                    Session["msg"] = "Password not sent this time.";
                    LogHelper.EventLogHelper.Log("User Login > Send Password : "******"";
                if (Session["msg"] != null)
                {
                    txtNote2.Text  = Session["msg"].ToString();
                    Session["msg"] = null;
                }
            }
        }
        catch (Exception ex)
        {
            LogHelper.EventLogHelper.Log("User Login : " + ex.Message, EventLogEntryType.Error);
        }
    }
Ejemplo n.º 14
0
    private bool SendEmail_ChangeDeadline(BidDetails biddetails, ArrayList recipients)
    {
        //String b_Company = ((Label)((DetailsView)Biddetails_details1.FindControl("dvEventDetails")).Rows[5].Cells[1].FindControl("lblCompany")).Text;

        bool   success      = false;
        string subject      = "Trans-Asia / Commnunications : Changed Submission Deadline Notification";
        int    failedcount  = 0;
        int    successcount = 0;

        try
        {
            #region NOTIFY VENDORS

            for (int i = 0; i < recipients.Count; i++)
            {
                BidParticipant p = (BidParticipant)recipients[i];

                if (!MailHelper.SendEmail(MailTemplate.GetDefaultSMTPServer(),
                                          MailHelper.ChangeToFriendlyName(Session[Constant.SESSION_USERFULLNAME].ToString(), Session[Constant.SESSION_USEREMAIL].ToString()),
                                          MailHelper.ChangeToFriendlyName(p.Name, p.EmailAddress),
                                          subject,
                                          CreateNotificationBody(biddetails, p),
                                          MailTemplate.GetTemplateLinkedResources(this)))
                {       // if sending failed
                    failedcount++;
                    LogHelper.EventLogHelper.Log("Bids > Send Notification : Sending Failed to " + p.EmailAddress, System.Diagnostics.EventLogEntryType.Error);
                }
                else
                {       // if sending successful
                    successcount++;
                    LogHelper.EventLogHelper.Log("Bids > Send Notification : Email Sent to " + p.EmailAddress, System.Diagnostics.EventLogEntryType.Information);

                    #region add 1 to emailsent field based on vendorID and BidRefNo

                    //SqlParameter[] sqlparams = new SqlParameter[2];
                    //sqlparams[0] = new SqlParameter("@Vendorid", SqlDbType.Int);
                    //sqlparams[0].Value = p.ID;
                    //sqlparams[1] = new SqlParameter("@BidRefNo", SqlDbType.VarChar);
                    //sqlparams[1].Value = Int32.Parse(Session["BidRefNo"].ToString());
                    //SqlHelper.ExecuteNonQuery(connstring, CommandType.StoredProcedure, "sp_BidInvitationAddEmailSent", sqlparams);
                    #endregion
                }
            }

            #region SMS SENDER
            try
            {
                for (int j = 0; j < recipients.Count; j++)
                {
                    BidParticipant BP = (BidParticipant)recipients[j];

                    if (SMSHelper.AreValidMobileNumbers(BP.MobileNo.Trim()))
                    {
                        SMSHelper.SendSMS(new SMSMessage(CreateInvitationSmsBody(biddetails, BP).Trim(), BP.MobileNo.Trim())).ToString();
                    }
                }
            }
            catch (Exception ex)
            {
                LogHelper.EventLogHelper.Log("Bid Event > Send SMS Invitation : " + ex.Message, System.Diagnostics.EventLogEntryType.Error);
            }
            #endregion

            #endregion

            #region NOTIFY BUYER

            if (!MailHelper.SendEmail(MailTemplate.GetDefaultSMTPServer(),
                                      MailHelper.ChangeToFriendlyName(Session[Constant.SESSION_USERFULLNAME].ToString(), Session[Constant.SESSION_USEREMAIL].ToString()),
                                      MailHelper.ChangeToFriendlyName(biddetails.Creator, biddetails.CreatorEmail),
                                      subject,
                                      CreateNotificationBody(biddetails),
                                      MailTemplate.GetTemplateLinkedResources(this)))
            {
                failedcount++;
                LogHelper.EventLogHelper.Log("Bids > Send Notification : Sending Failed to " + Session[Constant.SESSION_USEREMAIL].ToString(), System.Diagnostics.EventLogEntryType.Error);
            }
            else
            {
                successcount++;
                LogHelper.EventLogHelper.Log("Bids > Send Notification : Email Sent to " + Session[Constant.SESSION_USEREMAIL].ToString(), System.Diagnostics.EventLogEntryType.Information);
            }

            #endregion

            success = true;
        }
        catch (Exception ex)
        {
            success = false;
            LogHelper.EventLogHelper.Log("Bid Item > Send ??? Change Notice : " + ex.Message, System.Diagnostics.EventLogEntryType.Error);
        }

        return(success);
    }
Ejemplo n.º 15
0
    private bool SendEmailNotificationClarify()
    {
        //"Fistname Lastname" <*****@*****.**>
        //"Fistname Lastname" <*****@*****.**>
        string        sCommand;
        string        connstring = HttpContext.Current.Session["ConnectionString"].ToString();
        SqlDataReader oReader;
        bool          success = false;


        string fromName  = "";
        string fromEmail = "";
        string from      = "";
        string toName    = "";
        string toEmail   = "";
        string to        = "";
        string subject   = "BAC For Clarification";


        //GET PURCHASING EMAIL AS THE SENDER
        sCommand = "SELECT t1.PurchasingID, t2.FirstName + ' ' + t2.MiddleName + ' ' + t2.LastName AS Name1, CONVERT(VARCHAR(17), t3.ApprovedDt_0, 113) ApprovedDt, t2.EmailAdd  FROM tblSupervisor t1, tblPurchasing t2, tblBacBidItems t3 WHERE t1.PurchasingID=t2.PurchasingID and t1.BuyerId = t3.buyerId AND t2.PurchasingID=t3.Approver_0 and t3.BidRefNo=" + Session["BuyerBidForBac"];
        oReader  = SqlHelper.ExecuteReader(connstring, CommandType.Text, sCommand);
        if (oReader.HasRows)
        {
            oReader.Read();
            fromName  = oReader["Name1"].ToString();
            fromEmail = oReader["EmailAdd"].ToString();
            from      = '"' + oReader["Name1"].ToString() + '"' + " <" + oReader["EmailAdd"].ToString() + ">";
        }
        oReader.Close();


        //GET BUYER EMAIL AS THE RECEPIENT
        sCommand = "SELECT PurchasingID, Name1, EmailAdd FROM (SELECT t2.PurchasingID, t2.FirstName + ' ' + t2.MiddleName + ' ' + t2.LastName AS Name1, t2.EmailAdd  FROM tblPurchasing t2, tblBacBidItems t3 WHERE t2.PurchasingID=t3.Approver_0 and t3.BidRefNo= " + Session["BuyerBidForBac"] + " UNION SELECT t1.BuyerId PurchasingID, t1.BuyerLastName + ', ' + t1.BuyerFirstName + ' ' + t1.BuyerMidName AS Name1, t1.EmailAdd FROM tblBuyers t1, tblBacBidItems t2 WHERE t1.BuyerId = t2.BuyerId AND t2.BidRefNo = " + Session["BuyerBidForBac"] + " UNION SELECT t1.BACId PurchasingID, t1.LastName + ', ' + t1.FirstName + ' ' + t1.MiddleName AS Name1, t1.EmailAdd FROM tblBidAwardingCommittee t1 ) as a1 INNER JOIN (SELECT TOP 1 * FROM tblBACClarifications d  WHERE  d.BidRefNo = " + Session["BuyerBidForBac"] + " ORDER BY d.DatePosted desc) t2 ON t2.FrUserId = a1.PurchasingID";
        oReader  = SqlHelper.ExecuteReader(connstring, CommandType.Text, sCommand);
        if (oReader.HasRows)
        {
            oReader.Read();
            toName  = oReader["Name1"].ToString();
            toEmail = oReader["EmailAdd"].ToString();
            to      = '"' + oReader["Name1"].ToString() + '"' + " <" + oReader["EmailAdd"].ToString() + ">";
        }
        oReader.Close();

        Response.Write(from + "<br>");
        Response.Write(to + "<br>");
        Response.Write(subject + "<br>");
        Response.Write(CreateNotificationBodyClarify() + "<br>");
        Response.Write(MailTemplate.GetTemplateLinkedResources(this) + "<br>");
        try
        {
            if (!MailHelper.SendEmail(MailTemplate.GetDefaultSMTPServer(),
                                      from,
                                      to,
                                      subject,
                                      CreateNotificationBodyClarify(),
                                      MailTemplate.GetTemplateLinkedResources(this)))
            {   //if sending failed
                LogHelper.EventLogHelper.Log("Bid > Send Notification : Sending Failed to " + from, System.Diagnostics.EventLogEntryType.Error);
            }
            else
            {   //if sending successful
                LogHelper.EventLogHelper.Log("Bid > Send Notification : Email Sent to " + from, System.Diagnostics.EventLogEntryType.Information);
            }
            success = true;
        }
        catch (Exception ex)
        {
            success = false;
            LogHelper.EventLogHelper.Log("Bid > Send Notification : " + ex.Message, System.Diagnostics.EventLogEntryType.Error);
        }

        return(success);
    }
Ejemplo n.º 16
0
    private bool SendEmailNotificationApprove()
    {
        //"Fistname Lastname" <*****@*****.**>
        //"Fistname Lastname" <*****@*****.**>
        string        sCommand;
        string        connstring = HttpContext.Current.Session["ConnectionString"].ToString();
        SqlDataReader oReader;
        bool          success = false;


        string fromName  = "";
        string fromEmail = "";
        string from      = "";
        string toName    = "";
        string toEmail   = "";
        string to        = "";
        string subject   = "BAC For Approval";

        //GET STATUS IF FOR APPROVAL OR ALREADY AWARDED
        string Status = "";

        sCommand = "SELECT Status FROM tblBacBidItems WHERE BidRefNo=" + Session["BuyerBidForBac"];
        oReader  = SqlHelper.ExecuteReader(connstring, CommandType.Text, sCommand);
        if (oReader.HasRows)
        {
            oReader.Read();
            Status = oReader["Status"].ToString();
        }
        oReader.Close();



        //GET BUYER EMAIL AS THE SENDER
        //sCommand = "SELECT t1.BuyerFirstName + ' ' + t1.BuyerMidName + ' ' + t1.BuyerLastName AS Name1, t1.EmailAdd  FROM tblBuyers t1, tblBacBidItems t2 WHERE t1.BuyerID=t2.BuyerId AND t2.BidRefNo=" + Session["BuyerBidForBac"];

        //GET BUYER EMAIL AS THE SENDER
        sCommand = "SELECT Name1, EmailAdd FROM ( ";
        sCommand = sCommand + "SELECT t1.BuyerID UserId, t1.BuyerFirstName + ' ' + t1.BuyerMidName + ' ' + t1.BuyerLastName AS Name1, t1.EmailAdd  FROM tblBuyers t1, tblBacBidItems t2 WHERE t1.BuyerID=t2.BuyerId AND t2.BidRefNo=" + Session["BuyerBidForBac"] + " ";
        sCommand = sCommand + "union ";
        sCommand = sCommand + "SELECT t1.PurchasingID UserId, t1.FirstName + ' ' + t1.MiddleName + ' ' + t1.LastName AS Name1, t1.EmailAdd  FROM tblPurchasing t1 ";
        sCommand = sCommand + "union ";
        sCommand = sCommand + "SELECT t1.BACID UserId, t1.FirstName + ' ' + t1.MiddleName + ' ' + t1.LastName AS Name1, t1.EmailAdd  FROM tblBidAwardingCommittee t1 ) t2 ";
        sCommand = sCommand + "WHERE UserId = (select TOP 1 ToUserId from tblBacClarifications where BidRefNo = " + Session["BuyerBidForBac"] + " ORDER BY ID desc)";

        oReader = SqlHelper.ExecuteReader(connstring, CommandType.Text, sCommand);
        if (oReader.HasRows)
        {
            oReader.Read();
            fromName  = oReader["Name1"].ToString();
            fromEmail = oReader["EmailAdd"].ToString();
            from      = '"' + oReader["Name1"].ToString() + '"' + " <" + oReader["EmailAdd"].ToString() + ">";
        }
        oReader.Close();


        //GET APPROVER EMAIL AS THE RECEPIENT OR IF NULL, NOTIFY BUYER AS AWARDED BAC
        sCommand = "SELECT FirstName+ ' ' + MiddleName + ' '+LastName as Name1, EmailAdd from tblBidAwardingCommittee where BACId=" + Session["ClarifiedBy"];

        oReader = SqlHelper.ExecuteReader(connstring, CommandType.Text, sCommand);
        if (oReader.HasRows)
        {
            oReader.Read();
            toName  = oReader["Name1"].ToString();
            toEmail = oReader["EmailAdd"].ToString();
            to      = '"' + oReader["Name1"].ToString() + '"' + " <" + oReader["EmailAdd"].ToString() + ">";
        }
        oReader.Close();

        //Response.Write(from + "<br>");
        //Response.Write(to + "<br>");
        //Response.Write(subject + "<br>");
        //Response.Write(CreateNotificationBodyApprove() + "<br>");
        //Response.Write(MailTemplate.GetTemplateLinkedResources(this) + "<br>");
        try
        {
            if (!MailHelper.SendEmail(MailTemplate.GetDefaultSMTPServer(),
                                      from,
                                      to,
                                      subject,
                                      CreateNotificationBodyApprove(),
                                      MailTemplate.GetTemplateLinkedResources(this)))
            {   //if sending failed
                LogHelper.EventLogHelper.Log("Bid > Send Notification : Sending Failed to " + from, System.Diagnostics.EventLogEntryType.Error);
            }
            else
            {   //if sending successful
                LogHelper.EventLogHelper.Log("Bid > Send Notification : Email Sent to " + from, System.Diagnostics.EventLogEntryType.Information);
            }
            success = true;
        }
        catch (Exception ex)
        {
            success = false;
            LogHelper.EventLogHelper.Log("Bid > Send Notification : " + ex.Message, System.Diagnostics.EventLogEntryType.Error);
        }

        return(success);
    }
Ejemplo n.º 17
0
    private bool SendEmailInvitation(BidDetails biddetails, ArrayList recipients, ref int failedcount, ref int successcount)
    {
        bool   success = false;
        string subject = "Trans-Asia  Incorporated/ Commnunications : Invitation to Bid";

        failedcount  = 0;
        successcount = 0;

        try
        {
            for (int i = 0; i < recipients.Count; i++)
            {
                BidParticipant p = (BidParticipant)recipients[i];

                if (!MailHelper.SendEmail(MailTemplate.GetDefaultSMTPServer(),
                                          MailHelper.ChangeToFriendlyName(biddetails.Creator, biddetails.CreatorEmail),
                                          MailHelper.ChangeToFriendlyName(p.Name, p.EmailAddress),
                                          subject,
                                          CreateInvitationBody(biddetails, p),
                                          MailTemplate.GetTemplateLinkedResources(this)))
                {       // if sending failed
                    failedcount++;
                    LogHelper.EventLogHelper.Log("Bid Event > Send Invitation : Sending Failed to " + p.EmailAddress, System.Diagnostics.EventLogEntryType.Error);
                }
                else
                {       // if sending successful
                    successcount++;
                    LogHelper.EventLogHelper.Log("Bid Event > Send Invitation : Email Sent to " + p.EmailAddress, System.Diagnostics.EventLogEntryType.Information);

                    //add 1 to emailsent field based on vendorID and BidRefNo
                    SqlParameter[] sqlparams = new SqlParameter[2];
                    sqlparams[0]       = new SqlParameter("@Vendorid", SqlDbType.Int);
                    sqlparams[0].Value = p.ID;
                    sqlparams[1]       = new SqlParameter("@BidRefNo", SqlDbType.VarChar);
                    sqlparams[1].Value = Int32.Parse(Session["BidRefNo"].ToString());
                    SqlHelper.ExecuteNonQuery(connstring, CommandType.StoredProcedure, "sp_BidInvitationAddEmailSent", sqlparams);
                }
            }

            success = true;
        }
        catch (Exception ex)
        {
            success = false;
            LogHelper.EventLogHelper.Log("Bid Event > Send Invitation : " + ex.Message, System.Diagnostics.EventLogEntryType.Error);
        }

        try
        {
            for (int j = 0; j < recipients.Count; j++)
            {
                BidParticipant p = (BidParticipant)recipients[j];

                if (SMSHelper.AreValidMobileNumbers(p.MobileNo.Trim()))
                {
                    SMSHelper.SendSMS(new SMSMessage(CreateInvitationSmsBody(biddetails, p).Trim(), p.MobileNo.Trim())).ToString();
                }
            }
        }

        catch (Exception ex)
        {
            LogHelper.EventLogHelper.Log("Bid Event > Send SMS Invitation : " + ex.Message, System.Diagnostics.EventLogEntryType.Error);
        }

        return(success);
    }