Esempio n. 1
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);
        }
Esempio n. 2
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);
    }
Esempio n. 3
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);
    }
Esempio n. 4
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);
    }
Esempio n. 5
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();
        }
    }
Esempio n. 6
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);
    }
Esempio n. 7
0
        protected void lnkSend_Click(object sender, EventArgs e)
        {
            string smtpServer = ConfigurationManager.AppSettings["SMTPServer"].Trim();

            string from = MailHelper.ChangeToFriendlyName(Session[Constant.SESSION_USERFULLNAME].ToString(), Session[Constant.SESSION_USEREMAIL].ToString());

            try
            {
                MailHelper.SendEmail(smtpServer, from, GetEmailAddress(ddlRecipient.SelectedIndex), txtSubject.Text.Trim(), txtMessage.Text.Trim());

                Session["CB_Message"] = String.Format("Message to {0} was successfully sent.", ddlRecipient.SelectedItem.Text);
                Response.Redirect("contactbuyer.aspx");
            }
            catch
            {
                lblMessage.Text = String.Format("Sending of message to {0} was not successful. Please try again later.", ddlRecipient.SelectedItem.Text);
            }
        }
Esempio n. 8
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);
    }
Esempio n. 9
0
    private void SendAwardedEmailNotification(int bidrefno)
    {
        string From         = MailHelper.ChangeToFriendlyName(ConfigurationManager.AppSettings["AdminEmailName"], ConfigurationManager.AppSettings["AdminEmailAddress"]);
        string subjCongrats = "Trans-Asia / Commnunications : Congratulations";
        string subjThanks   = "Trans-Asia / Commnunications : Thank You";

        DataTable dtVendors = GetBidEventParticipantsByBidRefNo(bidrefno);

        for (int i = 0; i < dtVendors.Rows.Count; i++)
        {
            DataRow drVendor = dtVendors.Rows[i];

            int    vendorId    = int.Parse(drVendor["VendorId"].ToString());
            string vendorName  = drVendor["VendorName"].ToString();
            string vendorEmail = drVendor["VendorEmail"].ToString();
            string bidStatus   = drVendor["BidStatus"].ToString();

            string To      = MailHelper.ChangeToFriendlyName(vendorName, vendorEmail);
            string Subject = "";
            string Body    = "";

            if (bidStatus == "WonItem")
            {
                //-- get bid items...
                DataTable dtBidItems = GetBidItemsAwardedByVendorId(bidrefno, vendorId);

                Subject = subjCongrats;
                Body    = CreateCongratsEmailBody(drVendor, dtBidItems);
            }
            else
            {
                Subject = subjThanks;
                Body    = CreateThanksEmailBody(drVendor);
            }

            //-- send notification...
            SendEmail(From, To, "", "", Subject, Body);
        }
    }
Esempio n. 10
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);
        }
    }
Esempio n. 11
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);
    }
Esempio n. 12
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);
    }