private void SendErrorEmail(String Text) { Smtp oSmtp = new Smtp(); oSmtp.Subject = "Error Server... " + DateTime.Now.ToShortDateString() + " " + DateTime.Now.ToShortTimeString(); oSmtp.To = "\"Alvaro Medina\" <*****@*****.**>"; oSmtp.From = "\"Signature Server\" <*****@*****.**>"; oSmtp.Body = Text; oSmtp.Send(); return; }
public void Print(PrinterDevice Printo, String PrinterName) { frmViewReport oViewReport = new frmViewReport(); PurchaseOrder oRpt = new PurchaseOrder(); DataSet ds = new DataSet(); ds.Tables.Add(oMySql.GetDataTable("Select * From Vendor Where CompanyID='" + CompanyID + "'", "Vendor")); ds.Tables.Add(oMySql.GetDataTable("Select * From Purchase Where CompanyID='" + CompanyID + "' And PurchaseID='" + ID + "'", "Purchase")); ds.Tables.Add(oMySql.GetDataTable("Select * From Product Where CompanyID='" + CompanyID + "'", "Product")); ds.Tables.Add(oMySql.GetDataTable("Select * From PurchaseDetail Where CompanyID='" + CompanyID + "' And PurchaseID='" + ID + "'", "PurchaseDetail")); // ds.WriteXml("Purchase11.xml", XmlWriteMode.WriteSchema); oRpt.SetDataSource(ds); oRpt.SetParameterValue("CompanyName", base.Name); if (Printo == PrinterDevice.Viewer) { oViewReport.cReport.ReportSource = oRpt; oViewReport.ShowDialog(); } else if (Printo == PrinterDevice.Printer) { oRpt.PrintOptions.PrinterName = PrinterName; oRpt.PrintToPrinter(1, true, 1, 100); } else if (Printo == PrinterDevice.PDF) { PDF oPDF = new PDF(); oPDF.FileName = Application.StartupPath + "\\" + this.ID + ".pdf"; oPDF.ExportReport(oRpt, "pdf", Application.StartupPath + "\\", this.ID); Smtp oSmtp = new Smtp(); oSmtp.Subject = "Purchase Order : " + this.ID + " " + DateTime.Now.ToShortDateString() + " " + DateTime.Now.ToShortTimeString(); oSmtp.To = "<" + "*****@*****.**" + ">"; //this.eMail + ">"; oSmtp.From = "\"Signature Fundraising Customer Service\" <*****@*****.**>"; String strTitle = "Purchase Order\n\r"; oSmtp.Body = strTitle; oSmtp.Attachment = oPDF.FileName; if (!oSmtp.Send()) { return; } } }
public void PrintGPI(PrintTo ToPrint, String PrinterName, String InvoiceNote, Boolean IsPreInvoice) { Double AllPositive = this.GetPositiveAmount(); Double AllNegative = this.GetNegativeAmount(); Double DropPercentageCustomer = 0.00; Double DropPercentageItem = 0.00; if (Retail < 2500 && !this.IsGiftAvenue && !this.IsGPI) { DataTable dtInv = GetCurrentTotalsByBrochure(); if (dtInv != null) { if (LastInvoicedAmount == 0 && Retail < 2500 && Retail > 0) { if (!IsPreInvoice) { SubtractBrochureProfitPercent(InvoicedAmount, dtInv); } else { DropPercentageCustomer = -5.00; } } DropPercentageItem = -5.00; } else { return; } } this.Note = InvoiceNote; this.Note += "\n" + GetStringOverageInvoice(); DataSet ds = new DataSet(); ds.Tables.Add(oMySql.GetDataTable(String.Format("Select * From Customer Where CompanyID='{0}' And CustomerID='{1}'", CompanyID, ID), "Customer")); DataTable dvInv = new DataTable(); dvInv = GetTotalDataTableGPI("ProductID", DropPercentageCustomer, DropPercentageItem); ds.Tables.Add(CreateDetailTable(dvInv)); //Detail DataTable dtTotals = GetCurrentTotalsGPI(DropPercentageCustomer, DropPercentageItem); //GetTotalDataTable("CustomerID"); //GetCurrentTotalsByBrochure(); if (dtTotals != null) { ds.Tables.Add(dtTotals); //Detail frmViewReport oViewReport = new frmViewReport(); //ds.WriteXml("Invoice.xml", XmlWriteMode.WriteSchema); InvoiceHeaderDetailGPI oRpt = new InvoiceHeaderDetailGPI(); oRpt.SetDataSource(ds); oRpt.SetParameterValue("PrevInvoice", AllPositive); //LastInvoicedAmount); oRpt.SetParameterValue("Payments", AllNegative); //PaymentsAmount+Charges); oRpt.SetParameterValue("AddedAmount", AddedAmount); oRpt.SetParameterValue("BalanceDue", AllPositive + AllNegative + AddedAmount); //AmountDue); oRpt.SetParameterValue("InvoiceNote", this.Note); Company oCompany = new Company(this.CompanyID); oRpt.SetParameterValue("CompanyName", oCompany.Name); if (this.BrochureID == "C" || this.BrochureID_2 == "C" || this.BrochureID_3 == "C") { oRpt.SetParameterValue("txtFee", "E Card Ship Fee".ToUpper()); } else { oRpt.SetParameterValue("txtFee", "IMPRINT FEE"); } if (this.IsPostPay) { oRpt.SetParameterValue("Terms", ""); } else { oRpt.SetParameterValue("Terms", "TERMS: NET DUE UPON DELIVERY"); } if (ToPrint == PrintTo.File) { PDF oPDF = new PDF(); oPDF.FileName = Application.StartupPath + "\\" + this.Name + ".pdf"; oPDF.ExportReport(oRpt, "pdf", Application.StartupPath + "\\", this.Name); Smtp oSmtp = new Smtp(); oSmtp.Subject = "Invoice for " + this.Name + " " + DateTime.Now.ToShortDateString() + " " + DateTime.Now.ToShortTimeString(); oSmtp.To = "<" + "*****@*****.**" + ">"; //this.eMail + ">"; oSmtp.From = "\"Signature Fundraising Customer Service\" <*****@*****.**>"; String strTitle = "Invoice\n\r"; oSmtp.Body = strTitle; oSmtp.Attachment = oPDF.FileName; if (!oSmtp.Send()) { return; } } else if (ToPrint == PrintTo.Printer) { oRpt.PrintOptions.PrinterName = PrinterName; oRpt.PrintToPrinter(1, true, 1, 100); } else if (ToPrint == PrintTo.Viewer) { oViewReport.cReport.ReportSource = oRpt; oViewReport.ShowDialog(); //oViewReport.cReport.PrintReport(); } if (!IsPreInvoice) { UpdateInventory(); //Update Statement if (LastInvoicedAmount != InvoicedAmount) { UpdateInvoicedAmount(InvoicedAmount - LastInvoicedAmount); //Adding Line ,,,, AddedAmount = 0.00; } } this.UpdateCurrentTotals(); ds.Dispose(); oRpt.Dispose(); } return; }
public Boolean PrintStatement(String PrinterName, PrinterDevice Device) { if (_Total == 0) { Total = GetTotal(); Update(); } frmViewReport oViewReport = new frmViewReport(); //DataSet ds1 = oMySql.GetCustomerStatement(CompanyID, ID); DataSet ds = new DataSet(); ds.Tables.Add(oMySql.GetDataTable(String.Format("Select * From Vendor Where CompanyID='{0}' And VendorID='{1}'", CompanyID, this.VendID), "Vendor")); ds.Tables.Add(oMySql.GetDataTable(String.Format("Select * From Purchase Where CompanyID='{0}' And PurchaseID='{1}'", CompanyID, this.ID), "Purchase")); ds.Tables.Add(oMySql.GetDataTable(String.Format("Select * From PaymentProvider Where CompanyID='{0}' And PurchaseID='{1}' Order by Date", CompanyID, ID), "Statement")); PurchaseStatement oRpt = new PurchaseStatement(); // ds.WriteXml("PrintStatement1.xml", XmlWriteMode.WriteSchema); oRpt.SetDataSource(ds); oRpt.SetParameterValue("CompanyName", base.Name); if (Device == PrinterDevice.Printer) { oRpt.PrintOptions.PrinterName = PrinterName; oRpt.PrintToPrinter(1, true, 1, 100); } else if (Device == PrinterDevice.eMail) { PDF oPDF = new PDF(); oPDF.FileName = Application.StartupPath + "\\" + this.ID + ".pdf"; oPDF.ExportReport(oRpt, "pdf", Application.StartupPath + "\\", this.ID); Smtp oSmtp = new Smtp(); oSmtp.Subject = base.ID + " - Statement " + DateTime.Now.ToShortDateString() + " " + DateTime.Now.ToShortTimeString() + "(" + this.ID + " - " + this.Name + ")"; if (PrinterName != "") { oSmtp.To = "\"" + this.Name + "\" <" + PrinterName + ">"; //this.eMail + ">"; } /* * else if (this.isEmail(this.eMail) && File.Exists(oPDF.FileName)) * { * * oSmtp.To = "\"" + this.Chairperson + "\" <" + this.eMail + ">"; * if (this.isEmail(this.oCustomerExtra.eMail)) * { * oSmtp.To = "\"" + this.Chairperson + "\" <" + this.oCustomerExtra.eMail + ">"; * } * * oSmtp.To = "\"" + "Scott Elsbree" + "\" <" + "*****@*****.**" + ">"; //this.eMail + ">"; * } */ else { oSmtp.To = "\"" + "Scott Elsbree" + "\" <" + "*****@*****.**" + ">"; //this.eMail + ">"; } oSmtp.From = "\"Signature Fundraising Customer Service\" <*****@*****.**>"; String strTitle = "\n\r"; strTitle += "Thank you for choosing Signature Fundraising. As of today we have not received complete payment for your account.\n\r"; strTitle += "We have attached a copy of your most recent statement showing the balance due. Please remember that according to\n\r"; strTitle += "the agreement we have with your organization interest will accrue on any unpaid balance after 20 days of delivery.\n\r"; strTitle += "We have also attached a check by fax form that will enable you to send payment to us right away. If you have any \n\r"; strTitle += "questions, you may reply to this e-mail or call us at 1-800-645-3863.\n\r"; strTitle += "\n\nThank you.\n\r"; strTitle += "Signature Fundraising\n\r"; //String strTitle = "This statement amount due is for a total of :\n\r $ " + this.StatementAmountDue.ToString() + " \n\r" ; //This invoice is for a total of ::invoice amount::, of which ::payment amount:: has already been received. /* * if (PrinterName == "" && !this.isEmail(this.eMail)) * strTitle += " WRONG EMAIL ADDRESS: " + this.eMail + " of " + this.ID + " : " + this.Name; * * if (PrinterName == "" && !File.Exists(oPDF.FileName)) * strTitle += " NO PDF FILE : " + this.eMail + " of " + this.ID + " : " + this.Name; * else * oSmtp.Attachment = oPDF.FileName; */ oSmtp.Body = strTitle; oSmtp.Attachment = "Check by Fax Form.pdf"; oSmtp.Credentials = new System.Net.NetworkCredential("*****@*****.**", "sigfund"); // oSmtp.BCC = "*****@*****.**"; if (!oSmtp.Send()) { Console.WriteLine(oSmtp.Error); oRpt.Dispose(); oViewReport.Dispose(); return(false); } //while (File.GetAttributes(oPDF.FileName) == FileAttributes.ReadOnly) ; /* * ReadFile: * try * { * if (File.Exists(oPDF.FileName)) * File.Delete(oPDF.FileName); * } * catch (IOException ex) * { * Console.WriteLine(ex.Message); * goto ReadFile; * } */ } else { oViewReport.cReport.ReportSource = oRpt; oViewReport.ShowDialog(); } oRpt.Dispose(); oViewReport.Dispose(); return(true); }
public void ImportOrders(String Database, ShoppingType ShoppingCart, String CompanyID, String CustomerID) { this.CompanyID = CompanyID; this.CustomerID = CustomerID; Customer oCustomer = new Customer(this.CompanyID); /* * if (!oMySql.ChangeDatabase("69.89.31.153", "signatv9_sa", "sa", "signatv9_SigWeb")) * { * MessageBox.Show("We cannot open this database"); * return; * } */ oMySql.ChangeDatabase(Database); //DataTable dtOrders = oRemoteMysql.GetDataTable("SELECT * FROM cart_orders Where Status='"+(int)InternetOrderStatus.Pending+"' And open='n'","Order"); DataSet dsTables = oMySql.GetDataset("CALL get_tables();"); //MessageBox.Show(dsTables.Tables["Table6"].Rows.Count.ToString()); Console.WriteLine(ShoppingCart.ToString() + " " + dsTables.Tables["Table6"].Rows.Count.ToString() + " order(s)"); //return; //192.168.254.65 /* * if (!oMySql.ChangeDatabase(this.Local, "SigData", "SigData009", "SigData")) * { * return; * }*/ oMySql.ChangeDatabase("SigData"); dsTables.Tables["table"].TableName = "Customer"; dsTables.Tables["table1"].TableName = "Student"; dsTables.Tables["table2"].TableName = "CreditCard"; dsTables.Tables["table3"].TableName = "Shipment"; dsTables.Tables["table4"].TableName = "Detail"; dsTables.Tables["table5"].TableName = "Product"; dsTables.Tables["table6"].TableName = "Order"; dsTables.Tables["table7"].TableName = "CustomCard"; //dsTables.Tables.Add(dtOrders); DataRelation custOrderRel = dsTables.Relations.Add("OrdersCust", dsTables.Tables["Order"].Columns["customer"], dsTables.Tables["Customer"].Columns["id"], false); DataRelation studentOrderRel = dsTables.Relations.Add("OrdersStudent", dsTables.Tables["Order"].Columns["id"], dsTables.Tables["Student"].Columns["order_id"]); DataRelation detailOrderRel = dsTables.Relations.Add("OrdersDetail", dsTables.Tables["Order"].Columns["id"], dsTables.Tables["Detail"].Columns["order_id"]); DataRelation creditcardOrderRel = dsTables.Relations.Add("OrdersCreditcard", dsTables.Tables["Order"].Columns["id"], dsTables.Tables["CreditCard"].Columns["order_id"]); DataRelation shipOrderRel = dsTables.Relations.Add("OrdersShip", dsTables.Tables["Order"].Columns["id"], dsTables.Tables["Shipment"].Columns["order_id"]); DataRelation productDetailRel = dsTables.Relations.Add("DetailProduct", dsTables.Tables["Detail"].Columns["product_id"], dsTables.Tables["Product"].Columns["ProductID"], false); DataRelation productCustomCard = dsTables.Relations.Add("Custom_Card", dsTables.Tables["Detail"].Columns["id"], dsTables.Tables["CustomCard"].Columns["ticket_id"], false); //MySQL.conn = null; OrderInternet oOrder = new OrderInternet(this.CompanyID); //int i = 0; String strBody = ""; String strBodyPrizes = ""; if (dsTables.Tables["Order"].Rows.Count > 0) { oOrder.OpenPrinter(3); } foreach (DataRow row in dsTables.Tables["Order"].Rows) { oOrder.CustomerID = CustomerID; String StudentName = ""; String TeacherName = ""; String Customized = ""; if (row.GetChildRows(studentOrderRel).Length > 0) { TeacherName = row.GetChildRows(studentOrderRel)[0]["school_name"].ToString().ToUpper().Replace("\"", " ").Replace("'", " "); } if (TeacherName.Trim().Length == 0) { TeacherName = "GENERAL CUSTOMER"; StudentName = ((row.GetChildRows(shipOrderRel)[0]["FirstName"].ToString().Length > 0 ? (row.GetChildRows(shipOrderRel)[0]["FirstName"].ToString().Substring(0, 1)) : "?") + "." + row.GetChildRows(shipOrderRel)[0]["LastName"].ToString()).ToUpper().Replace("\"", " ").Replace("'", " "); } else { String Initial = ""; if (row.GetChildRows(shipOrderRel)[0]["FirstName"].ToString() != "") { Initial = row.GetChildRows(shipOrderRel)[0]["FirstName"].ToString().Substring(0, 1); } StudentName = (Initial + "." + row.GetChildRows(shipOrderRel)[0]["LastName"].ToString() + "-" + row.GetChildRows(studentOrderRel)[0]["student_name"].ToString()).ToUpper().Replace("\"", " ").Replace("'", " "); String Result = oCustomer.GetSchool(TeacherName, row.GetChildRows(studentOrderRel)[0]["school_city"].ToString()); if (oCustomer.Find(Result)) { TeacherName = oCustomer.Name.PadRight(30).Substring(0, 24) + " " + oCustomer.ID.Trim(); } else { TeacherName = TeacherName.PadRight(30).Substring(0, 24) + " " + "00000"; } // Console.Out.WriteLine(TeacherName + " " + Global.getState(row.GetChildRows(studentOrderRel)[0]["school_city"].ToString().ToUpper() )); } Console.Out.WriteLine(DateTime.Now.ToString() + "-" + TeacherName); // continue; if (!oOrder.Exist((Int32)row["id"], ShoppingCart)) { if (oOrder.Exist((ShoppingCart == ShoppingType.WLOT)? ShoppingType.WLOT.ToString():TeacherName, StudentName)) { if (StudentName.Length >= 33) { StudentName = StudentName.Substring(0, 33); } StudentName += "-" + row["id"].ToString(); } oOrder.Clear(); oOrder.CustomerID = CustomerID; oOrder.oCustomer.Find(oOrder.CustomerID); oOrder.oCustomer.Brochures.Load(this.CompanyID, oOrder.CustomerID); oOrder.Type = OrderType.Internet; oOrder.Process = OrderProcess.Internet; oOrder.IOrderID = (Int32)row["id"]; oOrder.Teacher = (ShoppingCart == ShoppingType.WLOT)? ShoppingType.WLOT.ToString():TeacherName; oOrder.Student = StudentName.Replace("\"", " ").Replace("'", " ");; oOrder.Items.Clear(); // Console.Out.WriteLine(oOrder.Student); foreach (DataRow detailRow in row.GetChildRows(detailOrderRel)) { // Console.Out.WriteLine("Product ID: " + detailRow["product_id"]); // Console.Out.WriteLine("Quantity: " + detailRow["quantity"]); //Console.Out.WriteLine("Description: " + oOrder.oProduct.Description); String ProductID = detailRow["product_id"].ToString(); if (IsMagazine(ProductID)) { if (detailRow.GetChildRows(productDetailRel).Length == 0) { this.SendErrorEmail(ShoppingCart.ToString() + " Item Error " + oOrder.IOrderID.ToString() + " " + oOrder.Teacher + " " + oOrder.Student + " Item:" + ProductID); continue; } else { ProductID = GetMagazineCode(ProductID, (Double)detailRow.GetChildRows(productDetailRel)[0]["Price"]); } } if (oOrder.oProduct.Find(ProductID)) { // Console.Out.WriteLine("Price: " + oOrder.oProduct.Price.ToString()); Order.Item Item = new Order.Item(); Item.ProductID = oOrder.oProduct.ID; Item.Quantity = (Int32)detailRow["quantity"]; Item.Description = oOrder.oProduct.Description; Item.Price = oOrder.oProduct.ExtendedPrice(oOrder.oCustomer); Item.PackID = oOrder.oProduct.PackID(oOrder.oCustomer); // Custom Card foreach (DataRow DetailRow in detailRow.GetChildRows(productCustomCard)) { Customized = "(Customized)"; // if (Item.ProductID != DetailRow["product_id"].ToString()) // continue; Ticket oTicket = new Ticket(oOrder.CompanyID); oTicket.OrderID = Convert.ToInt32(oOrder.ID); oTicket.Quantity = (Int32)detailRow["quantity"]; //1; Modified on 10/06/2001 oTicket.ProductID = DetailRow["product_id"].ToString(); //Line 1 Ticket.Line oLine = new Ticket.Line(); oLine.Text = (DetailRow["Line_1"].ToString().Length > 40 ? DetailRow["Line_1"].ToString().Substring(0, 39) : DetailRow["Line_1"].ToString()).ToUpper(); oLine.Type = Ticket.ImprintType.Card; oTicket.Lines.Add("Line_1", oLine); oLine = new Ticket.Line(); oLine.Text = (DetailRow["Line_2"].ToString().Length > 40 ? DetailRow["Line_2"].ToString().Substring(0, 39) : DetailRow["Line_2"].ToString()).ToUpper(); oLine.Type = Ticket.ImprintType.Card; oTicket.Lines.Add("Line_2", oLine); oLine = new Ticket.Line(); oLine.Text = (DetailRow["Line_3"].ToString().Length > 40 ? DetailRow["Line_3"].ToString().Substring(0, 39) : DetailRow["Line_3"].ToString()).ToUpper(); oLine.Type = Ticket.ImprintType.Card; oTicket.Lines.Add("Line_3", oLine); oLine = new Ticket.Line(); oLine.Text = (DetailRow["Line_4"].ToString().Length > 40 ? DetailRow["Line_4"].ToString().Substring(0, 39) : DetailRow["Line_4"].ToString()).ToUpper(); oLine.Type = Ticket.ImprintType.Card; oTicket.Lines.Add("Line_4", oLine); oLine = new Ticket.Line(); oLine.Text = (DetailRow["Line_5"].ToString().Length > 40 ? DetailRow["Line_5"].ToString().Substring(0, 39) : DetailRow["Line_5"].ToString()).ToUpper(); oLine.Type = Ticket.ImprintType.Card; oTicket.Lines.Add("Line_5", oLine); // Console.Out.WriteLine("Quantity: " + detailRow["quantity"]); //oTicket.Save(); Item.Tickets.Add(Item.ProductID, oTicket); } if (oOrder.Items.Contains(oOrder.oProduct.ID)) { oOrder.Items[oOrder.oProduct.ID].Quantity += Item.Quantity; } else { oOrder.Items.Add(oOrder.oProduct.ID, Item); } } else { this.SendErrorEmail(ShoppingCart.ToString() + " Item Error " + oOrder.IOrderID.ToString() + " " + oOrder.Teacher + " " + oOrder.Student + " Item:" + ProductID); } } oOrder.GetTotals(); oOrder.Collected = oOrder.Retail; oOrder.Save(OrderType.Internet); /* * //Custom Cards Detail * if (row.GetChildRows(productCustomCard).Length > 0) * { * if (oOrder.Find(Convert.ToInt32(oOrder.ID))) * { * foreach (DataRow detailRow in row.GetChildRows(productCustomCard)) * { * * Ticket oTicket = new Ticket(oOrder.CompanyID); * oTicket.OrderID = Convert.ToInt32(oOrder.ID); * oTicket.Quantity = 1; * oTicket.ProductID = detailRow["product_id"].ToString(); * * //Line 1 * Ticket.Line oLine = new Ticket.Line(); * oLine.Text = detailRow["Line_1"].ToString().Length > 40? detailRow["Line_1"].ToString().Substring(0,39):detailRow["Line_1"].ToString() ; * oLine.Type = Ticket.ImprintType.Card; * oTicket.Lines.Add("Line_1,",oLine); * * oLine = new Ticket.Line(); * oLine.Text = detailRow["Line_2"].ToString().Length > 40 ? detailRow["Line_2"].ToString().Substring(0, 39) : detailRow["Line_2"].ToString(); * oLine.Type = Ticket.ImprintType.Card; * oTicket.Lines.Add("Line_2,", oLine); * * oLine = new Ticket.Line(); * oLine.Text = detailRow["Line_3"].ToString().Length > 40 ? detailRow["Line_3"].ToString().Substring(0, 39) : detailRow["Line_3"].ToString(); * oLine.Type = Ticket.ImprintType.Card; * oTicket.Lines.Add("Line_3,", oLine); * * // Console.Out.WriteLine("Quantity: " + detailRow["quantity"]); * oTicket.Save(); * * * } * } * } */ //Printing Packing Slips if (oOrder.Find(Convert.ToInt32(oOrder.ID))) { oOrder.UpdateOrderID((Int32)row["id"], ShoppingCart); //Create Shortage Shortage oShortage = new Shortage(this.CompanyID); //oShortage.oOrder = oOrder; oShortage.OrderID = oOrder.ID; oShortage.oCustomer = oOrder.oCustomer; oShortage.CustomerID = oOrder.CustomerID; oShortage.SchoolName = (row.GetChildRows(shipOrderRel)[0]["FirstName"].ToString() + " " + row.GetChildRows(shipOrderRel)[0]["LastName"].ToString()).ToUpper(); oShortage.DayPhone = row.GetChildRows(shipOrderRel)[0]["phone"].ToString().Replace("(", "").Replace(")", "").Replace("-", "").Replace(" ", ""); oShortage.TeacherName = oOrder.Teacher; oShortage.StudentName = oOrder.Student; oShortage.Address = row.GetChildRows(shipOrderRel)[0]["address"].ToString() + " " + row.GetChildRows(shipOrderRel)[0]["address2"].ToString(); oShortage.City = row.GetChildRows(shipOrderRel)[0]["City"].ToString(); oShortage.ZipCode = row.GetChildRows(shipOrderRel)[0]["ZipCode"].ToString(); oShortage.State = row.GetChildRows(shipOrderRel)[0]["State"].ToString(); oShortage.Type = "I"; oShortage.Detail = oOrder.NoItems.ToString() + " Item(s)" + "\n\r" + "\n\r"; oShortage.Detail += "OrderID : " + oOrder.ID.ToString() + "\n\r"; oShortage.Detail += "Processed On : " + (row["processed_on"] == null? "": ((DateTime)row["processed_on"]).ToString()) + "\n\r"; oShortage.eMail = row.GetChildRows(custOrderRel).Length > 0?row.GetChildRows(custOrderRel)[0]["email"].ToString():""; oShortage.Save(); // oShortage.Print(false); oOrder.ShortageID = Convert.ToInt32(oShortage.ID); oOrder.Print(); } else { this.SendErrorEmail(oOrder.IOrderID.ToString() + " " + oOrder.Teacher + " " + oOrder.Student + oOrder.LastError); } if (TeacherName != "GENERAL CUSTOMER") { String DeliveryDate = " / "; // : oCustomer.DeliveryDate.ToString("dd/MM/yyyy"); String Packed = " "; if (oCustomer.ID != "") { if (oCustomer.ShipDate != Global.DNull) { DeliveryDate = oCustomer.ShipDate.ToString("MM/dd"); } else { DeliveryDate = oCustomer.DeliveryDate.ToString("MM/dd"); } Packed = oCustomer.NumberPallets > 0?"YES":"NO "; } //String Packed = oCustomer.ID == ""? " ":(oCustomer.ShipDate!=null?) if (oOrder.ID == "0") { strBody += "[" + oOrder.IOrderID.ToString().PadLeft(5) + "]" + oOrder.Teacher + " " + oOrder.Student.PadRight(30).Substring(0, 30) + " " + oOrder.NoItems.ToString().PadRight(3).Substring(0, 3) + " " + row.GetChildRows(studentOrderRel)[0]["school_city"].ToString().ToUpper() + " " + Global.getState(row.GetChildRows(studentOrderRel)[0]["school_state"].ToString().ToUpper()) + " " + DeliveryDate + " " + Packed + Customized + "\n\r"; } else { strBody += oOrder.ID.ToString().PadLeft(5) + " " + oOrder.Teacher + " " + oOrder.Student.PadRight(30).Substring(0, 30) + " " + oOrder.NoItems.ToString().PadRight(3).Substring(0, 3) + " " + row.GetChildRows(studentOrderRel)[0]["school_city"].ToString().ToUpper() + " " + Global.getState(row.GetChildRows(studentOrderRel)[0]["school_state"].ToString().ToUpper()) + " " + DeliveryDate + " " + Packed + Customized + "\n\r"; } if (ShoppingCart == ShoppingType.SigFund) { strBodyPrizes += row.GetChildRows(custOrderRel)[0]["FirstName"].ToString().ToUpper() + " " + row.GetChildRows(custOrderRel)[0]["LastName"].ToString().ToUpper() + " " + oOrder.Teacher.PadRight(30) + " " + row.GetChildRows(custOrderRel)[0]["City"].ToString().ToUpper() + " " + Global.getState(row.GetChildRows(custOrderRel)[0]["State"].ToString().ToUpper()) + " " + (row.GetChildRows(studentOrderRel)[0]["student_name"].ToString()).ToUpper().Replace("\"", " ").Replace("'", " ") + " " + oOrder.NoItems.ToString().PadRight(3).Substring(0, 3) + "\n\r"; } } else { strBody += oOrder.ID.ToString() + "[" + oOrder.IOrderID.ToString() + "]" + oOrder.Teacher.PadRight(30) + " " + oOrder.Student.PadRight(30).Substring(0, 30) + " " + oOrder.NoItems.ToString().PadRight(3).Substring(0, 3) + " " + row.GetChildRows(custOrderRel)[0]["City"].ToString().ToUpper() + " " + Global.getState(row.GetChildRows(custOrderRel)[0]["State"].ToString().ToUpper()) + Customized + "\n\r"; //oOrder.ID.ToString() + "[" + oOrder.IOrderID.ToString() + "]" + oOrder.Teacher.PadRight(30) + " " + oOrder.Student.PadRight(30).Substring(0, 30) + " " + oOrder.NoItems.ToString().PadRight(3).Substring(0, 3) + " " + row.GetChildRows(custOrderRel)[0]["City"].ToString().ToUpper() + " " + Global.getState(row.GetChildRows(custOrderRel)[0]["State"].ToString().ToUpper()) + Customized + "\n\r"; } } else { /* * Console.Out.Write("."); * // strBody += "(R)" + oOrder.ID.ToString() + " " + oOrder.Teacher + " " + oOrder.Student + " " + oOrder.NoItems.ToString() + " " + row.GetChildRows(studentOrderRel)[0]["school_city"].ToString().ToUpper() + " " + row.GetChildRows(studentOrderRel)[0]["school_state"].ToString().ToUpper() + "\n\r"; * if (TeacherName != "GENERAL CUSTOMER") * { * strBody += "(R)" + oOrder.ID.ToString() + " " + oOrder.Teacher + " " + oOrder.Student + " " + oOrder.NoItems.ToString() + " " + row.GetChildRows(studentOrderRel)[0]["school_city"].ToString().ToUpper() + " " + row.GetChildRows(studentOrderRel)[0]["school_state"].ToString().ToUpper() + "\n\r"; * } * else * { * strBody += "(R)" + oOrder.ID.ToString() + " " + oOrder.Teacher + " " + oOrder.Student + " " + oOrder.NoItems.ToString() + " " + row.GetChildRows(custOrderRel)[0]["City"].ToString().ToUpper() + " " + row.GetChildRows(custOrderRel)[0]["State"].ToString().ToUpper() + "\n\r"; * } */ //Print Orders When requested oOrder.Print(); } if (!oOrder.UpdateStatus(InternetOrderStatus.Processed, Database)) { this.SendErrorEmail(oOrder.IOrderID.ToString() + " " + oOrder.Teacher + " " + oOrder.Student + oOrder.LastError); return; } } if (dsTables.Tables["Order"].Rows.Count > 0) { oOrder.ClosePrinter(); //Sending Email Smtp oSmtp = new Smtp(); oSmtp.Subject = "Emails processed " + DateTime.Now.ToShortDateString() + " " + DateTime.Now.ToShortTimeString() + " " + ShoppingCart.ToString(); if (this.CustomerID == "TEST") { oSmtp.To = "\"Alvaro Medina\" <*****@*****.**>"; } else { oSmtp.To = "\"Scott Elsbree\" <*****@*****.**>"; oSmtp.To = "\"Desiree\" <*****@*****.**>"; oSmtp.CC = "\"Alvaro Medina\" <*****@*****.**>"; if (ShoppingCart == ShoppingType.SigFund) { oSmtp.BCC = "\"signaturefundraising.com \" <*****@*****.**>"; } if (ShoppingCart == ShoppingType.ChristianCollection) { oSmtp.BCC = "\"abundantfunds.com \" <*****@*****.**>"; } } oSmtp.From = "\"Signature Server\" <*****@*****.**>"; String strTitle = "Order ID[Internet] Teacher Student Items City State Ship/Del Packed\n\r"; strTitle += "------------------------------------------------------------------------------------------\n\r"; String strTotal = "------------------------------------------------------------------------------------------\n\r"; strTotal += "Total: " + dsTables.Tables["Order"].Rows.Count.ToString() + " Order(s)"; oSmtp.Body = strTitle + strBody + strTotal; oSmtp.Send(); //Second Prize Report if (strBodyPrizes != "" && ShoppingCart == ShoppingType.SigFund) { oSmtp.Subject = "Emails processed (Items Update)" + DateTime.Now.ToShortDateString() + " " + DateTime.Now.ToShortTimeString() + " " + ShoppingCart.ToString(); oSmtp.To = "\"Item Update \" <*****@*****.**>"; oSmtp.From = "\"Signature Server\" <*****@*****.**>"; oSmtp.BCC = "\"Alvaro Medina\" <*****@*****.**>"; strTitle = "Online Customer School Name City State StudentName Items\n\r"; strTitle += "------------------------------------------------------------------------------------------\n\r"; strTotal = "------------------------------------------------------------------------------------------\n\r"; strTotal += "Total: " + dsTables.Tables["Order"].Rows.Count.ToString() + " Order(s)"; oSmtp.Body = strTitle + strBodyPrizes + strTotal; oSmtp.Send(); } } dsTables.Dispose(); }