Esempio n. 1
0
 protected void SendEmail(string sSubject, string sMessageText)
 {
     try
     {
         var iCnt           = 0;
         var sSentTo        = "";
         var sMessageHeader = "<font color='red'>*** This is an auto-generated email. Please do not reply or forward to ***</font><br><br>";
         sMessageText = sMessageHeader + sMessageText;
         Admin.SendCustomEmailToBDAdmins(sMessageText, sSubject, out sSentTo, out iCnt);
         lblError.Text = DisplayMessage("Message has been sent to the ULO BA (" + sSentTo + ")", false);
     }
     catch (Exception ex)
     {
         lblError.Text = DisplayMessage("Request has been processed but email message has not been sent due to the following error: " + ex.Message, false);
     }
 }
Esempio n. 2
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            var iID           = 0;
            var iCnt          = 0;
            var sSentToUser   = "";
            var sSentToAdmins = "";
            var sError        = "";

            var sUserRoles = "";
            var sUserDesc  = "";
            var sUserSatus = "";
            var sPassword  = "";

            try
            {
                var returnNum = UsersBO.SaveUser(Convert.ToInt32(hUserID.Value), txtEmail.Text, sPassword, sUserRoles, Convert.ToInt32(ddlActive.SelectedItem.Value), txtFirstName.Text, txtLastName.Text, txtMI.Text, ddlOrg.SelectedItem.Value, txtPhone.Text, ddlDefAppl.SelectedItem.Value);
                //AdminBO.SendCustomEmail(txtEmail.Text, "Body", "Sbjt", out sSentTo, out iCnt);

                if (returnNum > 0)
                {
                    lblError.Text = DisplayMessage("Record saved.", false);
                }

                var sMessageText = "";
                var sSubject     = "";

                var sMessageTextForBA = "";
                var sSubjectForBA     = "";
                var sUserAcctDetails  = "";

                var sEmail = txtEmail.Text.Trim();

                //string sLogin = sEmail.Remove(sEmail.IndexOf("@"));

                var sMessageHeader = "<font color='red'>*** This is an auto-generated email. Please do not reply or forward to ***</font><br><br>";

                //string sGenericPswdNote = "You have generic password. Please login into the ULO application, click the 'Change Password' link and replace your generic password with a new one.";

                sUserAcctDetails = "<br><br>User Role(s): " + sUserDesc + "<br>Organization: " + ddlOrg.SelectedItem.Value.ToString() + "<br>User Status: " + sUserSatus;

                var sUserAcctDetailsBA = "<br><br>User Role(s): " + sUserDesc + "<br>Organization: " + ddlOrg.SelectedItem.Value.ToString() + "<br>User Status: " + sUserSatus;

                if (btnReset.Visible == true)              // admin mode - updating existing user or creating a new user
                {
                    if (rbListNewOld.SelectedValue == "2") //update existing user
                    {
                        sMessageText      = sMessageHeader + "Your ULO account has been updated on " + DateTime.Now.ToString() + ".<br>See the account details below." + sUserAcctDetails + "<br><br>http://dotnetweb.pbsncr.gsa.gov/OpenItems";
                        sMessageTextForBA = sMessageHeader + "The ULO account has been updated for " + txtFirstName.Text + " " + txtLastName.Text + " on " + DateTime.Now.ToString() + ".<br>See your account details below." + sUserAcctDetailsBA + "<br><br>http://dotnetweb.pbsncr.gsa.gov/OpenItems";

                        sSubject      = "Your ULO account has been changed";
                        sSubjectForBA = "The ULO reviewer account has been changed";
                    }
                    else     // creating a new user
                    {
                        sMessageText      = sMessageHeader + "Your ULO account has been created on " + DateTime.Now.ToString() + ".<br>See your account details below." + sUserAcctDetails;
                        sMessageTextForBA = sMessageHeader + "New ULO account has been created for " + txtFirstName.Text + " " + txtLastName.Text + " on " + DateTime.Now.ToString() + ".<br>See the account details below." + sUserAcctDetailsBA;

                        sSubject      = "Your ULO account has been created";
                        sSubjectForBA = "New ULO account has been created";
                    }

                    if (sUserSatus == "Inactive")
                    {
                        sSubject      = "Your ULO account has been disabled";
                        sSubjectForBA = "The ULO reviewer account has been disabled";

                        sMessageText      = sMessageHeader + "Your ULO account has been disabled on " + DateTime.Now.ToString();
                        sMessageTextForBA = sMessageHeader + "The ULO account has been disabled for " + txtFirstName.Text + " " + txtLastName.Text + " on " + DateTime.Now.ToString();
                    }
                }
                else     // paswd mode -  changing just new password for ULO User who logged-in
                {
                    //if (txtPassword.Text.Trim() == "")
                    //{
                    //    throw new Exception("Please enter your password");
                    //}
                    //else
                    //{
                    //    sMessageText = sMessageHeader + "Your ULO application password has been changed on " + DateTime.Now.ToString() + ".<br>Your new password is: " + txtPassword.Text + "<br><br>http://dotnetweb.pbsncr.gsa.gov/OpenItems";
                    //    sSubject = "Your ULO password has been changed";
                    //}
                }


                Admin.SendCustomEmail(txtEmail.Text, sMessageText, sSubject, out sSentToUser, out iCnt);

                if (btnReset.Visible == true)     // admin mode
                {
                    Admin.SendCustomEmailToBDAdmins(sMessageTextForBA, sSubjectForBA, out sSentToAdmins, out iCnt);
                }

                lblError.Text = lblError.Text + ". " + DisplayMessage("Email message has been sent to the following ULO User(s):<br>" + sSentToUser + ", " + sSentToAdmins, false);
            }
            catch (Exception ex)
            {
                lblError.Text = DisplayMessage(ex.Message, true);
            }
        }
