/// <summary> /// If the user clicks the save changes button /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnSaveChanges_Click(object sender, EventArgs e) { string id = textId.Text; LegalForms legalForm = (LegalForms)comboBoxLegalForm.SelectedItem; Countries country = (Countries)comboBoxCountry.SelectedItem; string city = textBoxCity.Text; string zipCode = textBoxZipCode.Text; string street = textBoxStreet.Text; Category category = (Category)comboBox3.SelectedItem; var type = comboBox4.SelectedItem; string text = textBox6.Text; TypeAll typeAll = (TypeAll)comboBox4.SelectedItem; bool isModifyingEstate = true; estateHandler.createEstate(id, legalForm, country, city, zipCode, street, category, type, text, image, typeAll, isModifyingEstate); btnSaveChanges.Enabled = false; btnChangeEstate.Enabled = true; btnCreateEstate.Enabled = true; textId.ReadOnly = false; btnDeleteAll.Enabled = true; btnGenerateEstates.Enabled = true; btnSearch.Enabled = true; btnShowAll.Enabled = true; btnDelete.Enabled = true; btnSaveChanges.BackColor = Color.FromArgb(168, 165, 209); btnChangeEstate.BackColor = Color.FromArgb(140, 135, 222); btnCreateEstate.BackColor = Color.FromArgb(140, 135, 222); }
public Estate ChangeEstate(string id, LegalForms legalForm, Countries country, string city, string zipCode, string street, Category category, object type, string text, Bitmap image, TypeAll typeAll) { if (!ids.Contains(id)) { MessageBox.Show($"There is no Estate that has the id {id}"); return(null); } foreach (Estate e in estates) { if (e.Id == id) { comboBoxLegalForm.SelectedItem = e.LegalForm; comboBoxCountry.SelectedItem = e.Address.Country; comboBocCategory.SelectedItem = e.Category; comboBoxType.SelectedItem = e.TypeAll; textId.Text = e.Id; textcity.Text = e.Address.City; textzip.Text = e.Address.ZIPCode; textStreet.Text = e.Address.Street; textUnique.Text = "kkkk"; } } return(null); }
private void createEstate() { // Gets all the value from the GUI to create an Estate object LegalForms legalForm = (LegalForms)comboBoxLegalForm.SelectedItem; Countries country = (Countries)comboBoxCountry.SelectedItem; string city = textBoxCity.Text; string zipCode = textBoxZipCode.Text; string street = textBoxStreet.Text; Category category = (Category)comboBoxCategory.SelectedItem; var type = comboBoxType.SelectedItem; string text = textBox6.Text; TypeAll typeAll = (TypeAll)comboBoxType.SelectedItem; string id = textId.Text; // Id must be unique and in a valid format and all the fields int the GUI must be filled´, else do not create an Estate if (!isIdValid(id) || !uniqueId(id) || !estateManager.allFieldsFilled(city, zipCode, street, text)) { return; } // Creates an address from the given address data Address address = new Address(street, zipCode, city, country); Estate estate = null; // Creates an estate in the correct type, depending on what type the user has chosen switch (type) { case TypeCom.Shop: estate = new Shop(id, text, legalForm, image, address, category, typeAll); break; case TypeCom.Warehouse: estate = new Warehouse(id, text, legalForm, image, address, category, typeAll); break; case TypeRes.Apartment: estate = new Apartment(id, text, legalForm, image, address, category, typeAll); break; case TypeRes.House: estate = new House(id, text, legalForm, image, address, category, typeAll); break; case TypeRes.Townhouse: estate = new Townhouse(id, text, legalForm, image, address, category, typeAll); break; case TypeRes.Villa: estate = new Villa(id, text, legalForm, image, address, category, typeAll); break; default: break; } estateManager.Add(indexToChange, estate); dictionaryHandler.Add(estate); }
protected Estate(int id, Categories category, string type, LegalForms legalForm, Address address, Image image, string imagename) { ID = id; Category = category; Type = type; LegalForm = legalForm; Address = address; Image = image; ImageFilename = imagename; }
/// <summary> /// /// </summary> /// <param name="address"></param> /// <param name="id"></param> /// <param name="floorNumber"></param> /// <param name="squareMeters"></param> /// <param name="lf"></param> /// <param name="image"></param> /// <param name="street"></param> /// <param name="city"></param> /// <param name="c"></param> /// <param name="ZipCode"></param> public Apartment(string id, string floorNumber, LegalForms lf, Bitmap image, Address address, Category cat, TypeAll type) { this.Id = id; this.Address = address; // The unique attribute for this class this.floorNumber = floorNumber; this.LegalForm = lf; this.Image = image; this.Category = cat; this.TypeAll = type; }
public tabCreateChange() { InitializeComponent(); estateHandler = new EstateHandler(); comboBoxCountry.DataSource = Countries.GetValues(typeof(Countries)); comboBoxLegalForm.DataSource = LegalForms.GetValues(typeof(LegalForms)); comboBox3.DataSource = Category.GetValues(typeof(Category)); comboBoxLegalForm.DataSource = LegalForms.GetValues(typeof(LegalForms)); comboBox5.DataSource = TypeAll.GetValues(typeof(TypeAll)); lblDynamicTxt1.Text = "---------"; }
/// <summary> /// /// </summary> /// <param name="address"></param> /// <param name="id"></param> /// <param name="lawnSize"></param> /// <param name="squareMeters"></param> /// <param name="lf"></param> /// <param name="image"></param> /// <param name="street"></param> /// <param name="city"></param> /// <param name="c"></param> /// <param name="ZipCode"></param> public Villa(string id, string lawnSize, LegalForms lf, Bitmap image, Address address, Category cat, TypeAll type) { this.Address = address; this.Id = id; // The unique attribute for this class this.lawnSize = lawnSize; this.LegalForm = lf; this.Image = image; this.Category = cat; this.TypeAll = type; }
public Warehouse(string id, string cubicMeterCapacity, LegalForms lf, Bitmap image, Address address, Category cat, TypeAll type) { this.Address = address; this.Id = id; // The unique attribute for this class this.cubicMeterCapacity = cubicMeterCapacity; this.LegalForm = lf; this.Image = image; this.Category = cat; this.TypeAll = type; }
public House(string id, string color, LegalForms lf, Bitmap image, Address address, Category cat, TypeAll type) { this.Address = address; this.Id = id; // The unique attribute for this class this.color = color; this.LegalForm = lf; this.Image = image; this.Category = cat; this.TypeAll = type; }
public Shop(string id, string typeOfShop, LegalForms lf, Bitmap image, Address address, Category cat, TypeAll type) { this.Address = address; this.Id = id; // The unique attribute for this class this.typeOfShop = typeOfShop; this.LegalForm = lf; this.Image = image; this.Category = cat; this.TypeAll = type; }
public Townhouse(string id, string height, LegalForms lf, Bitmap image, Address address, Category cat, TypeAll typeAll) { this.Address = address; this.Id = id; this.TypeAll = typeAll; this.typeRes = TypeRes.Townhouse; // The unique attribute for this class this.height = height; UniqueAttribute = height; this.LegalForm = lf; this.Image = image; this.Category = cat; }
private void btnCreateEstate_Click(object sender, EventArgs e) { string id = textId.Text; LegalForms legalForm = (LegalForms)comboBoxLegalForm.SelectedItem; Countries country = (Countries)comboBoxCountry.SelectedItem; string city = textBoxCity.Text; string zipCode = textBoxZipCode.Text; string street = textBoxStreet.Text; Category category = (Category)comboBox3.SelectedItem; var type = comboBox4.SelectedItem; string text = textBox6.Text; TypeAll typeAll = (TypeAll)comboBox4.SelectedItem; estateHandler.createEstate(id, legalForm, country, city, zipCode, street, category, type, text, image, richTextBoxEstates, typeAll); }
public void SaveFile(string id, LegalForms legalForm, Countries country, string city, string zipCode, string street, Category category, object type, string text, TypeAll typeAll) { String msg = "Id:" + id + "Legalform:" + legalForm + "Country:" + country + "City:" + city + "zipcode:" + zipCode + "Street:" + street + " Category:" + category + "Ttype:" + type + "Text:" + text + "Type:" + typeAll; String txt = "\file.txt"; // using (StringReader reader = new StringReader(msg.ToString()) // { // string readText = await reader.ReadToEndAsync // } // FileStream fileStream = new FileStream(txt, FileMode.Create, FileAccess.Write); // StreamWriter streamWriter = new StreamWriter(fileStream); // streamWriter.BaseStream.Seek(0, SeekOrigin.End); // streamWriter.Write(msg); // streamWriter.Flush(); // streamWriter.Close(); }
public void Edit() { var customOrganisationClassification = new CustomOrganisationClassificationBuilder(this.Session).WithName("Gold").Build(); var industryClassification = new IndustryClassificationBuilder(this.Session).WithName("Retail").Build(); var legalForm = new LegalForms(this.Session).FindBy(M.LegalForm.Description, "BE - BVBA / SPRL"); this.Session.Derive(); this.Session.Commit(); var before = new Organisations(this.Session).Extent().ToArray(); var organisation = before.First(v => v.PartyName.Equals("Acme0")); var id = organisation.Id; var organisationOverviewPage = this.organisationListPage.Select(organisation); var page = organisationOverviewPage.Edit(); page.Name.Set("new organisation") .TaxNumber.Set("BE 123 456 789 01") .LegalForm.Set(legalForm.Description) .Locale.Set(this.Session.GetSingleton().AdditionalLocales.First.Name) .IndustryClassifications.Toggle(industryClassification.Name) .CustomClassifications.Toggle(customOrganisationClassification.Name) .IsManufacturer.Set(true) .IsInternalOrganisation.Set(true) .Comment.Set("comment") .Save.Click(); this.Driver.WaitForAngular(); this.Session.Rollback(); var after = new Organisations(this.Session).Extent().ToArray(); Assert.Equal(after.Length, before.Length); organisation = after.First(v => v.Id.Equals(id)); Assert.Equal("new organisation", organisation.Name); Assert.Equal("BE 123 456 789 01", organisation.TaxNumber); Assert.Equal(legalForm, organisation.LegalForm); Assert.Equal(this.Session.GetSingleton().AdditionalLocales.First, organisation.Locale); Assert.Contains(industryClassification, organisation.IndustryClassifications); Assert.Contains(customOrganisationClassification, organisation.CustomClassifications); Assert.True(organisation.IsManufacturer); Assert.True(organisation.IsInternalOrganisation); Assert.Equal("comment", organisation.Comment); }
/// <summary> /// Constructor to the components /// </summary> public tabCreateChange() { InitializeComponent(); btnSaveChanges.Enabled = false; estateHandler = new EstateHandler(listBox1); comboBoxCountry.DataSource = Countries.GetValues(typeof(Countries)); comboBoxLegalForm.DataSource = LegalForms.GetValues(typeof(LegalForms)); comboBox3.DataSource = Category.GetValues(typeof(Category)); comboBoxLegalForm.DataSource = LegalForms.GetValues(typeof(LegalForms)); comboBox5.DataSource = TypeAll.GetValues(typeof(TypeAll)); lblDynamicTxt1.Text = "---------"; btnChangeEstate.BackColor = Color.FromArgb(140, 135, 222); btnCreateEstate.BackColor = Color.FromArgb(140, 135, 222); btnChooseImage.BackColor = Color.FromArgb(140, 135, 222); btnSaveChanges.BackColor = Color.FromArgb(168, 165, 209); }
private void BtnCreate_Click(object sender, EventArgs e) { Categories category = (Categories)cbCategory.SelectedIndex; string type = cbType.SelectedItem.ToString(); LegalForms legalForm = (LegalForms)cbLegalForm.SelectedIndex; string street = tbxStreet.Text.Trim(); string zipcode = tbxZipCode.Text.Trim(); string city = tbxCity.Text.Trim(); Countries country = (Countries)cbCountry.SelectedIndex; Image image = Image.FromFile(lblChosenImage.Text); string imagename = lblChosenImage.Text; Estate estate = controller.CreateEstate(id++, category, type, legalForm, street, zipcode, city, country, image, imagename); AddToList(estate); ClearInput(); }
public Estate CreateEstate(int id, Categories category, string type, LegalForms legalForm, string street, string zipcode, string city, Countries country, Image image, string imagename) { switch (category) { case Categories.Commercial: switch (type) { case "Shop": return(new Shop(id, category, type, legalForm, new Address(street, zipcode, city, country), image, imagename)); case "Warehouse": return(new Warehouse(id, category, type, legalForm, new Address(street, zipcode, city, country), image, imagename)); default: return(null); } case Categories.Residential: switch (type) { case "Apartment": return(new Apartment(id, category, type, legalForm, new Address(street, zipcode, city, country), image, imagename)); case "House": return(new House(id, category, type, legalForm, new Address(street, zipcode, city, country), image, imagename)); case "Villa": return(new Villa(id, category, type, legalForm, new Address(street, zipcode, city, country), image, imagename)); case "TownHouse": return(new TownHouse(id, category, type, legalForm, new Address(street, zipcode, city, country), image, imagename)); default: return(null); } default: return(null); } }
public void Edit() { var customOrganisationClassification = new CustomOrganisationClassificationBuilder(this.Session).WithName("Gold").Build(); var industryClassification = new IndustryClassificationBuilder(this.Session).WithName("Retail").Build(); var legalForm = new LegalForms(this.Session).FindBy(M.LegalForm.Description, "BE - BVBA / SPRL"); this.Session.Derive(); this.Session.Commit(); var before = new Organisations(this.Session).Extent().ToArray(); var organisation = before.Last(); var id = organisation.Id; this.organisationListPage.Table.DefaultAction(organisation); var organisationOverview = new OrganisationOverviewComponent(this.organisationListPage.Driver); var organisationOverviewDetail = organisationOverview.OrganisationOverviewDetail.Click(); organisationOverviewDetail .Name.Set("new organisation") .TaxNumber.Set("BE 123 456 789 01") .LegalForm.Select(legalForm) .Locale.Select(this.Session.GetSingleton().AdditionalLocales.First) .IndustryClassifications.Toggle(industryClassification) .CustomClassifications.Toggle(customOrganisationClassification) .IsManufacturer.Set(true) .Comment.Set("comment") .SAVE.Click(); this.Driver.WaitForAngular(); this.Session.Rollback(); var after = new Organisations(this.Session).Extent().ToArray(); Assert.Equal(after.Length, before.Length); organisation = after.First(v => v.Id.Equals(id)); }
/// <summary> /// Constructor to the components /// </summary> public GUI() { InitializeComponent(); btnSaveChanges.Enabled = false; estateManager = new EstateManager(listBox1); comboBoxCountry.DataSource = Countries.GetValues(typeof(Countries)); comboBoxLegalForm.DataSource = LegalForms.GetValues(typeof(LegalForms)); comboBoxCategory.DataSource = Category.GetValues(typeof(Category)); comboBoxLegalForm.DataSource = LegalForms.GetValues(typeof(LegalForms)); lblDynamicTxt1.Text = "---------"; btnChangeEstate.BackColor = Color.FromArgb(140, 135, 222); btnCreateEstate.BackColor = Color.FromArgb(140, 135, 222); btnChooseImage.BackColor = Color.FromArgb(140, 135, 222); btnSaveChanges.BackColor = Color.FromArgb(168, 165, 209); btnDeleteAll.BackColor = Color.FromArgb(140, 135, 222); btnDelete.BackColor = Color.FromArgb(140, 135, 222); btnChangeEstate.BackColor = Color.FromArgb(140, 135, 222); btnGenerateEstates.BackColor = Color.FromArgb(140, 135, 222); btnSearch.BackColor = Color.FromArgb(140, 135, 222); btnShowAll.BackColor = Color.FromArgb(140, 135, 222); }
public Warehouse(int id, Categories category, string type, LegalForms legalForm, Address address, Image image, string imagename) : base(id, category, type, legalForm, address, image, imagename) { }
/// <summary> /// Validates that all the information is filled in correctly and then creates an estate object /// and puts it into the estates list. /// </summary> /// <param name="id"></param> /// <param name="legalForm"></param> /// <param name="country"></param> /// <param name="city"></param> /// <param name="zipCode"></param> /// <param name="street"></param> /// <param name="category"></param> /// <param name="type"></param> /// <param name="text"></param> /// <param name="image"></param> public void createEstate(string id, LegalForms legalForm, Countries country, string city, string zipCode, string street, Category category, object type, string text, Bitmap image, RichTextBox richTxtBx, TypeAll typeAll) { if (!isIdValid(id) || !uniqueId(id) || !hasChosenImage(image) || !allFieldsFilled(city, zipCode, street, text)) { return; } Address address = new Address(street, zipCode, city, country); this.richTxtBx = richTxtBx; switch (type) { case TypeCom.Shop: Shop shop = new Shop(id, text, legalForm, image, address, category, typeAll); estates.Add(shop); ids.Add(id); break; case TypeCom.Warehouse: Estate warehouse = new Warehouse(id, text, legalForm, image, address, category, typeAll); estates.Add(warehouse); ids.Add(id); break; case TypeRes.Apartment: Estate apartment = new Apartment(id, text, legalForm, image, address, category, typeAll); estates.Add(apartment); ids.Add(id); break; case TypeRes.House: Estate house = new House(id, text, legalForm, image, address, category, typeAll); estates.Add(house); ids.Add(id); break; case TypeRes.Townhouse: Estate townhouse = new Townhouse(id, text, legalForm, image, address, category, typeAll); estates.Add(townhouse); ids.Add(id); break; case TypeRes.Villa: Estate villa = new Villa(id, text, legalForm, image, address, category, typeAll); estates.Add(villa); ids.Add(id); break; default: break; } MessageBox.Show("För debug \n, ids count: " + ids.Count + " estate i ArrayList count: " + estates.Count); MessageBox.Show("Estate successfully created, to browse the esates go to the Search/Delete tab"); updateTxtWindow(); MessageBox.Show("Richtextbox succesfully updated!"); // skriv ut i search }
public CommercialBuilding(int id, Categories category, string type, LegalForms legalForm, Address address, Image image, string imagename) : base(id, category, type, legalForm, address, image, imagename) { }
/// <summary> /// Validates that all the information is filled in correctly and then creates an estate object /// and puts it into the estates list. /// </summary> /// <param name="id"></param> /// <param name="legalForm"></param> /// <param name="country"></param> /// <param name="city"></param> /// <param name="zipCode"></param> /// <param name="street"></param> /// <param name="category"></param> /// <param name="type"></param> /// <param name="text"></param> /// <param name="image"></param> public void createEstate(string id, LegalForms legalForm, Countries country, string city, string zipCode, string street, Category category, object type, string text, Bitmap image, TypeAll typeAll, bool isModifyingEstate) { if (isModifyingEstate) { Estate oldEstate = GetEstate(id); estates.Remove(oldEstate); ids.Remove(id); } // || !hasChosenImage(image) ?? Maybe remove?? if (!isIdValid(id) || !uniqueId(id) || !allFieldsFilled(city, zipCode, street, text)) { return; } Address address = new Address(street, zipCode, city, country); switch (type) { case TypeCom.Shop: Shop shop = new Shop(id, text, legalForm, image, address, category, typeAll); estates.Add(shop); ids.Add(id); break; case TypeCom.Warehouse: Estate warehouse = new Warehouse(id, text, legalForm, image, address, category, typeAll); estates.Add(warehouse); ids.Add(id); break; case TypeRes.Apartment: Estate apartment = new Apartment(id, text, legalForm, image, address, category, typeAll); estates.Add(apartment); ids.Add(id); break; case TypeRes.House: Estate house = new House(id, text, legalForm, image, address, category, typeAll); estates.Add(house); ids.Add(id); break; case TypeRes.Townhouse: Estate townhouse = new Townhouse(id, text, legalForm, image, address, category, typeAll); estates.Add(townhouse); ids.Add(id); break; case TypeRes.Villa: Estate villa = new Villa(id, text, legalForm, image, address, category, typeAll); estates.Add(villa); ids.Add(id); break; default: break; } updateTxtWindow(); }