示例#1
0
        private void DisableCustomerTracking(string pCustID)
        {
            int _CustID;

            if (Int32.TryParse(pCustID, out _CustID))
            {
                string _CCEmail = (ConfigurationManager.AppSettings[EmailCls.CONST_APPSETTING_FROMEMAILKEY] == null) ?
                                  "*****@*****.**" : ConfigurationManager.AppSettings[EmailCls.CONST_APPSETTING_FROMEMAILKEY];

                TrackerDotNet.control.CustomersTbl _Customers = new control.CustomersTbl();
                _Customers.DisableCustomer(_CustID);

                _Customers = _Customers.GetCustomersByCustomerID(_CustID);

                CompanyNameLabel.Text = _Customers.CompanyName;
                string _Name = String.Empty;
                _Name = _Customers.ContactAltFirstName;
                if (!String.IsNullOrEmpty(_Name))
                {
                    if (!String.IsNullOrEmpty(_Customers.ContactAltFirstName))
                    {
                        _Name += " & " + _Customers.ContactAltFirstName;
                    }
                }
                else if (!String.IsNullOrEmpty(_Customers.ContactAltFirstName))
                {
                    _Name = _Customers.ContactAltFirstName;
                }
                else
                {
                    _Name = "X Coffee lover";
                }

                EmailCls _Email = new EmailCls();
                if (!String.IsNullOrEmpty(_Customers.EmailAddress))
                {
                    _Email.SetEmailTo(_Customers.EmailAddress);
                }
                if (!String.IsNullOrEmpty(_Customers.AltEmailAddress))
                {
                    _Email.SetEmailTo(_Customers.AltEmailAddress);
                }

                _Email.SetEmailCC(_CCEmail);
                _Email.SetEmailSubject(_Customers.CompanyName + " request to be disabled in Coffee Tracker");
                _Email.AddFormatToBody("Dear {0}, <br /><br />", _Name);
                _Email.AddFormatToBody("As requested we have disabled: {0} in Quaffee's Coffee Tracker.<br /><br />", _Customers.CompanyName);
                _Email.AddFormatToBody("We wish you the best in the future. Should you require anything else from us please email {0}.<br /><br />", _CCEmail);
                _Email.AddStrAndNewLineToBody("The Quaffee Orders Team");
                _Email.AddStrAndNewLineToBody("web: <a href='http://www.quaffee.co.za'>quaffee.co.za</a>");

                _Email.SendEmail();
            }
            else
            {
                CompanyNameLabel.Text = "Company not found";
            }
        }
示例#2
0
        private bool SendDeliveredEmail(long pCustomerID, string pMessage)
        {
            bool         _Success = false;
            CustomersTbl _CT      = new CustomersTbl();

            _CT = _CT.GetCustomersByCustomerID(pCustomerID);

            if ((_CT.EmailAddress.Contains("@")) || (_CT.AltEmailAddress.Contains("@")))
            {
                string   _Name  = String.Empty;
                EmailCls _Email = new EmailCls();

                _Email.SetEmailSubject("Confirmation email");

                if (_CT.EmailAddress.Contains("@"))
                {
                    _Email.SetEmailTo(_CT.EmailAddress);
                    if (_CT.AltEmailAddress.Contains("@"))
                    {
                        _Email.SetEmailCC(_CT.AltEmailAddress);
                        _Name = (!String.IsNullOrEmpty(_CT.ContactFirstName)) ? _CT.ContactFirstName : String.Empty;

                        if ((!String.IsNullOrEmpty(_Name)) && (!String.IsNullOrEmpty(_CT.ContactAltFirstName)))
                        {
                            _Name += " and ";
                        }

                        _Name += (String.IsNullOrEmpty(_CT.ContactAltFirstName)) ? _CT.ContactAltFirstName : String.Empty;
                    }
                    else
                    {
                        _Email.SetEmailTo(_CT.AltEmailAddress);
                        _Name += (String.IsNullOrEmpty(_CT.ContactAltFirstName)) ? _CT.ContactAltFirstName : String.Empty;
                    }
                }
                else // null first email
                {
                    _Email.SetEmailTo(_CT.AltEmailAddress);
                    _Name += (String.IsNullOrEmpty(_CT.ContactAltFirstName)) ? _CT.ContactAltFirstName : String.Empty;
                }

                if (String.IsNullOrEmpty(_Name))
                {
                    _Name = "coffee lover";
                }

                _Email.AddFormatToBody("To {0},<br />,<br />", _Name);

                _Email.AddStrAndNewLineToBody("Just a quick note to notify you that Quaffee has " + pMessage + "<br />");
                _Email.AddStrAndNewLineToBody("Thank you for your support.<br />");
                _Email.AddStrAndNewLineToBody("Sincerely Quaffee Team ([email protected])");

                _Success = _Email.SendEmail();
            }
            return(_Success);
        }