Esempio n. 3
0
        protected void btnSendEmail_Click(object sender, EventArgs e)
        {
            var sSentTo = "";
            var iCnt    = 0;


            try
            {
                //if (ddlRecipients.SelectedIndex == 0)
                //{
                //    throw new Exception("Select Recipients.");
                //}

                //if (txtSubject.Text.Trim() == "")
                //{
                //    throw new Exception("'Subject field' is empty.");
                //}

                //if (txtBody.Text.Trim() == "")
                //{
                //    throw new Exception("The 'Body' field is empty.");
                //}


                txtGraphicsRed.Text.Replace(" ", "");
                txtGraphicsBlue.Text.Replace(" ", "");

                var sBody = txtBody.Text;

                if (txtGraphicsBold.Text.Trim() != "")
                {
                    var arrGraphicsBold = txtGraphicsBold.Text.Split(new char[] { '^' });
                    Array.Sort(arrGraphicsBold);

                    foreach (var s in arrGraphicsBold) //check for the duplicates and remove if any before sending
                    {
                        if (s.Trim() != "")
                        {
                            sBody = sBody.Replace(s, "<b>" + s + "</b>");
                        }
                    }
                }

                if (txtGraphicsRed.Text.Trim() != "")
                {
                    var arrGraphicsR = txtGraphicsRed.Text.Split(new char[] { '^' });
                    Array.Sort(arrGraphicsR);

                    foreach (var s in arrGraphicsR) //check for the duplicates and remove if any before sending
                    {
                        if (s.Trim() != "")
                        {
                            sBody = sBody.Replace(s, "<font color='red'>" + s + "</font>");
                        }
                    }
                }

                if (txtGraphicsBlue.Text.Trim() != "")
                {
                    var arrGraphicsB = txtGraphicsBlue.Text.Split(new char[] { '^' });
                    Array.Sort(arrGraphicsB);

                    foreach (var s in arrGraphicsB) //check for the duplicates and remove if any before sending
                    {
                        if (s.Trim() != "")
                        {
                            sBody = sBody.Replace(s, "<font color='blue'>" + s + "</font>");
                        }
                    }
                }

                if (txtGraphicsGreen.Text.Trim() != "")
                {
                    var arrGraphicsG = txtGraphicsGreen.Text.Split(new char[] { '^' });
                    Array.Sort(arrGraphicsG);
                    foreach (var s in arrGraphicsG) //check for the duplicates and remove if any before sending
                    {
                        if (s.Trim() != "")
                        {
                            sBody = sBody.Replace(s, "<font color='green'>" + s + "</font>");
                        }
                    }
                }

                sBody = sBody.Replace("\r", "<p>");
                //txtBody.Text = sBody;

                switch (ddlRecipients.SelectedIndex)
                {
                case 0:     // - select -
                    //lblError.Text = "Select Recipients";
                    break;

                case 1:     // ULO Reviewer
                    Admin.SendCustomEmailToReviewers(hMessageHeader.Value + sBody, txtSubject.Text, out sSentTo, out iCnt);
                    lblError.Text = DisplayMessage(lblError, "Message has been sent to the following Reviewers:<br>" + sSentTo + "<br>Total messages sent: " + iCnt, false);
                    break;

                case 2:     // ULO Organization Admin
                    Admin.SendCustomEmailToOrgAdmins(hMessageHeader.Value + sBody, txtSubject.Text, out sSentTo, out iCnt);
                    lblError.Text = DisplayMessage(lblError, "Message has been sent to the following Org Admins:<br>" + sSentTo + "<br>Total messages sent: " + iCnt, false);
                    break;

                case 3:     // ULO Budget Division Admin
                    Admin.SendCustomEmailToBDAdmins(hMessageHeader.Value + sBody, txtSubject.Text, out sSentTo, out iCnt);
                    lblError.Text = DisplayMessage(lblError, "Message has been sent to the following BD Admins:<br>" + sSentTo + "<br>Total messages sent: " + iCnt, false);
                    break;

                case 4:     // All ULO Users
                    Admin.SendCustomEmailToAllULOUsers(hMessageHeader.Value + sBody, txtSubject.Text, out sSentTo, out iCnt);
                    lblError.Text = DisplayMessage(lblError, "Message has been sent to the following ULO Users:<br>" + sSentTo + "<br>Total messages sent: " + iCnt, false);
                    break;

                case 5:     // Manual Entry
                    if (txtSendTo.Text.Trim() == "")
                    {
                        throw new Exception("The 'Send To' field is empty.");
                    }
                    //sErrorStatus = "Ready to go to AdminBO.SendCustomEmail";
                    Admin.SendCustomEmail(txtSendTo.Text, hMessageHeader.Value + sBody, txtSubject.Text, out sSentTo, out iCnt);
                    lblError.Text = DisplayMessage(lblError, "Message has been sent to the following ULO Users:<br>" + sSentTo + "<br>Total messages sent: " + iCnt, false);
                    break;
                }
                ddlULOUsers.SelectedIndex = 0;
                ddlLoads.SelectedIndex    = 0;
                txtSendTo.Text            = "";
            }
            catch (Exception ex)
            {
                lblError.Text = DisplayMessage(lblError, "Error: " + sErrorStatus + " " + ex.Message, true);
            }
        }
