public KontaktDetail() { InitializeComponent(); k = new Kontakt(); created = true; binder = new DataBinding.Binder(); }
public KontaktDetail(Kontakt k) { InitializeComponent(); this.k = k; created = false; binder = new DataBinding.Binder(); }
public static void CompareData(Kontakt saved, Kontakt fromDb) { Assert.IsTrue((saved != null && fromDb != null) || (saved == null && fromDb == null) , "Kontakt zapisany lub z bazy jest nullem, a 2 nie."); Assert.AreEqual(saved.Fax, fromDb.Fax, "fax"); Assert.AreEqual(saved.Tel, fromDb.Tel, "telefon"); Assert.AreEqual(saved.Tel2, fromDb.Tel2, "telefon 2"); Assert.AreEqual(saved.Email, fromDb.Email, "e-mail"); Assert.AreEqual(saved.Www, fromDb.Www, "WWW"); }
// GET: Home public ActionResult Index() { k = kf.Get(1); @ViewBag.Adress = k.Navn + ", " + k.Adresse + ", " + k.PostNr + " " + k.Bynavn + ", " + k.Tlf + ", " + k.Email; // foreach (var kat in katF.GetAll()) //{ // @ViewBag.Kat += "<a href=\"ProduktListe.aspx?katid=" + kat.ID + "\" class=\"Menu\">" + kat.Navn + "</a><br/>"; //} return View(katF.GetAll()); }
public static void SetData(Kontakt k2i, string prefix, WebForm currentWebForm) { TextBoxTester Fax = new TextBoxTester(GetCtrlId(prefix,"FaxEdit"), currentWebForm); TextBoxTester Tel = new TextBoxTester(GetCtrlId(prefix,"TelEdit"), currentWebForm); TextBoxTester Tel2 = new TextBoxTester(GetCtrlId(prefix,"Tel2Edit"), currentWebForm); TextBoxTester Email = new TextBoxTester(GetCtrlId(prefix,"EmailEdit"), currentWebForm); TextBoxTester Www = new TextBoxTester(GetCtrlId(prefix,"WwwEdit"), currentWebForm); Fax.Text = k2i.Fax; Tel.Text = k2i.Tel; Tel2.Text = k2i.Tel2; Email.Text = k2i.Email; Www.Text = k2i.Www; }
public static void KontaktDisplayTest(Kontakt k, string prefix, WebForm currentWebForm) { LabelTester Fax = new LabelTester(GetCtrlId(prefix,"Fax"), currentWebForm); LabelTester Tel = new LabelTester(GetCtrlId(prefix, "Tel"), currentWebForm); LabelTester Tel2 = new LabelTester(GetCtrlId(prefix, "Tel2"), currentWebForm); LabelTester Email = new LabelTester(GetCtrlId(prefix, "Email"), currentWebForm); LabelTester Www = new LabelTester(GetCtrlId(prefix, "Www"), currentWebForm); Assert.AreEqual(k.Fax, Fax.Text, "z造 fax"); Assert.AreEqual(k.Tel, Tel.Text, "z造 telefon"); Assert.AreEqual(k.Tel2, Tel2.Text, "z造 telefon 2"); Assert.AreEqual(k.Email, Email.Text, "z造 e-mail"); Assert.AreEqual(k.Www, Www.Text, "z造 adres www"); }
// GET: Kontakty/Details/5 public ActionResult Details(int id) { Kontakt kontakt = n.Kontakty.Single(k => k.Id == id); return(View(kontakt)); }
void EditKontakt(Kontakt k) { var tmp = new Dialogs.KontaktDetail(k); tmp.ShowDialog(); BindTo(); }
void DeleteKontakt(Kontakt k) { BL.deleteKontakt(k); BindTo(); }
public KontaktModule(KontaktService kontaktService) : base("/kontakte") { Get["/"] = p => { var kontakte = kontaktService.Get(); return(new JsonResponse(kontakte, new JsonNetSerializer())); }; Get["/{id}"] = p => { var kontakt = kontaktService.Get(p.id); if (kontakt == null) { return(HttpStatusCode.NotFound); } return(new JsonResponse(kontakt, new JsonNetSerializer())); }; Post["/"] = p => { Kontakt post = this.Bind(); try { var result = kontaktService.Add(post); } catch (Exception ex) { log.errorLog(ex.Message); return(HttpStatusCode.BadRequest); } return(HttpStatusCode.Created); }; Put["/"] = p => { Kontakt put = this.Bind(); try { var result = kontaktService.Update(put); } catch (Exception ex) { log.errorLog(ex.Message); return(HttpStatusCode.BadRequest); } return(HttpStatusCode.OK); }; Delete["/{id}"] = p => { try { var result = kontaktService.Delete(p.id); return(new JsonResponse(result, new DefaultJsonSerializer())); } catch (Exception ex) { log.errorLog(ex.Message); return(HttpStatusCode.BadRequest); } }; }
public Kontakt[] KuvaKontakt(String kontakt_id, String eesnimi, String perenimi, String telefonKodu, String telefonToo, String telefonMob, String emailKodu, String emailToo, String riik, String maakond, String asula, String tanav, String maja_nr, String wlm, String facebook, String orkut, String skype, String twitter, String pilt) { int id = 0; Int32.TryParse(kontakt_id, out id); if (Session["kasutaja"] == null) { return(null); } Kasutaja k = (Kasutaja)Session["kasutaja"]; Kontakt kontakt = new Kontakt(); kontakt.Id = id; if (eesnimi != "") { kontakt.Eesnimi = eesnimi; } if (eesnimi != "") { kontakt.Eesnimi = eesnimi; } if (perenimi != "") { kontakt.Perenimi = perenimi; } if (telefonKodu != "") { kontakt.TelefonKodu = telefonKodu; } if (telefonToo != "") { kontakt.TelefonToo = telefonToo; } if (telefonMob != "") { kontakt.TelefonMob = telefonMob; } if (emailKodu != "") { kontakt.EmailKodu = emailKodu; } if (emailToo != "") { kontakt.EmailToo = emailToo; } if (riik != "") { kontakt.Riik = riik; } if (maakond != "") { kontakt.Maakond = maakond; } if (asula != "") { kontakt.Asula = asula; } if (tanav != "") { kontakt.Tanav = tanav; } if (maja_nr != "") { kontakt.MajaNr = maja_nr; } if (wlm != "") { kontakt.WindowsLiveMessenger = wlm; } if (facebook != "") { kontakt.Facebook = facebook; } if (orkut != "") { kontakt.Orkut = orkut; } if (skype != "") { kontakt.Skype = skype; } if (twitter != "") { kontakt.Twitter = twitter; } if (pilt != "") { kontakt.Pilt = pilt; } Kontakt[] kontaktid = k.otsiKontaktid(kontakt, ab); return(kontaktid); }
private void ModifyCustomer() { errorMessage = null; bool textHasSpace = false; if (!textBoxCustomerNumber.Text.Contains(" ") && !textBoxFirstName.Text.Contains(" ") && !(textBoxLastName.Text).Contains(" ") && !comboBoxGender.Text.Contains(" ") && !textBoxAge.Text.Contains(" ")) { if (!textBoxCustomerNumber.Text.Equals("") && !textBoxFirstName.Text.Equals("") && !(textBoxLastName.Text).Equals("") && !comboBoxGender.Text.Equals("") && !textBoxAge.Text.Equals("") && !IsTextInputGreaterThenOneHundred(textBoxAge.Text)) { aCustomer.Vornamen = textBoxFirstName.Text; aCustomer.Nachnamen = textBoxLastName.Text; aCustomer.Geschlecht = comboBoxGender.Text; aCustomer.Alter = Convert.ToInt32(textBoxAge.Text); } else { errorMessage += "Customer"; } } else { textHasSpace = true; MessageBox.Show("In Ihren persönlichen Kundendaten dürfen keine Leerzeichen enthalten sein."); } if (!textBoxStreet.Text.Contains(" ") && !textBoxHouseNumber.Text.Contains(" ") && !textBoxZipCode.Text.Contains(" ") && !textBoxCity.Text.Contains(" ")) { if (!textBoxStreet.Text.Equals("") && !textBoxHouseNumber.Text.Equals("") && !textBoxZipCode.Text.Equals("") && !textBoxCity.Text.Equals("")) { aCustomer.Adresse.Strasse = textBoxStreet.Text; aCustomer.Adresse.Hausnummer = textBoxHouseNumber.Text; aCustomer.Adresse.PLZ = textBoxZipCode.Text; aCustomer.Adresse.Ort = textBoxCity.Text; } else { errorMessage += "Address"; } } else { textHasSpace = true; MessageBox.Show("In Ihren Adressdaten dürfen keine Leerzeichen enthalten sein."); } if (!textBoxMail.Text.Contains(" ") && !textBoxPhoneNumber.Text.Contains(" ") && !textBoxMobileNumber.Text.Contains(" ") && !textBoxFaxNumber.Text.Contains(" ")) { if (!textBoxMail.Text.Equals("") || !textBoxPhoneNumber.Text.Equals("") || !textBoxMobileNumber.Text.Equals("") || !textBoxFaxNumber.Text.Equals("")) { aCustomer.Kontakt.E_Mail = textBoxMail.Text; aCustomer.Kontakt.Telefonnummer = textBoxPhoneNumber.Text; aCustomer.Kontakt.Mobilnummer = textBoxMobileNumber.Text; aCustomer.Kontakt.Faxnummer = textBoxFaxNumber.Text; } else { errorMessage += "Contact"; } } else { textHasSpace = true; MessageBox.Show("In Ihren Kontaktdaten dürfen keine Leerzeichen enthalten sein."); } switch (errorMessage) { case "CustomerAddressContact": { MessageBox.Show("Bitte füllen Sie die persönlichen Kunden-, Adress- und Kontaktdaten korrekt aus."); } break; case "CustomerAddress": { MessageBox.Show("Bitte füllen Sie die persönlichen Kunden- und Adressdaten korrekt aus."); } break; case "CustomerContact": { MessageBox.Show("Bitte füllen Sie die persönlichen Kunden- und Kontaktdaten korrekt aus."); } break; case "Customer": { MessageBox.Show("Bitte füllen Sie die persönlichen Kundendaten korrekt aus."); } break; case "AddressContact": { MessageBox.Show("Bitte füllen Sie die Adress- und Kontaktdaten korrekt aus."); } break; case "Address": { MessageBox.Show("Bitte füllen Sie die Adressdaten korrekt aus."); } break; case "Contact": { MessageBox.Show("Bitte füllen Sie die Kontaktdaten korrekt aus."); } break; } if (errorMessage == null && textHasSpace == false) { var result = MessageBox.Show("Möchten Sie die Kundendaten speichern?", "", MessageBoxButton.YesNo, MessageBoxImage.Question); if (result == MessageBoxResult.Yes) { Kunde oldCustomer = list.CustomerList.Where(customer => customer.Kundennummer.Equals(aCustomer.Kundennummer)).First(); list.CustomerList.Remove(oldCustomer); list.addToCustomerList(aCustomer); Adresse oldAddress = list.AddressList.Where(address => address.Equals(aCustomer.Adresse)).First(); list.AddressList.Remove(oldAddress); list.addToAddressList(aCustomer.Adresse); Kontakt oldContact = list.ContactList.Where(contact => contact.Equals(aCustomer.Kontakt)).First(); list.ContactList.Remove(oldContact); list.addToContactList(aCustomer.Kontakt); MessageBox.Show("Kundendaten wurden erfolgreich gespeichert."); } } }
public void SetUp() { Kontakt kontakt1 = new Kontakt { Id = 1, Ime = "Milan", Prezime = "Milanovic", Korisnik_id = 1, Broj = "0654879652", BrojPregleda = 2, Mesto_id = 1 }; Kontakt kontakt2 = new Kontakt { Id = 2, Ime = "Zeljana", Prezime = "Ivanovic", Korisnik_id = 1, Broj = "0654839652", BrojPregleda = 3, Mesto_id = null }; Kontakt kontakt3 = new Kontakt { Id = 3, Ime = "Milos", Prezime = "Milosevic", Korisnik_id = 1, Broj = "0633699633", BrojPregleda = 2, Mesto_id = 1 }; Kontakt kontakt4 = new Kontakt { Id = 3, Ime = "Zeljko", Prezime = "Zeljkovic", Korisnik_id = 2, Broj = "0633299633", BrojPregleda = 2, Mesto_id = 1 }; mesto = new Mesto { Id = 1, NazivMesta = "Zrenjanin" }; listaKontakata = new List <Kontakt> { kontakt1, kontakt2, kontakt3, kontakt4 }; _unitOfWork = new Mock <IUnitOfWork>(); var configuracija = new MapperConfiguration(cfg => { cfg.AddProfile <MapperBiznisProfil>(); }); _Maper = configuracija.CreateMapper(); }
private void CreateCustomer() { Kunde newCustomer = null; errorMessage = null; bool textHasSpace = false; if (newAddress) { if (!textBoxStreet.Text.Contains(" ") && !textBoxHouseNumber.Text.Contains(" ") && !textBoxZipCode.Text.Contains(" ") && !textBoxCity.Text.Contains(" ")) { if (!textBoxStreet.Text.Equals("") && !textBoxHouseNumber.Text.Equals("") && !textBoxZipCode.Text.Equals("") && !textBoxCity.Text.Equals("")) { aAddress = new Adresse(); aAddress.AdresseID = 0; aAddress.Strasse = textBoxStreet.Text; aAddress.Hausnummer = textBoxHouseNumber.Text; aAddress.PLZ = textBoxZipCode.Text; aAddress.Ort = textBoxCity.Text; } else { aAddress = null; errorMessage += "Address"; } } else { aAddress = null; textHasSpace = true; MessageBox.Show("In Ihren Adressdaten dürfen keine Leerzeichen enthalten sein."); } } if (newContact) { if (!textBoxMail.Text.Contains(" ") && !textBoxPhoneNumber.Text.Contains(" ") && !textBoxMobileNumber.Text.Contains(" ") && !textBoxFaxNumber.Text.Contains(" ")) { if (!textBoxMail.Text.Equals("") || !textBoxPhoneNumber.Text.Equals("") || !textBoxMobileNumber.Text.Equals("") || !textBoxFaxNumber.Text.Equals("")) { aContact = new Kontakt(); aContact.KontaktID = 0; aContact.E_Mail = textBoxMail.Text; aContact.Telefonnummer = textBoxPhoneNumber.Text; aContact.Mobilnummer = textBoxMobileNumber.Text; aContact.Faxnummer = textBoxFaxNumber.Text; } else { aContact = null; errorMessage += "Contact"; } } else { aContact = null; textHasSpace = true; MessageBox.Show("In Ihren Kontaktdaten dürfen keine Leerzeichen enthalten sein."); } } if (!textBoxCustomerNumber.Text.Contains(" ") && !textBoxFirstName.Text.Contains(" ") && !textBoxLastName.Text.Contains(" ") && !textBoxAge.Text.Contains(" ")) { if (!textBoxCustomerNumber.Text.Equals("") && !textBoxFirstName.Text.Equals("") && !textBoxLastName.Text.Equals("") && !comboBoxGender.Text.Equals("") && !textBoxAge.Text.Equals("") && !IsTextInputGreaterThenOneHundred(textBoxAge.Text)) { if (aAddress != null && aContact != null) { newCustomer = new Kunde(); newCustomer.KundeID = 0; newCustomer.Kundennummer = textBoxCustomerNumber.Text; newCustomer.Vornamen = textBoxFirstName.Text; newCustomer.Nachnamen = textBoxLastName.Text; newCustomer.Geschlecht = comboBoxGender.Text; newCustomer.Alter = Convert.ToInt32(textBoxAge.Text); newCustomer.Adresse = aAddress; newCustomer.AdresseID = aAddress.AdresseID; newCustomer.Kontakt = aContact; newCustomer.KontaktID = aContact.KontaktID; } } else { errorMessage += "Customer"; } } else { textHasSpace = true; MessageBox.Show("In Ihren persönlichen Kundendaten dürfen keine Leerzeichen enthalten sein."); } switch (errorMessage) { case "AddressContactCustomer": { MessageBox.Show("Bitte füllen Sie die persönlichen Kunden-, Adress- und Kontaktdaten korrekt aus."); } break; case "AddressCustomer": { MessageBox.Show("Bitte füllen Sie die persönlichen Kunden- und Adressdaten korrekt aus."); } break; case "ContactCustomer": { MessageBox.Show("Bitte füllen Sie die persönlichen Kunden- und Kontaktdaten korrekt aus."); } break; case "Customer": { MessageBox.Show("Bitte füllen Sie die persönlichen Kundendaten korrekt aus."); } break; case "AddressContact": { MessageBox.Show("Bitte füllen Sie die Adress- und Kontaktdaten korrekt aus."); } break; case "Address": { MessageBox.Show("Bitte füllen Sie die Adressdaten korrekt aus."); } break; case "Contact": { MessageBox.Show("Bitte füllen Sie die Kontaktdaten korrekt aus."); } break; } if (errorMessage == null && textHasSpace == false) { var result = MessageBox.Show("Möchten Sie einen neuen Kunden anlegen?", "", MessageBoxButton.YesNo, MessageBoxImage.Question); if (result == MessageBoxResult.Yes) { list.AddressList.Remove(placeHolderAddress); list.addToAddressList(aAddress); list.ContactList.Remove(placeHolderContact); list.addToContactList(aContact); list.addToCustomerList(newCustomer); LoadComboBoxAddress(); LoadComboBoxContact(); ClearComponents(); CustomerNumberSequence(); } } }
public Staatus MuudaKontakt(int kontakt_id, String eesnimi, String perenimi, String telefonKodu, String telefonToo, String telefonMob, String emailKodu, String emailToo, String riik, String maakond, String asula, String tanav, String maja_nr, String wlm, String facebook, String orkut, String skype, String twitter, String pilt) { if (Session["kasutaja"] == null) { return(new Staatus() { Tyyp = "Viga", Sonum = "Autentimata" }); } Kasutaja k = (Kasutaja)Session["kasutaja"]; Kontakt kontakt = k.otsiKontaktid(new Kontakt() { Id = kontakt_id }, ab)[0]; kontakt.KasutajaId = k.Id; if (eesnimi != "") { kontakt.Eesnimi = eesnimi; } if (perenimi != "") { kontakt.Perenimi = perenimi; } if (telefonKodu != "") { kontakt.TelefonKodu = telefonKodu; } if (telefonToo != "") { kontakt.TelefonToo = telefonToo; } if (telefonMob != "") { kontakt.TelefonMob = telefonMob; } if (emailKodu != "") { kontakt.EmailKodu = emailKodu; } if (emailToo != "") { kontakt.EmailToo = emailToo; } if (riik != "") { kontakt.Riik = riik; } if (maakond != "") { kontakt.Maakond = maakond; } if (asula != "") { kontakt.Asula = asula; } if (tanav != "") { kontakt.Tanav = tanav; } if (maja_nr != "") { kontakt.MajaNr = maja_nr; } if (wlm != "") { kontakt.WindowsLiveMessenger = wlm; } if (facebook != "") { kontakt.Facebook = facebook; } if (orkut != "") { kontakt.Orkut = orkut; } if (skype != "") { kontakt.Skype = skype; } if (twitter != "") { kontakt.Twitter = twitter; } if (pilt != "") { kontakt.Pilt = pilt; } int affected = ab.Update(kontakt); if (affected > 0) { return(new Staatus() { Tyyp = "OK", Sonum = "Kontakt muudetud!" }); } else { return(new Staatus() { Tyyp = "Viga", Sonum = "Süsteemi viga!" }); } }
public async Task <IActionResult> Edit(string id, [Bind("imeIPrezime,email,predmet,poruka")] Kontakt kontakt) { return(View()); }
partial void DeleteKontakt(Kontakt instance);
partial void UpdateKontakt(Kontakt instance);
partial void InsertKontakt(Kontakt instance);
public void OpretKontakt(Kontakt kontakt) { ctx.Kontakter.Add(kontakt); ctx.SaveChanges(); n.Notify($"{kontakt} oprettet i databasen og har fået følgende id: {kontakt.KontaktId}"); }
private void btnAdd_Click(object sender, RoutedEventArgs e) { RadComboBoxItem selectedItem = comboSex.SelectedItem as RadComboBoxItem; Kontakt kontakt = new Kontakt(); Lokacija lokacija = new Lokacija(); string pom1 = REST.EmailCheck(txtEmail.Text.ToString()); if (pom1.ToString() == "[]") { if (txtAddress.Text != null && txtAddress.Text != "" && txtPlace.Text != null && txtPlace.Text != "" && txtEmail.Text != null && txtEmail.Text != "" && txtPhone.Text != null && txtPhone.Text != "" && txtName.Text != null && txtName.Text != "" && txtLastname.Text != null && txtLastname.Text != "" && txtID.Text != null && txtID.Text != "" && passPassword.Password != null && passPassword.Password != "" && dateDateOfBirth.SelectedDate != null && selectedItem.Content.ToString() != null && selectedItem.Content.ToString() != "") { if (selectedItem.Content.ToString() == "Ž") { pol = 'z'; } else { pol = 'm'; } selectedItem = comboBloodType.SelectedItem as RadComboBoxItem; Donor donor = new Donor(); donor.Ime = txtName.Text; donor.Prezime = txtLastname.Text; donor.Pol = pol.ToString(); donor.RegistarskiBroj = txtID.Text; donor.Lozinka = passPassword.Password; donor.DatumRodjenja = dateDateOfBirth.SelectedDate; donor.KrvnaGrupaDonor = selectedItem.Content.ToString(); lokacija.Mjesto = txtPlace.Text; lokacija.Adresa = txtAddress.Text; kontakt.BrojTelefona = txtPhone.Text; kontakt.Email = txtEmail.Text; //upis u tabelu donor var response = REST.Post("donor", donor); //donor ID string pom = response.Headers.Location.ToString(); Regex regex = new Regex(@"api/Donor/(\w+)"); Match match = regex.Match(pom); pom = match.Groups[1].Value; int ID = Convert.ToInt32(pom); // kontakt.DonorId = ID; //upis u tabelu lokacija response = REST.Post("lokacija", lokacija); //lokacija ID pom = response.Headers.Location.ToString(); regex = new Regex(@"api/Lokacija/(\w+)"); match = regex.Match(pom); pom = match.Groups[1].Value; ID = Convert.ToInt32(pom); // kontakt.LokacijaId = ID; //upis u tabelu kontakt REST.Post("kontakt", kontakt); NavigationService.Navigate(new DonorsPage()); } } else { txtEmail.Foreground = Brushes.Red; } }