Exemplo n.º 1
0
        public static void ProcessFailedOrder(int requestID, string xmlMessage)
        {
            var rep = new Repository();
            var failure = new FailedOrder()
            {
                Imported = false,
                RequestID = requestID,
                OrderID = rep.GetQuickBooksOrderByRequestID(requestID).OrderID,
                DateAdded = DateTime.Now,
                ClientID = rep.GetUser(WebSecurity.CurrentUserId).ClientID ?? 0
            };

            var order = rep.GetQuickBooksOrderByRequestID(requestID);
            order.ResponseXML = xmlMessage;
            rep.Add(failure);
            rep.Save();

            var hostUrl = HttpContext.Current.Request.Url.GetComponents(UriComponents.SchemeAndServer, UriFormat.Unescaped);
            hostUrl = "http://quickbooks.infomedia.com";
            var importUrl = hostUrl + VirtualPathUtility.ToAbsolute("~/Account/Unprocessed-Invoices");
            var modifyUrl = hostUrl + VirtualPathUtility.ToAbsolute("~/Account/Inventory");
            var body = new System.Text.StringBuilder();
            body.AppendLine("There was an error processing a website sale with Quickbooks");
            body.AppendLine("The most likely cause was that an item on the order was not found in your quickbooks inventory.");
            body.AppendLine("Please view the order that failed and create the invoice manually here: " + importUrl);
            body.AppendLine("You can modify your inventory naming schema here: " + modifyUrl);
            body.AppendLine(order.Receipt);
            body.AppendLine(xmlMessage);
            var user = rep.GetUser(WebSecurity.CurrentUserId);
            var email = user.Client.EmailRecipient != null ? user.Client.EmailRecipient : WebSecurity.CurrentUserName;
            WebMail.Send(email, "Quickbooks Web Connector Failed Invoice Attempt", body.ToString(), cc: "*****@*****.**", isBodyHtml: false);
        }
Exemplo n.º 2
0
        public static void ProcessFailedOrder(Order order)
        {
            var rep = new Repository();
            var failure = new FailedOrder()
            {
                Imported = false,
                OrderID = order.OrderID,
                DateAdded = DateTime.Now,
                ClientID = rep.GetUser(WebSecurity.CurrentUserId).ClientID ?? 0
            };
            order.Reported = true;
            rep.Add(failure);
            rep.Save();

            var hostUrl = HttpContext.Current.Request.Url.GetComponents(UriComponents.SchemeAndServer, UriFormat.Unescaped);
            hostUrl = "http://quickbooks.infomedia.com";
            var importUrl = hostUrl + VirtualPathUtility.ToAbsolute("~/Account/Unprocessed-Invoices");
            var modifyUrl = hostUrl + VirtualPathUtility.ToAbsolute("~/Account/Inventory");
            var body = new System.Text.StringBuilder();
            body.AppendLine("Someone has made a purchase on your website which was not possible to import through the Web Connector and is ready for manual import.");
            body.AppendLine("Please view the order that failed and create the invoice manually here: " + importUrl);
            body.AppendLine(order.Receipt);
            var user = rep.GetUser(WebSecurity.CurrentUserId);
            var email = user.Client.EmailRecipient != null ? user.Client.EmailRecipient : WebSecurity.CurrentUserName;
            WebMail.Send(email, "Quickbooks Web Connector Failed Invoice Attempt", body.ToString(), cc: "*****@*****.**", isBodyHtml: false);
        }
Exemplo n.º 3
0
 public void Add(FailedOrder failedOrder)
 {
     QbDb.FailedOrders.InsertOnSubmit(failedOrder);
 }
Exemplo n.º 4
0
		private void detach_FailedOrders(FailedOrder entity)
		{
			this.SendPropertyChanging();
			entity.Client = null;
		}
Exemplo n.º 5
0
 partial void DeleteFailedOrder(FailedOrder instance);
Exemplo n.º 6
0
 partial void UpdateFailedOrder(FailedOrder instance);
Exemplo n.º 7
0
 partial void InsertFailedOrder(FailedOrder instance);
Exemplo n.º 8
0
		private void attach_FailedOrders(FailedOrder entity)
		{
			this.SendPropertyChanging();
			entity.Order = this;
		}