Пример #1
0
        private void Edit_Button_Click(object sender, EventArgs e)
        {
            if (this.Items_List.SelectedItems.Count > 0)
            {
                MuhasebeEntities m_Context = new MuhasebeEntities();
                ListViewItem     m_Select  = this.Items_List.SelectedItems[0];
                int m_ItemID = Convert.ToInt32(m_Select.Tag);

                if (m_ItemID > 0)
                {
                    Item m_Item = m_Context.Items.Where(q => q.ID == m_ItemID).FirstOrDefault();

                    if (m_Item != null)
                    {
                        Edit_Item_Pop m_Pop = new Edit_Item_Pop();
                        m_Pop.Item        = m_Item;
                        m_Pop.ItemEdited += Pop_ItemEdited;
                        m_Pop.ShowDialog();
                    }
                    else
                    {
                        MessageBox.Show("Düzenleme sırasında bir hata oluştu.", "Hata", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                }
                else
                {
                    MessageBox.Show("Düzenleme sırasında bir hata oluştu", "Hata", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
        }
Пример #2
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;
                    }
                    }
                }
            }
        }