Esempio n. 4
0
        private void SendEmailOnReassigRequest(int intItemID,
                                               string sOldOrgCode, string sNewOrgCode,
                                               string sOldOrganization, string sNewOrganization,
                                               int iOldReviewerID, int iNewReviewerID,
                                               string sComments, string ActionType)
        {
            //
            if (Settings.Default.SendEmailOnAllTypeOfAssignments)
            {
                var sOldReviewerName  = "";
                var sNewReviewerName  = "";
                var sMessageText      = "";
                var sDocNum           = "";
                var sSentToAdmins     = "";
                var sSentTo           = "";
                var sSubject          = "";
                var iCnt              = 0;
                var sNewReviewerEmail = "";

                // here we need to send email message to all BA's on Reassign/Reroute request ***SM

                // get Old User name by ID
                if (iOldReviewerID != 0)
                {
                    var ds = Users.GetUserByUserID(iOldReviewerID);
                    sOldReviewerName = ds.Tables[0].Rows[0]["FirstName"].ToString() + " " + ds.Tables[0].Rows[0]["LastName"].ToString();
                }

                // get New User name by ID
                //if (ActionType == "5")
                //{
                if (iNewReviewerID != 0)
                {
                    var ds = Users.GetUserByUserID(iNewReviewerID);
                    sNewReviewerName  = ds.Tables[0].Rows[0]["FirstName"].ToString() + " " + ds.Tables[0].Rows[0]["LastName"].ToString();
                    sNewReviewerEmail = ds.Tables[0].Rows[0]["Email"].ToString();
                }
                //}

                // get doc number  by OItemID

                if (intItemID != 0)
                {
                    var items = Item.GetDocNumByItemID(intItemID);
                    sDocNum = items.First();
                }

                var sMessageHeader = "<font color='red'>*** This is an auto-generated email. Please do not reply or forward to ***</font><br><br>";

                if (ActionType == "5")
                {
                    sSubject     = "Re-Assign/Re-Route Request for the ULO document " + sDocNum;
                    sMessageText = sMessageHeader + "New reassign/reroute reguest has been placed for the ULO document '" + sDocNum + "'.<br><br>";

                    sMessageText = sMessageText + "Original Reviewer: " + sOldReviewerName + ".<br>";
                    sMessageText = sMessageText + "Original Organization: " + sOldOrganization + " : " + sOldOrgCode + ".<br><br>";

                    sMessageText = sMessageText + "Suggested  Reviewer: " + sNewReviewerName + ".<br>";
                    sMessageText = sMessageText + "Suggested  Organization: " + sNewOrganization + " : " + sNewOrgCode + ".<br><br>";

                    sMessageText = sMessageText + "Reroute/Reassign Comments:<br><br>";
                    sMessageText = sMessageText + sComments + "'.<br><br>";
                    sMessageText = sMessageText + "To confirm or modify rerouting, please login to <a href='http://dotnetweb.pbsncr.gsa.gov/OpenItems/ReviewOpenItems.aspx' >ULO Application</a>.<p>";
                    sMessageText = sMessageText + "For more information, go to the <a href='http://dotnetweb.pbsncr.gsa.gov/OpenItems/docs/UserManual.doc'>ULO (Open Items) User Manual.</a><p>";
                    sMessageText = sMessageText + "<font color='red'>Attention</font>: Please use the Internet Explorer (IE) browser instead of the Chrome browser.<p>";
                    sMessageText = sMessageText + "Thank you.<p><p>";
                    sMessageText = sMessageText + "(Ref # " + ActionType + ")";

                    Admin.SendCustomEmailToBDAdmins(sMessageText, sSubject, out sSentToAdmins, out iCnt);
                }
                else if (ActionType == "4" || ActionType == "3" || ActionType == "10")
                {
                    if (ActionType == "4" || ActionType == "3")
                    {
                        sSubject     = "New Open Items have been assigned to you.";
                        sMessageText = sMessageHeader + "New Open Items have been assigned to you.<br><br>";
                    }
                    else     //10
                    {
                        sSubject     = "New Open Items have been assigned to you by Budget Division Administrator as a result of reroute request.";
                        sMessageText = sMessageHeader + "New Open Items have been assigned to you by Budget Division Administrator as a result of reroute request.<br><br>";
                    }

                    sMessageText = sMessageText + "Reroute/Reassign Comments:<br><br>";
                    sMessageText = sMessageText + sComments + "'.<br><br>";
                    sMessageText = sMessageText + "Please login and review your workload in <a href='http://dotnetweb.pbsncr.gsa.gov/OpenItems/ReviewOpenItems.aspx' >ULO Application.</a><p>";
                    sMessageText = sMessageText + "For more information, go to the <a href='http://dotnetweb.pbsncr.gsa.gov/OpenItems/docs/UserManual.doc'>ULO (Open Items) User Manual.</a><p>";
                    sMessageText = sMessageText + "<font color='red'>Attention</font>: Please use the Internet Explorer (IE) browser instead of the Chrome browser.<p>";
                    sMessageText = sMessageText + "Thank you.<p><p>";
                    sMessageText = sMessageText + "(Ref # " + ActionType + ")";

                    Admin.SendCustomEmail(sNewReviewerEmail, sMessageText, sSubject, out sSentTo, out iCnt);
                }
                else if (ActionType == "16" || ActionType == "19")
                {
                    sSubject     = "New Open Items for validation have been assigned to you";
                    sMessageText = sMessageHeader + "New Open Items for validation have been assigned to you.<br><br>";
                    sMessageText = sMessageText + "Reroute/Reassign Comments:<br><br>";
                    sMessageText = sMessageText + sComments + "'.<br><br>";
                    sMessageText = sMessageText + "Please login and review your workload in <a href='http://dotnetweb.pbsncr.gsa.gov/OpenItems/ReviewOpenItems.aspx' >ULO Application.</a><p>";
                    sMessageText = sMessageText + "For more information, go to the <a href='http://dotnetweb.pbsncr.gsa.gov/OpenItems/docs/UserManual.doc'>ULO (Open Items) User Manual.</a><p>";
                    sMessageText = sMessageText + "<font color='red'>Attention</font>: Please use the Internet Explorer (IE) browser instead of the Chrome browser.<p>";
                    sMessageText = sMessageText + "Thank you.<p><p>";
                    sMessageText = sMessageText + "(Ref # " + ActionType + ")";

                    Admin.SendCustomEmail(sNewReviewerEmail, sMessageText, sSubject, out sSentTo, out iCnt);
                }
            }
        }