Exemple #1
0
 /// Remove
 public SuppliersClass(int id)
 {
     try
     {
         Deliver r = db.Deliver.Find(id);
         db.Deliver.Remove(r);
         db.SaveChanges();
         AddData.Remove();
     }
     catch (Exception ex)
     {
         AddData.ExceptionError(ex);
     }
 }
Exemple #2
0
        ///UpDate Olib keluvchi Items
        public SuppliersClass(int UpDateItem, string a)
        {
            var query = (from i in db.Deliver
                         where i.ID == UpDateItem
                         select i).ToList();

            foreach (var item in query)
            {
                add.txtFullname.Text      = item.Full_name;
                add.txtPhoneNumber.Text   = item.Company_Phone;
                add.txtCompanyname.Text   = item.Company_name;
                add.txtContractname.Text  = item.Contract_name;
                add.txtContractTitle.Text = item.Contract_Title;
                add.txtAddress.Text       = item.Address;
                add.combCountry.Text      = item.Country;
                add.combCity.Text         = item.City;
            }

            DialogResult result = add.ShowDialog();

            if (result == DialogResult.OK)
            {
                sup = db.Deliver.Find(UpDateItem);
                sup.Company_name    = add.txtCompanyname.Text;
                sup.Contract_name   = add.txtContractname.Text;
                sup.Contract_Title  = add.txtContractTitle.Text;
                sup.City            = add.combCity.Text;
                sup.Country         = add.combCountry.Text;
                sup.Address         = add.txtAddress.Text;
                sup.Full_name       = add.txtFullname.Text;
                sup.Company_Phone   = add.txtPhoneNumber.Text;
                db.Entry(sup).State = System.Data.Entity.EntityState.Modified;
                db.SaveChanges();
                AddData.DataChange();
            }
            else
            {
                AddData.notDataChange();
            }
        }