コード例 #1
0
        private void DeleteSupplier_Load(object sender, EventArgs e)
        {
            Entity.FaridiaIronStoreEntities db = new Entity.FaridiaIronStoreEntities();
            var supplier = db.Suppliers.Include(aa => aa.SupplierBankDetails).Where(a => a.SupplierId == _id && a.StationSupplierId == _supplierStationID).FirstOrDefault();

            CompanyName.Text = supplier.Name;
            Phone.Text       = supplier.Phone;
            Adress.Text      = supplier.Address;
            City.Text        = supplier.City;
            totalPaymentsToBepaid();
            totalPaymentsMade();
            TotalRemainingDue();
            DuePayment.Text = RemainingDueAmount.ToString();
        }
コード例 #2
0
 private void button1_Click_1(object sender, EventArgs e)
 {
     if (MessageBox.Show("Are you sure?", "Confirm", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
     {
         Entity.FaridiaIronStoreEntities db = new Entity.FaridiaIronStoreEntities();
         var totalamounttobepaid            = db.SupplierDuePayments.Where(aa => aa.SupplierId == _id && aa.StationSupplierId == _supplierStationID);
         var totalpaymentsmade = db.SupplierPaymentMades.Where(aa => aa.SupplierId == _id && aa.StationSupplierId == _supplierStationID);
         var accounts          = db.SupplierBankDetails.Where(aa => aa.SupplierId == _id && aa.StationSupplierId == _supplierStationID);
         var supplier          = db.Suppliers.Where(aa => aa.SupplierId == _id && aa.StationSupplierId == _supplierStationID).FirstOrDefault();
         db.SupplierPaymentMades.RemoveRange(totalpaymentsmade);
         db.SaveChanges();
         db.SupplierDuePayments.RemoveRange(totalamounttobepaid);
         db.SaveChanges();
         db.SupplierBankDetails.RemoveRange(accounts);
         db.SaveChanges();
         db.Suppliers.Remove(supplier);
         db.SaveChanges();
         this.Close();
     }
     else
     {
         this.Close();
     }
 }