void device_NewFrame(object sender, AForge.Video.NewFrameEventArgs eventArgs) { Bitmap shoot = eventArgs.Frame.Clone() as Bitmap; try { frameCounter++; if (frameCounter > 10) { invoices = invoiceProcess.GetInvoiceCollection(shoot); frameCounter = 0; } if (invoices!=null&&invoices.Count>0) { using (Graphics graph = Graphics.FromImage(shoot)) { foreach (Invoice invoice in invoices) { graph.DrawPolygon(pen, invoice.Corners); //Draw a polygon around card PointF point = invoiceProcess.GetStringPoint(invoice.Corners); //Find Top left corner point.Y += 10; graph.DrawString(invoice.Code == null ? "" : invoice.Code, font, Brushes.Lime, point); //Write string on card } } } //Draw Rectangle around cards and write card strings on card } catch (Exception ex) { File.AppendAllText("e:\\error.txt",ex.Message); throw; } pb_Cinema.Image = ResizeShoot(shoot); }
/// <summary> /// Method to get invoices from database /// </summary> /// <returns>invoices</returns> public static InvoiceCollection GetInvoices() { InvoiceCollection invoices; using (SqlConnection conn = new SqlConnection(connString)) { string query = @"SELECT DetailId, Quantity, Sku, Description, Price, Taxable FROM InvoiceDetail ORDER BY DetailId"; using (SqlCommand cmd = new SqlCommand()) { cmd.CommandType = CommandType.Text; cmd.CommandText = query; cmd.Connection = conn; conn.Open(); invoices = new InvoiceCollection(); using (SqlDataReader reader = cmd.ExecuteReader()) { int detailId; int quantity; string sku; string description = null; decimal price; bool taxable = false; while (reader.Read()) { detailId = (int)reader["DetailId"]; quantity = (int)reader["Quantity"]; sku = reader["Sku"] as string; if (!reader.IsDBNull(3)) { description = reader["Description"] as string; } price = (decimal)reader["Price"]; if (!reader.IsDBNull(5)) { taxable = (bool)reader["Taxable"]; } invoices.Add(new Invoice { DetailId = detailId, Quantity = quantity, Sku = sku, Description = description, Price = price, Taxable = taxable }); description = null; taxable = false; } } } return(invoices); } }
public RedirectResult CreatePurchase([FromForm(Name = "recurly-token")] string tokenId, [FromForm(Name = "account-code")] string accountCode, [FromForm(Name = "first-name")] string firstName, [FromForm(Name = "last-name")] string lastName) { // If our form specifies an account code, we can use that; otherwise, // create an account code with a uniq id accountCode = accountCode ?? Guid.NewGuid().ToString(); var purchaseReq = new PurchaseCreate() { Currency = "USD", Account = new AccountPurchase() { Code = accountCode, FirstName = firstName, LastName = lastName, BillingInfo = new BillingInfoCreate() { TokenId = tokenId } }, Subscriptions = new List <SubscriptionPurchase>() { new SubscriptionPurchase() { PlanCode = "basic" } } }; try { InvoiceCollection collection = _client.CreatePurchase(purchaseReq); _logger.LogInformation($"Created ChargeInvoice with Number: {collection.ChargeInvoice.Number}"); } catch (Recurly.Errors.Transaction e) { /** * Note: This is not an example of extensive error handling, * it is scoped to handling the 3DSecure error for simplicity. * Please ensure you have proper error handling before going to production. */ TransactionError transactionError = e.Error.TransactionError; if (transactionError != null && transactionError.Code == "three_d_secure_action_required") { string actionTokenId = transactionError.ThreeDSecureActionTokenId; return(Redirect($"/3d-secure/authenticate.html#token_id={tokenId}&action_token_id={actionTokenId}&account_code={accountCode}")); } return(HandleError(e)); } catch (Recurly.Errors.ApiError e) { return(HandleError(e)); } return(Redirect(SuccessURL)); }
public static InvoiceCollection ShowInvoices() { InvoiceCollection lists = new InvoiceCollection(); lists.ReadList(); if (lists.Count!=0) { return lists; } else { return null; } }
public static InvoiceCollection ShowInvoices() { InvoiceCollection lists = new InvoiceCollection(); lists.ReadList(); if (lists.Count != 0) { return(lists); } else { return(null); } }
/// <summary> /// Button to save upon click /// </summary> /// <param name="sender">the control/object to set</param> /// <param name="e">the event data to set</param> private void buttonSave_Click(object sender, EventArgs e) { int index = listBoxSku.SelectedIndex; Invoice invoice = invoiceVM.SaveInvoice(index); invoiceVM.Invoices.ResetItem(index); InvoiceCollection invoices = invoiceVM.Invoices; string outputTotals; outputTotals = string.Format("{0}\r\n{1}\r\n{2}\r\n{3}" , invoices.SubTotal.ToString("N2") , invoices.TotalGST.ToString("N2") , invoices.TotalPST.ToString("N2") , invoices.GrandTotal.ToString("N2")); labelTotals.Text = outputTotals; }
public bool Create(InvoiceCollection identifier) { bool returnRes = false; try { var identifierDocument = identifier.ToBsonDocument(); var identifierCollection = _database.GetCollection <BsonDocument>("InvoiceCollection"); identifierCollection.InsertOne(identifierDocument); returnRes = true; } catch (Exception e) { Console.WriteLine(e); } return(returnRes); }
protected void Page_Load(object sender, EventArgs e) { //StreamReader sr = new StreamReader(Request.InputStream); //StreamWriter sw = new StreamWriter(string.Format("d:\\Request\\{0}.txt", DateTime.Now.ToString("yyyy-MM-ddHH-mm-ss-fff"))); //sw.WriteLine(sr.ReadToEnd()); //sw.Close(); //sr.Close(); StreamHelper streamHelper = new StreamHelper(); List <OrdersOrder> lsOrders = new List <OrdersOrder>(); try { if (Request.InputStream == null || Request.InputStream.Length == 0) { MB.Util.TraceEx.Write("MA没有传送任何信息"); } else { InvoiceCollection lsmaInvoice = streamHelper.DealFor <InvoiceCollection>(Request.InputStream); lsOrders = CollectData.GetERPGdnFromMaPkt(lsmaInvoice); BtsService.BtsMAServerClient client = new BtsService.BtsMAServerClient(); MB.Util.TraceEx.Write("YHX Test1"); client.MA_PKT(lsOrders.ToArray()); } } catch (Exception ex) { MB.Util.TraceEx.Write(ex.Message); } finally { using (StreamWriter sw = new StreamWriter(Response.OutputStream)) { sw.WriteLine("This is My Response"); sw.Flush(); sw.Close(); } } }
public static List <OrdersOrder> GetERPGdnFromMaPkt(InvoiceCollection lspkt) { //BtsService.MA_PKTRequest ma_PKTRequest = new BtsService.MA_PKTRequest(); List <OrdersOrder> lsOrdersOrder = new List <OrdersOrder>(); #region Get list ordersOrder foreach (var one in lspkt.lsInvoice) { string temppkt_ctrl_nbr = ""; OrdersOrderHeader header = new OrdersOrderHeader(); if (one.LsOrderDtl != null && one.LsOrderDtl.Count > 0) { if (string.IsNullOrEmpty(one.LsOrderDtl[0].Distro_Nbr)) { header.Wif_Num = one.OrderHeader.Pkt_Ctrl_Nbr; } else { lsOrdersOrder.AddRange(GetERPGdnFromMaDistro(one)); continue; } } temppkt_ctrl_nbr = one.OrderHeader.Pkt_Ctrl_Nbr; header.Ship_Via = one.OrderHeader.Ship_Via; header.Ship_DateTime = one.OrderHeader.Ship_Date_Time; header.User_ID = one.OrderHeader.User_Id; List <OrdersOrderDetails> lsOrderdtl = new List <OrdersOrderDetails>(); one.LsOrderDtl.Where(a => a.Pkt_Ctrl_Nbr == temppkt_ctrl_nbr).ToList().ForEach(o => { lsOrderdtl.Add(new OrdersOrderDetails() { Prod_ID = o.Season + o.Style + o.Color + o.Sec_Dim + o.Size_Desc, Allow_Qty = o.Pkt_Qty.ToString(), Delivered_Qty = o.Shpd_Qty.ToString(), Cancel_Qty = o.Cancel_Qty.ToString(), Order_Qty = o.Orig_Pkt_Qty.ToString() }); }); List <OrdersOrderBoxHeaders> lsBoxHeader = new List <OrdersOrderBoxHeaders>(); foreach (var a in one.LsBoxHeader) { if (a.Pkt_Ctrl_Nbr == temppkt_ctrl_nbr) { var boxheader = new OrdersOrderBoxHeaders() { Box_Num = a.Carton_Nbr, Box_Size = a.Carton_Size, Box_Type = a.Carton_Type, Box_Vol = a.Carton_Vol.ToString(), Box_WT = a.Actl_Wt.ToString(), Total_Qty = a.Total_Qty.ToString(), Start_Time = a.Create_Date_Time.ToString(), Close_Time = a.Mod_Date_Time.ToString() }; List <OrdersOrderBoxHeadersBoxDetails> lsBoxDtl = new List <OrdersOrderBoxHeadersBoxDetails>(); one.LsBoxDtl.Where(b => b.Pkt_Ctrl_Nbr == temppkt_ctrl_nbr && b.Carton_Nbr == a.Carton_Nbr).ToList().ForEach(c => { lsBoxDtl.Add(new OrdersOrderBoxHeadersBoxDetails() { Prod_ID = c.Season + c.Style + c.Color + c.Sec_Dim + c.Size_Desc, Act_Qty = c.Units_Pakd.ToString() }); }); boxheader.BoxDetails = lsBoxDtl.ToArray(); lsBoxHeader.Add(boxheader); } else { continue; } } lsOrdersOrder.Add(new OrdersOrder() { Header = header, Details = lsOrderdtl.ToArray(), BoxHeaders = lsBoxHeader.ToArray() }); } #endregion //ma_PKTRequest.Orders = lsOrdersOrder.ToArray(); return(lsOrdersOrder); }
public static void Update_InvoiceSummaryContainer_OpenInvoices(InvoiceSummaryContainer invoiceSummaryContainer, InvoiceCollection localCollection, InvoiceCollection masterCollection) { throw new NotImplementedException(); }
public static void Update_InvoiceFiscalExportSummary_ExportedInvoices(InvoiceFiscalExportSummary invoiceFiscalExportSummary, InvoiceCollection localCollection, InvoiceCollection masterCollection) { throw new NotImplementedException(); }
public InvoiceViewModel(InvoiceCollection invoices) { this.Invoices = invoices; }