示例#1
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);
                    }
                }
            }
        }
示例#2
0
        private void Add_Button_Click(object sender, EventArgs e)
        {
            Add_Item_Pop m_Pop = new Add_Item_Pop();

            m_Pop.ItemAdded += Pop_ItemAdded;
            m_Pop.ShowDialog();
        }
示例#3
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();
            }
        }
示例#4
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;
                    }
                    }
                }
            }
        }