private void txtBarcodeSearch_TextChanged(object sender, EventArgs e) { if (txtBarcodeSearch.Text == "" || txtBarcodeSearch.TextLength < 8) { } else { var search = (from q in data.Product where q.ProductBarcode == txtBarcodeSearch.Text && q.ProductDelete == true select q).ToList(); if (search.Count == 0) { button10.BackColor = Color.FromArgb(255, 0, 0); MessageDöndür.Message("Ürün Bulunamadı!\nBu ürün ya kayıtlı değil yada silinmiş.\nEğer elinizde böyle bir ürün bulunuyorsa önce bunu sisteme eklemelisiniz.\n", "Hata", MessageDöndür.MessageIcon.Eror, MessageDöndür.MessageButton.OK); } else { foreach (var item in search) { if (0 >= item.ProductPiece || item.ProductPiece == null) { MessageDöndür.MessageResult result = MessageDöndür.Message(item.ProductBarcode + " Barkodlu " + item.ProductName + " Adli Ürün Ürün Stokta Olmadığı için Stoktatan Çıkış Yapılamıyor.Ürün Sayısı :" + item.ProductPiece + "\n" + "Elinizde Bu Ürün Varsa ve işlemin Devam Etmesinide İstiyorsanız Onay Verin.\n" + "Stokta bu ürün 0 ın Altına Düşecek.\nBu İşlemi Onaylıyormusunuz?", "Depoda Ürün Yok İşlem Bekleniyor", MessageDöndür.MessageIcon.Information, MessageDöndür.MessageButton.YesNo); if (MessageDöndür.MessageResult.Yes == result) { } else if (MessageDöndür.MessageResult.No == result) { continue; } } button10.BackColor = Color.FromArgb(153, 255, 51); dataGridView1.Rows.Add(datagridviewID, item.ProductID, item.ProductBarcode, item.ProductName, item.SubTboCategories.CategoryName, item.ProductSize, item.ProductSalePrice + " TL", 0, item.ProductDescription); dataGridView1.Columns["ProductID"].Visible = false; lblPrice.Text = "Ürün Fiyat : " + item.ProductSalePrice + " TL"; lblName.Text = "Ürün Adı : " + item.ProductName; totalPrice = totalPrice + (decimal)item.ProductSalePrice; lblTotal.Text = "Toplam Fiyat : " + totalPrice + " TL"; txtBarcodeSearch.Clear(); datagridviewID++; txtBarcodeSearch.Clear(); } } } }
private void btnTotaliskonto_Click(object sender, EventArgs e) { if (dataGridView1.RowCount == 0 || dataGridView1.RowCount == null) { MessageDöndür.Message("İndirim Yapabilmek için Önce Birkaç Veriye Sahip Olmalısınız.\n" + "Listede Veri Yok", "Datagridviewde Veri Tespit Edilemedi" , MessageDöndür.MessageIcon.Eror, MessageDöndür.MessageButton.OK); } else { if (totaleindirimyapildimi == false) { totalDiscount = Discount.Show(); if (totalDiscount > totalPrice) { MessageDöndür.Message("Eğer Bu İndirimi Yaparsanız Sizin Müşteriye Para Ödemeniz Lazım.\nNe Yaptığınızın Farkındamısınız Siz ?\nYaptığınız İndirim Toplam Tutarı Aşıyor !\nİşlem İptal Edildi", "Girdiler Yanlış Hata Oluştu", MessageDöndür.MessageIcon.Eror, MessageDöndür.MessageButton.OK); } else { totalPrice = totalPrice - totalDiscount; lblTotal.Text = "Toplam Fiyat : " + totalPrice + " TL"; totaleindirimyapildimi = true; } } else { MessageDöndür.MessageResult result = MessageDöndür.Message("Zaten Toplam Tutara Bir İndirim Yapıldı.\nTekrar Bir İndirim Yapacaksanız Toplam Tutar İlk Haline Çevirilecektir !\nYeniden İndirim Yapmak İstiyormusunuz ?", "İndirim Tekrar Yeniden Yapılsın mı ?", MessageDöndür.MessageIcon.Information, MessageDöndür.MessageButton.YesNo); if (result == MessageDöndür.MessageResult.Yes) { totalPrice = totalPrice + totalDiscount; lblTotal.Text = "Toplam Fiyat : " + totalPrice + " TL"; totaleindirimyapildimi = false; MessageDöndür.Message("Toplam Tutar İlk Hale Geri Getirildi ! \nYeniden İndirim Yapabilirsiniz.", "Yeniden Düzenlendi", MessageDöndür.MessageIcon.OK, MessageDöndür.MessageButton.OK); } else if (result == MessageDöndür.MessageResult.No) { MessageDöndür.Message("Yeniden İndirim Yapılması Kullanıcı Tarafından Reddedildi.", "Yeniden İndirim Yapılmadı", MessageDöndür.MessageIcon.Information, MessageDöndür.MessageButton.OK); } txtBarcodeSearch.Focus(); } } }
private void registeredCustomer_Click(object sender, EventArgs e) { if (!(dataGridView1.Rows.Count <= 0)) { int customerID = SelectCustomer.Show(); if (!(customerID == -1)) { var query = (from q in data.Customer where q.CustomerID == customerID select q).First(); MessageDöndür.MessageResult messageResult = MessageDöndür.Message("Müsteri :" + query.CustomerName + " " + query.CustomerSurname + "\nAdlı Müşteriye " + totalPrice + " TL Tutarında işlem Yapmayı Onaylıyormusunuz", "Satış Onayı", MessageDöndür.MessageIcon.Information, MessageDöndür.MessageButton.YesNoCancel); if (MessageDöndür.MessageResult.Yes == messageResult) { Model.Sale satis = new Model.Sale(); satis.SaleDate = DateTime.Now.Date; satis.PaymentMethodSale = 3; satis.TotalPrice = totalPrice; satis.CustomerID = query.CustomerID; satis.TotalDiscount = Convert.ToDecimal(totalDiscount); data.Sale.InsertOnSubmit(satis); data.SubmitChanges(); foreach (DataGridViewRow row in dataGridView1.Rows) {//TODO:Ürün Stokta Varmı Yokmu Kontrol Edilecek++ Model.BarcodeSystemDataContext pdata = new Model.BarcodeSystemDataContext(); Model.OpeationProduct satilanurunler = new Model.OpeationProduct(); satilanurunler.SaleProduct = (from q in data.Sale orderby q.SaleID descending select q).First().SaleID; satilanurunler.ProductID = (int)(row.Cells["ProductID"].Value); satilanurunler.ProductDiscount = Convert.ToDecimal(row.Cells["ProductDiscount"].Value); satilanurunler.ProductPrice = Convert.ToDecimal((row.Cells["ProductSalePrice"].Value.ToString().Split(' ')[0])); pdata.OpeationProduct.InsertOnSubmit(satilanurunler); pdata.SubmitChanges(); } Model.CustomerProcces satisislemi = new Model.CustomerProcces(); satisislemi.CustomerID = query.CustomerID; satisislemi.ProccesDate = DateTime.Now; satisislemi.ProccesType = 1; satisislemi.ProccesPrice = totalPrice; query.CustomerAccount += totalPrice; data.CustomerProcces.InsertOnSubmit(satisislemi); data.SubmitChanges(); totalDiscount = 0; totalPrice = 0; productDiscount = 0; lblName.Text = "Ürün Adı : null"; lblPrice.Text = "Ürün Fiyat : null"; lblTotal.Text = "Toplam Fiyat : null"; datagridviewID = 1; dataGridView1.Rows.Clear(); MessageDöndür.Message("Satış İşlemi başarıyla Gerçekleştirildi.", "İşlem Onaylandı", MessageDöndür.MessageIcon.OK, MessageDöndür.MessageButton.OK); } } else { MessageDöndür.Message("Müşteri Seçimi Başarısız Oldu !", "Müşteri Seçim Başarısız .", MessageDöndür.MessageIcon.Eror, MessageDöndür.MessageButton.OK); } } else { MessageDöndür.Message("Ürün Listesi Boş Olduğu İçin Çıkış yapılamıyor", "DataGridView Boş", MessageDöndür.MessageIcon.Eror, MessageDöndür.MessageButton.OK); } }
private void btnDelete_Click(object sender, EventArgs e) { if (selectedproductID == 0) { MessageDöndür.Message("Ürün Seçilmedi Yandaki Tablodan Ürün Seçiniz", "Seçilen Ürün Numarası Bulunamadı...", MessageDöndür.MessageIcon.Eror, MessageDöndür.MessageButton.OK); } else { var DeleteProduct = (from q in data.Product where q.ProductID == selectedproductID select q).First(); var StockFind = (from q in data.Stock where q.ProductID == DeleteProduct.ProductID select q).ToList(); if (StockFind.Count == 0) { result = MessageDöndür.Message("Barkod :" + DeleteProduct.ProductBarcode + "\nÜrün Adı :" + DeleteProduct.ProductName + "\nÜrünü Silmek İstiyormusunuz ?", "Silme İşlemi Onay " , MessageDöndür.MessageIcon.Trash , MessageDöndür.MessageButton.YesNo); if (result == MessageDöndür.MessageResult.Yes) { DeleteProduct.ProductDelete = false; data.SubmitChanges(); MessageDöndür.Message("Barkod :" + DeleteProduct.ProductBarcode + "\nÜrün Adi :" + DeleteProduct.ProductName + "\nÜrün Silindi..", "Silme İşlemi Başarılı", MessageDöndür.MessageIcon.OK, MessageDöndür.MessageButton.OK); } else { MessageDöndür.Message("Silme İşlemi Durduruldu", "Silme İşlemi İptal Edildi", MessageDöndür.MessageIcon.Eror, MessageDöndür.MessageButton.OK); } } else if (StockFind.Count > 0) { result = MessageDöndür.Message("Barkod :" + DeleteProduct.ProductBarcode + "\nÜrün Adı :" + DeleteProduct.ProductName + "\nBu Ürünün Stokta Kaydı Bulundu.." + "\n Stoktaki Kayıtlarla Beraber Silinmesini Onaylıyormusunuz ?", "Silme İşlemi Onay " , MessageDöndür.MessageIcon.Trash , MessageDöndür.MessageButton.YesNo); if (result == MessageDöndür.MessageResult.Yes) {//Silme İşlemi Onaylandı DeleteProduct.ProductDelete = false; data.SubmitChanges(); MessageDöndür.Message("Barkod :" + DeleteProduct.ProductBarcode + "\nÜrün Adi :" + DeleteProduct.ProductName + "\nÜrün Silindi..", "Silme İşlemi Başarılı", MessageDöndür.MessageIcon.OK, MessageDöndür.MessageButton.OK); } else { MessageDöndür.Message("Silme İşlemi Durduruldu", "Silme İşlemi İptal Edildi", MessageDöndür.MessageIcon.Eror, MessageDöndür.MessageButton.OK); } } } dataProductLoad(); }