Example #1
0
        private void EventSink_BarcodeScanned(object sender, BarcodeScannedEventArgs args)
        {
            if (args.Barcode != null)
            {
                using (MuhasebeEntities m_Context = new MuhasebeEntities())
                {
                    var m_Item = m_Context.Items.Where(q => q.Product.Barcode == args.Barcode).FirstOrDefault();

                    if (m_Item != null)
                    {
                        OrderNode m_Node = new OrderNode();
                        m_Node.ItemID  = m_Item.ID;
                        m_Node.OrderID = this.Order.ID;
                        m_Node.Order   = this.Order;
                        m_Node.Amount  = 1.00M;

                        if (this.Order.Nodes.Any(q => q.ItemID == m_Node.ItemID))
                        {
                            this.Order.Nodes.Where(q => q.ItemID == m_Node.ItemID).FirstOrDefault().Amount += 1.00M;
                        }
                        else
                        {
                            this.Order.Nodes.Add(m_Node);
                        }
                    }
                    else
                    {
                        MessageBox.Show("Okuttuğunuz bu barkoda ait bir ürün bulunamadı.", "Hata", MessageBoxButtons.OK);
                    }
                }

                PopulateListView();
            }
        }
Example #2
0
        private void EventSink_BarcodeScanned(object sender, BarcodeScannedEventArgs args)
        {
            if (args.Barcode != string.Empty)
            {
                using (MuhasebeEntities m_Context = new MuhasebeEntities())
                {
                    string m_Barcode = args.Barcode;

                    var m_Item = m_Context.Items.Where(q => q.Inventory.OwnerID == Program.User.WorksAtID && q.Product.Barcode == m_Barcode).FirstOrDefault();

                    if (m_Item == null)
                    {
                        this.Invoke((MethodInvoker) delegate()
                        {
                            Add_Item_Pop m_Pop = new Add_Item_Pop(m_Barcode);
                            m_Pop.ShowDialog();
                        });
                    }
                    else
                    {
                        InvoiceNode m_Node = new InvoiceNode(m_Item);
                        m_Node.Amount     = 1;
                        m_Node.FinalPrice = m_Node.BasePrice * m_Node.Amount;
                        this.Append(m_Node);
                    }
                }
            }
        }
Example #3
0
        private static void RawListener_KeyPressed(object sender, RawInputEventArg e)
        {
            if (e.KeyPressEvent.KeyPressState == "MAKE")
            {
                if (e.KeyPressEvent.DeviceName.Contains("1D57"))
                {
                    Application.AddMessageFilter(Filter);
                }
            }
            else if (e.KeyPressEvent.KeyPressState == "BREAK")
            {
                Application.RemoveMessageFilter(Filter);

                if (e.KeyPressEvent.DeviceName.Contains("1D57"))
                {
                    if (e.KeyPressEvent.VKey != (int)Keys.Enter && e.KeyPressEvent.VKey != 16) // 16 = Data Link Escape
                    {
                        Buffer += string.Format("{0}", GetKeyNumericValue(e.KeyPressEvent.VKey));
                    }

                    if (e.KeyPressEvent.VKey == (int)Keys.Enter)
                    {
                        Debug.WriteLine(Buffer);
                        BarcodeScannedEventArgs m_Args = new BarcodeScannedEventArgs();
                        m_Args.Barcode   = Buffer;
                        m_Args.ScannedAt = DateTime.Now;
                        EventSink.InvokeBarcodeScanned(e.KeyPressEvent.DeviceName, m_Args);
                        Buffer = "";
                    }
                }
            }
        }
Example #4
0
        private void SerialBarcodeScanner_DataReceived(string data)
        {
            BarcodeScannedEventArgs m_Args = new BarcodeScannedEventArgs();

            m_Args.Barcode   = data.Split('\r')[0];
            m_Args.ScannedAt = DateTime.Now;

            EventSink.InvokeBarcodeScanned(this, m_Args);
        }
        private void WhenScannerDataReceived(object sender, BarcodeScannerDataReceivedEventArgs args)
        {
            var data = args.Report.ScanDataLabel;

            using (var reader = DataReader.FromBuffer(data))
            {
                var text = reader.ReadString(data.Length);
                var bsea = new BarcodeScannedEventArgs(text);
                this.BarcodeScanned?.Invoke(this, bsea);
            }
        }
Example #6
0
        private void EventSink_BarcodeScanned(object sender, BarcodeScannedEventArgs args)
        {
            if (args.Barcode != null)
            {
                using (MuhasebeEntities m_Context = new MuhasebeEntities())
                {
                    Item m_Item = m_Context.Items.Where(q => q.Product.Barcode == args.Barcode).FirstOrDefault();

                    if (m_Item != null)
                    {
                        this.Product_Barcode_Box.Text = m_Item.Product.Barcode;
                    }
                }
            }
        }
Example #7
0
        public void EditCart(object s, BarcodeScannedEventArgs bse)
        {
            string[] codeStr = bse.BarcodeStr.Split(' ');

            if (int.TryParse(codeStr[0], out int itemCode))
            {
                if (bse.AddToCart)
                {
                    AddToCart(itemCode, GetAmount(codeStr));
                }
                else
                {
                    RemoveFromCart(itemCode, GetAmount(codeStr));
                }
            }
            else
            {
                Console.WriteLine("Inproper barcode format; please try again");
            }
        }