示例#3
0
        private bool SendStatusChangeEmail(RepairsTbl pRepair)
        {
            EmailCls          _Email          = new EmailCls();
            EquipTypeTbl      _EquipTypes     = new EquipTypeTbl();
            RepairStatusesTbl _RepairStatuses = new RepairStatusesTbl();

            _Email.SetEmailTo(pRepair.ContactEmail);
            _Email.SetEmailSubject("Change to repair status - notification.");
            _Email.AddStrAndNewLineToBody("<b>Repair Status Change Notification</b>");
            _Email.AddFormatToBody("Dear {0}, <br /><br />", pRepair.ContactName);
            _Email.AddFormatToBody("Please note that repair status of the {0}, serial number: {1}, has changed to <b>{2}</b>.<br /><br />",
                                   _EquipTypes.GetEquipName(pRepair._MachineTypeID),
                                   pRepair.MachineSerialNumber, _RepairStatuses.GetRepairStatusDesc(pRepair.RepairStatusID));
            _Email.AddStrAndNewLineToBody("You are receiving this status update since your email address was assigned to the tracking of this repair.<br />");
            _Email.AddStrAndNewLineToBody("Please note that Quaffee DOES NOT run a coffee machine repair workshop. As a service to our current coffee " +
                                          "purchasing clients we will take the coffee machine to the workshop, give a swop out machine to the client, if available, and " +
                                          "charge what we are charged by the workshop plus a small admin fee. Please note: we are not able to quote these repairs, if you would like " +
                                          "to contact the workshop directly, please ask us for their details.<br />");
            _Email.AddStrAndNewLineToBody("For clients that are not currently using our coffee, or have not used our coffee consistently over" +
                                          " the last 3 months, we may at our discretion offer a swop out machine, at a fee, and also change a collection and delivery fee.<br />");
            _Email.AddStrAndNewLineToBody("Any warantee on the repairs is carried by the workshop not by Quaffee.<br />");
            _Email.AddStrAndNewLineToBody("The Quaffee Team");
            _Email.AddStrAndNewLineToBody("web: <a href='http://www.quaffee.co.za'>quaffee.co.za</a>");

            return(_Email.SendEmail());
        }
