示例#1
0
 private void btn_send_to_database_Click(object sender, EventArgs e)
 {
     if (id != 0)
     {
         CompanyController.UpdateCompany(id, tbox_name.Text, tbox_address.Text, tbox_city.Text, tbox_zip_code.Text);
         MessageBox.Show("L'entreprise a été correctement mise à jour dans la base de données", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
     else
     {
         CompanyController.AddCompany(tbox_name.Text, tbox_address.Text, tbox_city.Text, tbox_zip_code.Text);
         MessageBox.Show("L'entreprise a été correctement ajoutée à la base de données", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
     uc_MainCompany.Instance.ReloadPanel();
     this.SendToBack();
 }
示例#2
0
        public async void Create_Company_Test()
        {
            Company comp1 = new Company();

            comp1.CompanyName    = "Test Company";
            comp1.AddressLine1   = "AddressLine 1";
            comp1.AddressLine2   = "AddressLine 2";
            comp1.AddressLine3   = "AddressLine 3";
            comp1.ZipCode        = "600001";
            comp1.ContactEmailId = "*****@*****.**";


            OkObjectResult createCompanyResult = await _companyController.AddCompany(comp1) as OkObjectResult;

            Assert.IsNotNull(createCompanyResult);
            Assert.IsTrue(createCompanyResult.StatusCode == (int)HttpStatusCode.OK);
            Assert.IsTrue(createCompanyResult.Value.ToString() == "TE0001");
        }