Example #8
0
        private void EventSink_BarcodeScanned(object sender, BarcodeScannedEventArgs args)
        {
            if (args.Barcode != null)
            {
                using (MuhasebeEntities m_Context = new MuhasebeEntities())
                {
                    var m_Item = m_Context.Items.Where(q => q.Product.Barcode == args.Barcode).FirstOrDefault();

                    if (m_Item != null)
                    {
                        StockMovementNode m_Node = new StockMovementNode();
                        m_Node.ItemID          = m_Item.ID;
                        m_Node.StockMovementID = this.StockMovement.ID;
                        m_Node.Amount          = 1.00M;
                        m_Node.BasePrice       = m_Item.BasePrice;

                        if (this.StockMovement.Nodes.Any(q => q.ItemID == m_Node.ItemID))
                        {
                            this.StockMovement.Nodes.Where(q => q.ItemID == m_Node.ItemID).FirstOrDefault().Amount += 1.00M;
                        }
                        else
                        {
                            this.StockMovement.Nodes.Add(m_Node);
                        }

                        this.Buy_Items_List.Focus();
                    }
                    else
                    {
                        Add_Item_Pop m_Pop = new Add_Item_Pop(args.Barcode);
                        m_Pop.ShowDialog();
                    }
                }

                PopulateListView();
            }
        }
Example #9
0
        private void EventSink_BarcodeScanned(object sender, BarcodeScannedEventArgs args)
        {
            string m_Barcode = args.Barcode;

            this.Output_Box.Text = string.Format("Son okutulan barkod: {0}", args.Barcode) + Environment.NewLine + this.Output_Box.Text.Replace("Son okutulan barkod:", "Barkod:");
        }
Example #10
0
        private void EventSink_BarcodeScanned(object sender, BarcodeScannedEventArgs args)
        {
            if (args.Barcode != string.Empty)
            {
                if (this.Visible && !this.CanFocus)
                {
                    // modal child windows are open

                    return;
                }

                using (MuhasebeEntities m_Context = new MuhasebeEntities())
                {
                    string m_Barcode = args.Barcode;

                    var    m_Item = m_Context.Items.Where(q => q.Inventory.OwnerID == Program.User.WorksAtID && q.Product.Barcode == m_Barcode).FirstOrDefault();
                    string m_Mode = this.BarcodeScannerMode_Combo.SelectedItem.ToString();

                    switch (m_Mode)
                    {
                    case "Satış":
                    {
                        if (m_Item == null)
                        {
                            this.Invoke((MethodInvoker) delegate()
                                {
                                    Add_Item_Pop m_Pop = new Add_Item_Pop(m_Barcode);
                                    m_Pop.ShowDialog();
                                });
                        }
                        else
                        {
                            if (!this.MdiChildren.Any(q => q is Manage_Sales_Mdi))
                            {
                                this.BeginInvoke((MethodInvoker)(delegate()
                                    {
                                        Manage_Sales_Mdi m_Mdi = new Manage_Sales_Mdi();
                                        m_Mdi.MdiParent = this;
                                        m_Mdi.WindowState = FormWindowState.Maximized;
                                        m_Mdi.Show();

                                        m_Mdi.Shown += (s, a) =>
                                        {
                                            InvoiceNode m_Node = new InvoiceNode(m_Item);
                                            m_Node.Amount = 1;
                                            m_Node.FinalPrice = m_Node.BasePrice * m_Node.Amount;
                                            m_Mdi.Append(m_Node);
                                        };
                                    }));
                            }
                            else
                            {
                                Form m_Existing = this.MdiChildren.Where(q => q is Manage_Sales_Mdi).FirstOrDefault();

                                if (m_Existing != null)
                                {
                                    Manage_Sales_Mdi m_Mdi = m_Existing as Manage_Sales_Mdi;
                                    m_Mdi.BeginInvoke((MethodInvoker) delegate()
                                        {
                                            InvoiceNode m_Node = new InvoiceNode(m_Item);
                                            m_Node.Amount      = 1;
                                            m_Node.FinalPrice  = m_Node.BasePrice * m_Node.Amount;
                                            m_Mdi.Append(m_Node);
                                        });
                                }
                            }
                        }

                        break;
                    }

                    case "Ürün Düzenleme":
                    {
                        if (m_Item == null)
                        {
                            this.Invoke((MethodInvoker) delegate()
                                {
                                    Add_Item_Pop m_Pop = new Add_Item_Pop(m_Barcode);
                                    m_Pop.ShowDialog();
                                });
                        }
                        else
                        {
                            this.Invoke((MethodInvoker) delegate()
                                {
                                    Edit_Item_Pop m_Pop = new Edit_Item_Pop();
                                    m_Pop.Item          = m_Item;

                                    m_Pop.ShowDialog();
                                });
                        }

                        break;
                    }
                    }
                }
            }
        }
Example #11
0
 private void ScannerBarcodeScanned(object sender, BarcodeScannedEventArgs e)
 {
 }
Example #12
0
        private void EventSink_BarcodeScanned(object sender, BarcodeScannedEventArgs args)
        {
            string m_Barcode = args.Barcode;

            this.Barcode_Box.Text = m_Barcode;
        }
 private void OnBarCodeScanned(object sender, BarcodeScannedEventArgs e)
 {
     MessageBox.Show($"Barcode scanned: {Encoding.ASCII.GetString(e.BarcodeData)}");
 }