示例#4
0
        /// <summary>
        /// Send email to the current client to confirm the items in the current order, and the deliver date
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void btnConfirmOrder_Click(object sender, EventArgs e)
        {
            DropDownList _ddlThisContact = (DropDownList)dvOrderHeader.FindControl("ddlContacts");

            ContactEmailDetails _thisContact = GetEmailDetails(_ddlThisContact.SelectedItem.Value);

            if (_thisContact != null)
            {
                EmailCls     _email         = new EmailCls();
                DropDownList _ddlDeliveryBy = (DropDownList)dvOrderHeader.FindControl("ddlToBeDeliveredBy"); // who is delivering this

                string _DeliveryDate  = dvOrderHeaderGetLabelValue("lblRequiredByDate");                     // date it will be dispatched / delivered"
                string _PurchaseOrder = dvOrderHeaderGetLabelValue("lblPurchaseOrder");
                string _Notes         = dvOrderHeaderGetLabelValue("lblNotes");

                if (_thisContact.EmailAddress != "")
                {
                    _email.SetEmailFromTo(CONST_FROMEMAIL, _thisContact.EmailAddress);
                    if (_thisContact.altEmailAddress != "")
                    {
                        _email.SetEmailCC(_thisContact.altEmailAddress);
                    }
                }
                else if (_thisContact.altEmailAddress != "")
                {
                    _email.SetEmailFromTo(CONST_FROMEMAIL, _thisContact.altEmailAddress);
                }
                else
                {
                    ltrlStatus.Text = "no email address found";
                    TrackerDotNet.classes.showMessageBox _NoMsgBx = new classes.showMessageBox(this.Page, "Email FAILED: ", ltrlStatus.Text);
                    upnlNewOrderItem.Update();
                    return; // no email address so quit
                }
                // send a BCC to orders to confirm
                _email.SetEmailBCC(CONST_FROMEMAIL);
                // set subject and body
                _email.SetEmailSubject("Order Confirmation");

                string _AddressedTo = "Coffee Lover";
                if (_thisContact.FirstName != "")
                {
                    _AddressedTo = _thisContact.FirstName.Trim();
                    if (_thisContact.altFirstName != "")
                    {
                        _AddressedTo += " and " + _thisContact.altFirstName.Trim();
                    }
                }
                else if (_thisContact.altFirstName != "")
                {
                    _AddressedTo = _thisContact.altFirstName.Trim();
                }

                _email.AddStrAndNewLineToBody("Dear " + _AddressedTo + ",<br />");
                if (_ddlThisContact.SelectedValue.Equals(NewOrderDetail.CONST_ZZNAME_DEFAULTID))
                {
                    _email.AddStrAndNewLineToBody("We confirm you order below:");
                }
                else
                {
                    _email.AddStrAndNewLineToBody("We confirm the following order for " + _ddlThisContact.SelectedItem.Text + ":");
                }
                _email.AddToBody("<ul>");
                foreach (GridViewRow _gv in gvOrderLines.Rows)
                {
                    DropDownList _gvItemDLL       = (DropDownList)_gv.FindControl("ddlItemDesc");
                    Label        _gvItemQty       = (Label)_gv.FindControl("lblQuantityOrdered");
                    DropDownList _gvItemPackaging = (DropDownList)_gv.FindControl("ddlPackaging");
                    // need to check for serivce / note and add the note using the same logic as we have for the delivery sheet
                    if (GetItemSortOrderID(_gvItemDLL.SelectedValue) == ItemTypeTbl.CONST_NEEDDESCRIPTION_SORT_ORDER)
                    {
                        // if we are already use the notes field for name, check if there is a ":" seperator, and then only use what is after
                        if (_Notes.Contains(":"))
                        {
                            _Notes = _Notes.Substring(_Notes.IndexOf(":") + 1).Trim();
                        }

                        int _Start = _Notes.IndexOf(OrderDetail.CONST_EMAILDELIMITERSTART);
                        if (_Start >= 0)
                        {
                            int _End = _Notes.IndexOf(OrderDetail.CONST_EMAILDELIMITEREND);
                            if (_End >= 0)
                            {
                                _Notes = String.Concat(_Notes.Substring(0, _Start), ";", _Notes.Substring(_End + 2));
                            }
                        }

                        _email.AddFormatToBody("<li>{0}</li>", _Notes);
                    }
                    else
                    {
                        string _UnitsAndQty = AddUnitsToQty(_gvItemDLL.SelectedValue, _gvItemQty.Text);
                        if (_gvItemPackaging.SelectedIndex == 0)
                        {
                            _email.AddFormatToBody("<li>{0} of {1}</li>", _UnitsAndQty, _gvItemDLL.SelectedItem.Text);
                        }
                        else
                        {
                            _email.AddFormatToBody("<li>{0} of {1} - Preperation note: {2}</li>", _UnitsAndQty, _gvItemDLL.SelectedItem.Text, _gvItemPackaging.SelectedItem.Text);
                        }
                    }
                }
                _email.AddStrAndNewLineToBody("</ul>");

                if (!string.IsNullOrEmpty(_PurchaseOrder))
                {
                    if (_PurchaseOrder.EndsWith(TrackerTools.CONST_POREQUIRED))
                    {
                        _email.AddStrAndNewLineToBody("<b>NOTE</b>: We are still waiting for a Purchase Order number from you.<br />");
                    }
                    else
                    {
                        _email.AddStrAndNewLineToBody(string.Format("This order has purchase order: {0}, allocated to it.<br />", _PurchaseOrder));
                    }
                }
                if (_ddlDeliveryBy.SelectedItem.Text == CONST_DELIVERYTYPEISCOLLECTION)
                {
                    _email.AddStrAndNewLineToBody("The order will be ready for collection on: " + _DeliveryDate);
                }
                else if (_ddlDeliveryBy.SelectedItem.Text == CONST_DELIVERYTYPEISCOURIER)
                {
                    _email.AddStrAndNewLineToBody("The order will be dispatched on: " + _DeliveryDate + ".");
                }
                else
                {
                    _email.AddStrAndNewLineToBody("The order will be delivered on: " + _DeliveryDate + ".");
                }

                // Add a footer
                MembershipUser _currMember = Membership.GetUser();
                string         _from       = string.IsNullOrEmpty(_currMember.UserName) ? "the Quaffee Team" : " from the Quaffee Team (" + UpCaseFirstLetter(_currMember.UserName) + ")";

                _email.AddStrAndNewLineToBody("<br />Sent automatically by Quaffee's order and tracking System.<br /><br />Sincerely " + _from + " ([email protected])");
                if (_email.SendEmail())
                {
                    ltrlStatus.Text = "Email Sent to: " + _AddressedTo;
                }
                else
                {
                    showMessageBox _msg = new showMessageBox(this.Page, "error", "error sending email: " + _email.myResults);
                    ltrlStatus.Text = "Email was not sent!";
                }

                TrackerDotNet.classes.showMessageBox _MsgBx = new classes.showMessageBox(this.Page, "Email Confirmation", ltrlStatus.Text);
                upnlNewOrderItem.Update();
            }
        }
