Пример #1
0
 public Company GetCompany(int idCompany)
 {
     Company com = new Company();
     using (SUPERPEntities sup = new SUPERPEntities(false))
     {
         com = sup.Companies.Where(o => o.id == idCompany).FirstOrDefault();
     }
     return com;
 }
Пример #2
0
        public int CreateCompany(Company compa)
        {
            using (SUPERPEntities sup = new SUPERPEntities(false))
            {
                sup.Companies.Add(compa);
                sup.SaveChanges();

                Company cont = sup.Companies.OrderByDescending(p => p.id).First();
                return (int)cont.id;
            }
        }
Пример #3
0
        public void TestCreateCompany()
        {
            Company comp = new Company();
            comp.name = "testCreate";
            comp.siret = "3333";
            comp.city = "Bordeaux";
            comp.address = "lol";
            comp.postalcode = 33300;

            Assert.IsTrue(clientService.CreateCompany(comp) > 0);
        }
Пример #4
0
        public bool EditCompany(Company company)
        {
            using (SUPERPEntities sup = new SUPERPEntities(false))
            {
                Company contactBdd = sup.Companies.Where(p => p.id == company.id).FirstOrDefault();
                if (contactBdd != null)
                {
                    sup.Entry(contactBdd).CurrentValues.SetValues(company);
                    sup.SaveChanges();
                }

            }
            return true;
        }
Пример #5
0
        public void TestDeleteCompany()
        {
            Company comp = new Company();
            comp.name = "testsupprComp";
            comp.siret = "3333";
            comp.city = "Bordeaux1";
            comp.address = "Saint Louis RPZ";
            comp.postalcode = 33300;
            comp.id = 2;

            int id = clientService.CreateCompany(comp);

            Assert.IsTrue(clientService.DeleteCompany(id));
        }
Пример #6
0
        public void TestGetCompany()
        {
            Company comp = new Company();
            comp.name = "testGet";
            comp.siret = "3333";
            comp.city = "Bordeaux";
            comp.address = "lol";
            comp.postalcode = 33300;

            int newCompanyId = clientService.CreateCompany(comp);
            Assert.IsTrue(newCompanyId > 0);
            Company compget = new Company();
            compget = clientService.GetCompany(newCompanyId);

            Assert.AreEqual("testGet", comp.name);
        }
Пример #7
0
 public bool EditCompany(Company company)
 {
     return clientBLL.EditCompany(company);
 }
Пример #8
0
 public int CreateCompany(Company company)
 {
     return clientBLL.CreateCompany(company);
 }
Пример #9
0
 public bool EditCompany(Company company)
 {
     return companyDAL.EditCompany(company);
 }
Пример #10
0
 public int CreateCompany(Company company)
 {
     return companyDAL.CreateCompany(company);
 }