private void Edit_Button_Click(object sender, EventArgs e) { if (this.Edit_Offer_List.SelectedItems.Count > 0) { ListViewItem m_Item = this.Edit_Offer_List.SelectedItems[0]; int m_ItemID = Convert.ToInt32(m_Item.Tag); OfferNode m_CurrentNode = this.Offer.Nodes.Where(q => q.ItemID == m_ItemID).FirstOrDefault(); Node_Set_Amount_Gumpling m_Gumpling = new Node_Set_Amount_Gumpling(); m_Gumpling.Node = m_CurrentNode; m_Gumpling.NodeAmountChanged += Gumpling_NodeAmountChanged; m_Gumpling.ShowDialog(); } }
private void Delete_Button_Click(object sender, EventArgs e) { if (this.Edit_Offer_List.SelectedItems.Count > 0) { if (MessageBox.Show("Seçtiğiniz teklif nesnesi silinecek, onaylıyor musunuz?", "Uyarı", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { ListViewItem m_Item = this.Edit_Offer_List.SelectedItems[0]; int m_ItemID = Convert.ToInt32(m_Item.Tag); OfferNode m_Node = this.Offer.Nodes.Where(q => q.ItemID == m_ItemID).FirstOrDefault(); if (m_Node != null) { this.Offer.Nodes.Remove(m_Node); } this.PopulateListView(); } } }
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) { OfferNode m_Node = new OfferNode(); m_Node.Item = m_Item; m_Node.ItemID = m_Item.ID; m_Node.OfferID = this.Offer.ID; m_Node.Offer = this.Offer; m_Node.Amount = 1.00M; m_Node.BasePrice = m_Node.Item.FinalPrice.Value; m_Node.FinalPrice = m_Node.BasePrice * m_Node.Amount; if (this.Offer.Nodes.Any(q => q.ItemID == m_Node.ItemID)) { this.Offer.Nodes.Where(q => q.ItemID == m_Node.ItemID).FirstOrDefault().Amount += 1.00M; } else { this.Offer.Nodes.Add(m_Node); } } else { MessageBox.Show("Okuttuğunuz bu barkoda ait bir ürün bulunamadı.", "Hata", MessageBoxButtons.OK); } } PopulateListView(); } }
private void Node_Set_Amount_Gumpling_Load(object sender, EventArgs e) { if (this.Node == null) { this.Close(); } if (this.Node is InvoiceNode) { InvoiceNode m_Temp = this.Node as InvoiceNode; if (m_Temp.Item != null) { this.Name_Label.Text = m_Temp.Item.Product.Name; } else { this.Name_Label.Text = m_Temp.Description; } this.Amount_Num.Value = m_Temp.Amount.Value; this.UnitPrice_Num.Value = m_Temp.BasePrice.Value; } else if (this.Node is StockMovementNode) { StockMovementNode m_Temp = this.Node as StockMovementNode; this.Name_Label.Text = m_Temp.Item.Product.Name; this.Amount_Num.Value = m_Temp.Amount; this.UnitPrice_Num.Value = m_Temp.BasePrice.Value; } else if (this.Node is OfferNode) { OfferNode m_Temp = this.Node as OfferNode; this.Name_Label.Text = m_Temp.Item.Product.Name; this.Amount_Num.Value = m_Temp.Amount; this.UnitPrice_Num.Value = m_Temp.BasePrice; this.Description_Box.Text = m_Temp.Description; this.Description_Label.Visible = true; this.Description_Box.Visible = true; } if (this.Node.Item != null) { this.Amount_Num.DecimalPlaces = this.Node.Item.UnitType.DecimalPlaces; if (this.Amount_Num.DecimalPlaces == 0) { this.Amount_Num.Minimum = 1m; } else if (this.Amount_Num.DecimalPlaces == 2) { this.Amount_Num.Minimum = 0.01m; } else if (this.Amount_Num.DecimalPlaces == 4) { this.Amount_Num.Minimum = 0.0001m; } this.UnitPrice_Num.Minimum = 0.01m; } this.Amount_Num.Focus(); this.Amount_Num.Select(0, this.Amount_Num.Value.ToString().Length); }