示例#5
0
        /// <summary>
        /// Send email to the current client to confirm the items in the current order, and the deliver date
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void btnConfirmOrder_Click(object sender, EventArgs e)
        {
            DropDownList _ddlThisContact = (DropDownList)dvOrderHeader.FindControl("ddlContacts");

            ContactDetails.ContactEmailDetails _thisContact = GetContactsEmailDetails(_ddlThisContact.SelectedItem.Value);
            if (_thisContact != null)
            {
                EmailCls     _email           = new EmailCls();
                DropDownList _ddlDeliveryBy   = (DropDownList)dvOrderHeader.FindControl("ddlToBeDeliveredBy"); // who is delivering this
                Label        _lblDeliveryDate = (Label)dvOrderHeader.FindControl("lblRequiredByDate");         // date it will be dispatched / delivered"

                if (_thisContact.EmailAddress != "")
                {
                    _email.SetEmailFromTo(CONST_FROMEMAIL, _thisContact.EmailAddress);
                    if (_thisContact.altEmailAddress != "")
                    {
                        _email.SetEmailCC(_thisContact.altEmailAddress);
                    }
                }
                else if (_thisContact.altEmailAddress != "")
                {
                    _email.SetEmailFromTo(CONST_FROMEMAIL, _thisContact.altEmailAddress);
                }
                else
                {
                    return; // no email address so quit
                }
                // send a BCC to orders to confirm
                _email.SetEmailBCC(CONST_FROMEMAIL);
                // set subject and body
                _email.SetEmailSubject("Order Confirmation");
                _email.AddStrAndNewLineToBody("Dear " + ((_thisContact.FirstName != "") ? _thisContact.FirstName : ((_thisContact.altFirstName != "") ? _thisContact.altFirstName : "Coffee Lover")) + ",<br />");
                _email.AddStrAndNewLineToBody("We confirm the following order for " + _ddlThisContact.SelectedItem.Text + ":");
                _email.AddToBody("<ul>");
                foreach (GridViewRow _gv in gvOrderLines.Rows)
                {
                    DropDownList _gvItemDesc      = (DropDownList)_gv.FindControl("ddlItemDesc");
                    Label        _gvItemQty       = (Label)_gv.FindControl("lblQuantityOrdered");
                    DropDownList _gvItemPackaging = (DropDownList)_gv.FindControl("ddlPackaging");
                    // need to check for serivce / note and add the note using the same logic as we have for the delivery sheet
                    if (_gvItemPackaging.SelectedIndex == 0)
                    {
                        _email.AddFormatToBody("<li>{0} x {1}</li>", _gvItemQty.Text, _gvItemDesc.SelectedItem.Text);
                    }
                    else
                    {
                        _email.AddFormatToBody("<li>{0} x {1} - Preperation note: {2}</li>", _gvItemQty.Text, _gvItemDesc.SelectedItem.Text, _gvItemPackaging.SelectedItem.Text);
                    }
                }
                _email.AddStrAndNewLineToBody("</ul>");

                if (_ddlDeliveryBy.SelectedItem.Text == CONST_DELIVERYTYPEISCOLLECTION)
                {
                    _email.AddStrAndNewLineToBody("Will be ready for collection on: " + _lblDeliveryDate.Text);
                }
                else if (_ddlDeliveryBy.SelectedItem.Text == CONST_DELIVERYTYPEISCOURIER)
                {
                    _email.AddStrAndNewLineToBody("Will be dispatched on: " + _lblDeliveryDate.Text + ".");
                }
                else
                {
                    _email.AddStrAndNewLineToBody("Will be delivered on: " + _lblDeliveryDate.Text + ".");
                }

                // Add a footer
                _email.AddStrAndNewLineToBody("<br />Sent automatically by Quaffee's order and tracking System.<br /><br />Sincerely Quaffee Team ([email protected])");
                if (_email.SendEmail())
                {
                    ltrlStatus.Text = "Email Sent to: " + _thisContact.EmailAddress;
                }
                else
                {
                    ltrlStatus.Text = "Email was not sent!";
                }
            }
        }