Exemplo n.º 1
0
        public ActionResult Index(FormCollection formularz)
        {
            int idNowejTrasy = 0;

            if (ModelState.IsValid)
            {
                if (entities.Adresy.Count() > 0)
                {
                    idNowejTrasy = entities.Adresy.Max(x => x.IdTrasy) + 1;
                }


                var nowaTrasa = Adresy.CreateAdresy(idNowejTrasy);
                nowaTrasa.MiejsceWyjazdu  = formularz["miejsceWyjazdu"].ToString();
                nowaTrasa.MiejsceDocelowe = formularz["miejsceDocelowe"].ToString();
                nowaTrasa.DataDodania     = System.DateTime.Now;

                entities.AddToAdresy(nowaTrasa);
                entities.SaveChanges(System.Data.Objects.SaveOptions.AcceptAllChangesAfterSave);

                return(View(nowaTrasa));
            }

            return(View());
        }
Exemplo n.º 2
0
        private void DeleteButton_Click_1(object sender, EventArgs e)
        {
            Adresy     Adres_Kursor = Current_Cursor_Address();
            Form_Ustaw form2        = new Form_Ustaw(2, Adres_Kursor);
            int        saveRow      = dataGridView1.CurrentCell.RowIndex;
            int        saveColumn   = dataGridView1.CurrentCell.ColumnIndex;

            form2.SetDesktopLocation(this.Location.X + this.Size.Width, this.Location.Y);
            var result = form2.ShowDialog();

            if (result == DialogResult.OK)
            {
                if (cb_linq.Checked)
                {
                    Delete_Adres_Linq(Adres_Kursor);
                }
                else if (cb_procedura.Checked)
                {
                    Delete_Adres_Procedure(Adres_Kursor);
                }
                if (saveRow > 1)
                {
                    dataGridView1.CurrentCell = dataGridView1[saveColumn, saveRow - 1];
                }
            }
        }
Exemplo n.º 3
0
        private void Delete_Adres_Linq(Adresy Adres_Kursor)
        {
            int id = Adres_Kursor.Id;
            DataClasses1DataContext dc = new DataClasses1DataContext(con);
            Adresy Deleteadresee       = dc.Adresies.FirstOrDefault(adr => adr.Id.Equals(id));

            dc.Adresies.DeleteOnSubmit(Deleteadresee);
            try
            {
                dc.SubmitChanges();
                MONGO.MongoDB.Add_action(Login, "Usunieto adres (" + Adres_Kursor.Miasto + " , " + Adres_Kursor.Ulica + " , " + Adres_Kursor.NumerBudynku + " , " + Adres_Kursor.Województwo + " , " + Adres_Kursor.Kraj + ")", DateTime.Now);
            }
            catch (SqlException sqlexception)
            {
                MessageBox.Show("Usuwanie zostało anulowane. \n\n\n" + "\"" + sqlexception.Message + "\""
                                + "\n Class: " + sqlexception.Class + "\n State: " + sqlexception.State + "\n Number: " + sqlexception.Number);
            }
            catch (Exception exception)
            {
                MessageBox.Show("Usuwanie zostało anulowane. \n\n\n" + "\"" + exception.Message + "\"");
            }

            var selectQuery =
                from a in dc.GetTable <Adresy>()
                select a;

            dataGridView1.DataSource = selectQuery;
        }
Exemplo n.º 4
0
        public ActionResult index(FormCollection formularz)
        {
            if (ModelState.IsValid)
            {
                int idNowejTrasy = 0;
                if (entities.Adresy.Count() > 0)
                {
                    idNowejTrasy = (from adres in entities.Adresy
                                    where adres.IdTrasy != null
                                    select adres.IdTrasy).Max();
                }
                ++idNowejTrasy;
                Adresy nowaTrasa = new Adresy();
                nowaTrasa.IdTrasy         = idNowejTrasy;
                nowaTrasa.MiejsceDocelowe = formularz["miejsceDocelowe"].ToString();
                nowaTrasa.MiejsceWyjazdu  = formularz["miejsceWyjazdu"].ToString();
                nowaTrasa.DataDodania     = DateTime.Now;

                entities.Adresy.Add(nowaTrasa);
                entities.SaveChanges();

                return(View(nowaTrasa));
            }
            return(View());
        }
Exemplo n.º 5
0
        private void Update_Adres_Procedure(Adresy adres)
        {
            DataClasses1DataContext dc = new DataClasses1DataContext(con);

            try
            {
                dc.UpdateAdres(adres.Id, adres.Miasto, adres.Ulica, adres.NumerBudynku, adres.Województwo, adres.Kraj);

                MONGO.MongoDB.Add_action(Login, "Zmieniono adres (" + adres.Miasto + " , " + adres.Ulica + " , " + adres.NumerBudynku + " , " + adres.Województwo + " , " + adres.Kraj + ")", DateTime.Now);
            }
            catch (SqlException sqlexception)
            {
                MessageBox.Show("Usuwanie zostało anulowane. \n\n\n" + "\"" + sqlexception.Message + "\""
                                + "\n Class: " + sqlexception.Class + "\n State: " + sqlexception.State + "\n Number: " + sqlexception.Number);
            }
            catch (Exception exception)
            {
                MessageBox.Show("Zmienianie zostało anulowane proszę spróbować jeszcze raz. \n\n\n" + "\"" + exception.Message + "\"");
            }

            var selectQuery =
                from a in dc.GetTable <Adresy>()
                select a;

            dataGridView1.DataSource = selectQuery;
        }
Exemplo n.º 6
0
        private void UpdateButton_Click_1(object sender, EventArgs e)
        {
            Adresy     Adres_Kursor = Current_Cursor_Address();
            int        saveRow      = dataGridView1.CurrentCell.RowIndex;
            int        saveColumn   = dataGridView1.CurrentCell.ColumnIndex;
            Form_Ustaw form2        = new Form_Ustaw(1, Adres_Kursor);

            form2.SetDesktopLocation(this.Location.X + this.Size.Width, this.Location.Y);
            var result = form2.ShowDialog();

            if (result == DialogResult.OK)
            {
                Adresy returnedAdres = form2.ReturnValue;

                if (cb_linq.Checked)
                {
                    Update_Adres_Linq(returnedAdres, Adres_Kursor.Id);
                }
                else if (cb_procedura.Checked)
                {
                    Update_Adres_Procedure(returnedAdres);
                }
                dataGridView1.CurrentCell = dataGridView1[saveColumn, saveRow];
            }
        }
Exemplo n.º 7
0
        private void Insert_Adres_Linq(Adresy adres)
        {
            DataClasses1DataContext dc = new DataClasses1DataContext(con);

            dc.Adresies.InsertOnSubmit(adres);

            try
            {
                dc.SubmitChanges();
                MONGO.MongoDB.Add_action(Login, "Dodano Adres (" + adres.Miasto + " , " + adres.Ulica + " , " + adres.NumerBudynku + " , " + adres.Województwo + " , " + adres.Kraj + ")", DateTime.Now);
            }
            catch (SqlException sqlexception)
            {
                MessageBox.Show("Dodawanie zostało anulowane. \n\n\n" + "\"" + sqlexception.Message + "\""
                                + "\n Class: " + sqlexception.Class + "\n State: " + sqlexception.State + "\n Number: " + sqlexception.Number);
            }
            catch (Exception exception)
            {
                MessageBox.Show("Dodawania zostało anulowane.\n\n\n" + "\"" + exception.Message + "\"" + "\n\n\n\n\n\n");
            }
            var selectQuery =
                from a in dc.GetTable <Adresy>()
                select a;

            dataGridView1.DataSource = selectQuery;
        }
Exemplo n.º 8
0
        public ActionResult DeleteConfirmed(int id)
        {
            Adresy adresy = db.Adresies.Find(id);

            db.Adresies.Remove(adresy);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Exemplo n.º 9
0
 private void getSelectedAddress(Adresy adres)
 {
     IdAdresu         = adres.IdAdresu;
     AdresUlica       = adres.Ulica;
     AdresNrDomu      = adres.NrDomu;
     AdresMiejscowosc = adres.Miejscowosc;
     AdresKodPocztowy = adres.KodPocztowy;
 }
Exemplo n.º 10
0
 public ActionResult UsunTrase(Adresy adres)
 {
     if (entities.Adresy.Count() > 0)
     {
         var trasaDoUsuniecia = entities.Adresy.Where(s => s.IdTrasy == adres.IdTrasy).First();
         entities.Adresy.DeleteObject(trasaDoUsuniecia);
         entities.SaveChanges(System.Data.Objects.SaveOptions.AcceptAllChangesAfterSave);
     }
     return(View("Trasy", entities));
 }
Exemplo n.º 11
0
 public ActionResult Edit([Bind(Include = "ID,ObywatelID,Ulica,Miasto,Kod_pocztowy,Poczta,Gmina,Powiat,Wojewodztwo,Data_zam,Data_wym,Pobyt,Statusadr")] Adresy adresy)
 {
     if (ModelState.IsValid)
     {
         db.Entry(adresy).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.ObywatelID = new SelectList(db.Obywatels, "ID", "PESEL", adresy.ObywatelID);
     return(View(adresy));
 }
Exemplo n.º 12
0
 public ActionResult UsunTrase(Adresy adres)
 {
     if (entities.Adresy.Count() > 0)
     {
         Adresy trasaDoUsuniecia =
             entities.Adresy.Where(s => s.IdTrasy == adres.IdTrasy).First();
         entities.Adresy.Remove(trasaDoUsuniecia);
         entities.SaveChanges();
     }
     return(View("Trasy", entities));
 }
Exemplo n.º 13
0
        private void Update_Adres_Linq(Adresy returnedAdres, int kursor)
        {
            DataClasses1DataContext dc = new DataClasses1DataContext(con);

            Adresy adresee = dc.Adresies.FirstOrDefault(adr => adr.Id.Equals(kursor));

            Adresy save = new Adresy();

            save.Miasto       = String.Copy(adresee.Miasto);
            save.Ulica        = String.Copy(adresee.Ulica);
            save.NumerBudynku = String.Copy(adresee.NumerBudynku);
            save.Województwo  = String.Copy(adresee.Województwo);
            save.Kraj         = String.Copy(adresee.Kraj);

            adresee.Miasto       = returnedAdres.Miasto;
            adresee.Ulica        = returnedAdres.Ulica;
            adresee.NumerBudynku = returnedAdres.NumerBudynku;
            adresee.Województwo  = returnedAdres.Województwo;
            adresee.Kraj         = returnedAdres.Kraj;

            try
            {
                dc.SubmitChanges();
                MONGO.MongoDB.Add_action(Login, "Zmieniono adres (" + returnedAdres.Miasto + " , " + returnedAdres.Ulica + " , " + returnedAdres.NumerBudynku + " , " + returnedAdres.Województwo + " , " + returnedAdres.Kraj + ")", DateTime.Now);
            }
            catch (SqlException sqlexception)
            {
                adresee.Miasto       = save.Miasto;
                adresee.Ulica        = save.Ulica;
                adresee.NumerBudynku = save.NumerBudynku;
                adresee.Województwo  = save.Województwo;
                adresee.Kraj         = save.Kraj;
                MessageBox.Show("Zmienianie zostało anulowane. \n\n\n" + "\"" + sqlexception.Message + "\""
                                + "\n Class: " + sqlexception.Class + "\n State: " + sqlexception.State + "\n Number: " + sqlexception.Number);
            }
            catch (Exception exception)
            {
                adresee.Miasto       = save.Miasto;
                adresee.Ulica        = save.Ulica;
                adresee.NumerBudynku = save.NumerBudynku;
                adresee.Województwo  = save.Województwo;
                adresee.Kraj         = save.Kraj;
                MessageBox.Show("Zmienianie zostało anulowane. \n\n\n" + "\"" + exception.Message + "\"");
            }


            var selectQuery =
                from a in dc.GetTable <Adresy>()
                select a;

            dataGridView1.DataSource = selectQuery;
        }
Exemplo n.º 14
0
        // GET: Adresy/Delete/5
        public ActionResult Delete(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Adresy adresy = db.Adresies.Find(id);

            if (adresy == null)
            {
                return(HttpNotFound());
            }
            return(View(adresy));
        }
Exemplo n.º 15
0
        public bool removeAddress(int adresId)
        {
            try
            {
                Adresy adresy = kinoEntities.Adresy.Find(adresId);
                adresy.CzyAktywny = false;
                kinoEntities.SaveChanges();
            } catch (Exception)
            {
                return(false);
            }

            return(true);
        }
Exemplo n.º 16
0
        // GET: Adresy/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Adresy adresy = db.Adresies.Find(id);

            if (adresy == null)
            {
                return(HttpNotFound());
            }
            ViewBag.ObywatelID = new SelectList(db.Obywatels, "ID", "PESEL", adresy.ObywatelID);
            return(View(adresy));
        }
Exemplo n.º 17
0
        private void end()
        {
            Adresy New = new Adresy();

            if (this.Text != "Dodaj")
            {
                New.Id = Int32.Parse(t_ID.Text);
            }
            New.Miasto       = t_Miasto.Text;
            New.NumerBudynku = t_NumerBudynku.Text;
            New.Ulica        = t_Ulica.Text;
            New.Województwo  = t_Wojewodztwo.Text;
            New.Kraj         = t_Kraj.Text;

            ReturnValue = New;
        }
Exemplo n.º 18
0
        private Adresy  Current_Cursor_Address()
        {
            DataGridViewRow n = dataGridView1.CurrentRow;

            String[] substrings = n.AccessibilityObject.Value.Split(';');

            Adresy Adres_Kursor = new Adresy();

            Adres_Kursor.Id           = Int32.Parse(substrings[0]);
            Adres_Kursor.Miasto       = substrings[1];
            Adres_Kursor.Ulica        = substrings[2];
            Adres_Kursor.NumerBudynku = substrings[3];
            Adres_Kursor.Województwo  = substrings[4];
            Adres_Kursor.Kraj         = substrings[5];

            return(Adres_Kursor);
        }
Exemplo n.º 19
0
        public ActionResult Create([Bind(Include = "ID,ObywatelID,Ulica,Miasto,Kod_pocztowy,Poczta,Gmina,Powiat,Wojewodztwo,Data_zam,Data_wym,Pobyt,Statusadr")] Adresy adresy)
        {
            try
            {
                if (ModelState.IsValid)
                {
                    db.Adresies.Add(adresy);
                    db.SaveChanges();
                    return(RedirectToAction("Index"));
                }
            }
            catch (DataException /*dex*/)
            {
                ModelState.AddModelError("", "Unable to save changes. Try again, and if the " +
                                         "problem persist see your system administrator");
            }

            ViewBag.ObywatelID = new SelectList(db.Obywatels, "ID", "PESEL", adresy.ObywatelID);
            return(View(adresy));
        }
Exemplo n.º 20
0
        private void InsertButton_Click_1(object sender, EventArgs e)
        {
            Adresy     AdresKursor = Current_Cursor_Address();
            Form_Ustaw form2       = new Form_Ustaw(0, AdresKursor);

            form2.SetDesktopLocation(this.Location.X + this.Size.Width, this.Location.Y);

            var result = form2.ShowDialog();

            if (result == DialogResult.OK)
            {
                Adresy adres = form2.ReturnValue;

                if (cb_linq.Checked)
                {
                    Insert_Adres_Linq(adres);
                }
                else if (cb_procedura.Checked)
                {
                    Insert_Adres_Procedure(adres);
                }
                dataGridView1.CurrentCell = dataGridView1[0, dataGridView1.RowCount - 1];
            }
        }
Exemplo n.º 21
0
    protected void bZapisz_Click(object sender, EventArgs e)
    {
        initAttr();
        // TODO pobierz zapisana ankiete

        Zgloszenia z = new Zgloszenia();
        z.temat = PracaTemat.Text.Length > 0 ? PracaTemat.Text : null;
        z.największe_osiągnięcie = OpiniaCoUwaza.Text.Length > 0 ? OpiniaCoUwaza.Text : null;
        z.dalesze_poczynania = OpiniaRozwiniecie.Text.Length > 0 ? OpiniaRozwiniecie.Text : null;
        z.charakter_uzyteczny = OpiniaUzytecznosc.Text.Length > 0 ? OpiniaUzytecznosc.Text : null;
        z.PDF = PracaPDF.HasAttributes ? new Binary(PracaPDF.FileBytes) : null;
        // TODO promotor
        user user = db.users.Single(p => p.login.Equals(User.Identity.Name));
        z.user = user;

        DateTime obrona = new DateTime();
        if (DateTime.TryParse(PracaObrona.Text, out obrona))
        {
            z.data_obrony = obrona;
        }

        List<Autor> autorzy = Session["autorzy"] != null ? Session["autorzy"] as List<Autor> : new List<Autor>();
        foreach (Autor autor in autorzy)
        {
            Autorzy a = new Autorzy();
            a.imie = autor.Imie;
            a.nazwisko = autor.Nazwisko;
            a.Zgloszenia = z;
            a.telefon = autor.Telefon;
            a.email = autor.Email;

            Adresy adres = new Adresy();
            adres.ulica = autor.Ulica;
            adres.numer_domu = autor.Numer;
            adres.numer_mieszkania = autor.Mieszkanie;
            adres.kod = autor.KodPocztowy;

            Miasta miasto = db.Miastas.SingleOrDefault(m => m.nazwa.Equals(autor.Miasto));
            if (miasto == null)
            {
                miasto = new Miasta();
                miasto.nazwa = autor.Miasto;

                db.Miastas.InsertOnSubmit(miasto);
            }
            adres.Miasta = miasto;

            db.Adresies.InsertOnSubmit(adres);
        }

        if (UczelniaSpecjalnoscNowa.Visible && UczelniaSpecjalnoscNowa.Text.Length > 0)
        {
            Specjalnosci s = new Specjalnosci();
            s.nazwa = UczelniaSpecjalnoscNowa.Text;
            s.czypotwierdona = false;

            if (UczelniaInstytutNowy.Visible && UczelniaInstytutNowy.Text.Length > 0)
            {
                Instytuty i = new Instytuty();
                i.nazwa = UczelniaInstytutNowy.Text;
                i.czypotwierdony = false;

                if (UczelniaWydzialNowy.Visible && UczelniaWydzialNowy.Text.Length > 0)
                {
                    Wydzialy w = new Wydzialy();
                    w.nazwa = UczelniaWydzialNowy.Text;
                    w.czypotwierdony = false;

                    if (UczelniaNazwaNowa.Visible && UczelniaNazwaNowa.Text.Length > 0)
                    {
                        Uczelnie u = new Uczelnie();
                        u.nazwa = UczelniaNazwaNowa.Text;
                        u.czypotwierdona = false;

                        w.Uczelnie = u;

                        db.Uczelnies.InsertOnSubmit(u);
                    }
                    else if (UczelniaNazwa.SelectedIndex > 0)
                    {
                        w.Uczelnie = db.Uczelnies.Single(p => p.id_Uczelni == int.Parse(UczelniaNazwa.SelectedValue));
                    }

                    i.Wydzialy = w;
                    s.Wydzialy = w;

                    db.Wydzialies.InsertOnSubmit(w);
                }
                else if (UczelniaWydzial.SelectedIndex > 0)
                {
                    Wydzialy wTemp = db.Wydzialies.Single(p => p.id_wydzialu == int.Parse(UczelniaWydzial.SelectedValue));
                    i.Wydzialy = wTemp;
                    s.Wydzialy = wTemp;
                }

                db.Instytuties.InsertOnSubmit(i);
            }

            db.Specjalnoscis.InsertOnSubmit(s);
        }

        db.Zgloszenias.InsertOnSubmit(z);
        db.SubmitChanges();
    }
Exemplo n.º 22
0
        private static void Start()
        {
            int  KontrolerMenu;
            var  ListaAdresow   = new List <Adres>();
            bool KontrolerPetli = true;

            while (KontrolerPetli)
            {
                Console.Clear();
                var adres = new Adres();
                Console.WriteLine("Menu: \n1 - Dodaj adres\n2 - Wyświetl według \n3 - Wyświetl wszystkie \n4 - Zakończ działanie programu");

                if (!int.TryParse(Console.ReadLine(), out KontrolerMenu))
                {
                    Console.WriteLine("Niepoprawna wartość!");
                }

                switch (KontrolerMenu)
                {
                case 1:

                    Console.Clear();
                    Console.WriteLine("Podaj kod pocztowy: ");
                    adres.KodPocztowy = Console.ReadLine();

                    Console.WriteLine("Podaj miasto: ");
                    adres.Miasto = Console.ReadLine();

                    Console.WriteLine("Podaj ulicę:  ");
                    adres.Ulica = Console.ReadLine();

                    Console.WriteLine("Podaj numer domu: ");
                    adres.NrDomu = int.Parse(Console.ReadLine());

                    Console.WriteLine("Podaj numer mieszkania: ");
                    adres.NrMieszkania = int.Parse(Console.ReadLine());

                    Console.Clear();
                    ListaAdresow.Add(adres);
                    break;

                case 2:
                    Console.Clear();
                    Console.WriteLine("2 - Wyświetl według \n\t1 - Kodu pocztowego \n\t2 - Miasta \n\t3 - Ulicy \n\t4 - Ulicy, nr domu, \n\t5 - Ulicy, nr domu, nr mieszkania");

                    if (!int.TryParse(Console.ReadLine(), out KontrolerMenu))
                    {
                        Console.WriteLine("Niepoprawna wartość!");
                    }
                    switch (KontrolerMenu)
                    {
                    case 1:

                        Console.Clear();
                        Console.WriteLine("Podaj kod pocztowy: ");
                        string       KodPodcztowy = Console.ReadLine();
                        List <Adres> ListaKodow   = ListaAdresow.FindAll(x => x.KodPocztowy == KodPodcztowy);
                        foreach (var WyswietlaneKody in ListaKodow)
                        {
                            Console.WriteLine(WyswietlaneKody);
                        }
                        Console.ReadKey();
                        break;


                    case 2:

                        Console.Clear();
                        Console.WriteLine("Podaj nazwe miasta: ");
                        string       Miasto     = Console.ReadLine();
                        List <Adres> ListaMiast = ListaAdresow.FindAll(x => x.Miasto == Miasto);
                        foreach (var WyswietlaneMiasta in ListaMiast)
                        {
                            Console.WriteLine(WyswietlaneMiasta);
                        }
                        Console.ReadKey();
                        break;

                    case 3:

                        Console.Clear();
                        Console.WriteLine("Podaj nazwe ulicy: ");
                        string       Ulica     = Console.ReadLine();
                        List <Adres> ListaUlic = ListaAdresow.FindAll(x => x.Ulica == Ulica);
                        foreach (var WyswietlaneUlice in ListaUlic)
                        {
                            Console.WriteLine(WyswietlaneUlice);
                        }
                        Console.ReadKey();
                        break;

                    case 4:

                        Console.Clear();
                        Console.WriteLine("Podaj nazwe ulicy: ");
                        Ulica = Console.ReadLine();
                        Console.WriteLine("Podaj numer domu: ");
                        int          NrDomu            = int.Parse(Console.ReadLine());
                        List <Adres> ListaUlicINumerow = ListaAdresow.FindAll(x => x.Ulica == Ulica && x.NrDomu == NrDomu);
                        foreach (var WyswietlaneUliceINumery in ListaUlicINumerow)
                        {
                            Console.WriteLine(WyswietlaneUliceINumery);
                        }
                        Console.ReadKey();
                        break;

                    case 5:

                        Console.Clear();
                        Console.WriteLine("Podaj nazwe ulicy: ");
                        Ulica = Console.ReadLine();
                        Console.WriteLine("Podaj numer domu: ");
                        NrDomu = int.Parse(Console.ReadLine());
                        Console.WriteLine("Podaj numer mieszkania: ");
                        int NrMieszkania = int.Parse(Console.ReadLine());
                        Console.WriteLine(ListaAdresow.FindAll(x => x.Ulica == Ulica && x.NrDomu == NrDomu && x.NrMieszkania == NrMieszkania));
                        Console.ReadKey();
                        break;
                    }
                    break;

                case 3:

                    Console.Clear();
                    if (!ListaAdresow.Any())
                    {
                        Console.WriteLine("Lista adresów jest pusta");
                    }
                    else
                    {
                        foreach (var Adresy in ListaAdresow)
                        {
                            Console.WriteLine(Adresy.ToString());
                        }
                    }
                    Console.ReadKey();
                    break;

                case 4:

                    Console.Clear();
                    KontrolerPetli = false;
                    break;
                }
            }
        }
        public Form_add_budynek(int n, Budynki Budynek_kursor)
        {
            InitializeComponent();
            this.Budynek_kursor = Budynek_kursor;
            this.number         = n;

            switch (number)
            {
            case 0:
                this.Text    = "Dodaj Budynek";
                button2.Text = "Dodaj";
                t_opis.Text  = "Przykładowy opis";
                var selectQuery1 = from a in dc.GetTable <Adresy>()
                                   group a by a.Miasto into g
                                   select g.Key;

                myListBox1.DataSource = selectQuery1;
                break;

            case 1:
                this.Text    = "Zmien Budynek";
                button2.Text = "Zmien";
                wczytaj_budynek();

                Adresy adresWybrany1 = (from a in dc.GetTable <Adresy>()
                                        where a.Id == Budynek_kursor.Adresy_Id
                                        select a).First();

                var select = from a in dc.GetTable <Adresy>()
                             group a by a.Miasto into g
                             select g.Key;

                myListBox1.DataSource = select;

                break;

            case 2:
                this.Text    = "Usun Budynek";
                button2.Text = "Usun";
                wczytaj_budynek();
                Adresy adresWybrany = (from a in dc.GetTable <Adresy>()
                                       where a.Id == Budynek_kursor.Adresy_Id
                                       select a).First();

                myListBox1.BeginUpdate();
                myListBox1.Items.Add(adresWybrany.Miasto);
                myListBox1.EndUpdate();

                myListBox2.BeginUpdate();
                myListBox2.Items.Add(adresWybrany.Ulica);
                myListBox2.EndUpdate();

                myListBox3.BeginUpdate();
                myListBox3.Items.Add(adresWybrany.NumerBudynku);
                myListBox3.EndUpdate();

                myListBox4.BeginUpdate();
                myListBox4.Items.Add(adresWybrany.Województwo);
                myListBox4.EndUpdate();

                myListBox5.BeginUpdate();
                myListBox5.Items.Add(adresWybrany.Kraj);
                myListBox5.EndUpdate();

                myListBox6.BeginUpdate();
                myListBox6.Items.Add(adresWybrany.Id.ToString());
                myListBox6.EndUpdate();


                t_adresid.Enabled      = false;
                t_nazwa.Enabled        = false;
                t_opis.Enabled         = false;
                t_telmenadzera.Enabled = false;
                t_telrecepcja.Enabled  = false;
                myListBox1.Enabled     = false;
                myListBox2.Enabled     = false;
                myListBox3.Enabled     = false;
                myListBox4.Enabled     = false;
                myListBox5.Enabled     = false;
                myListBox6.Enabled     = false;
                button1.Enabled        = false;
                break;
            }
        }
Exemplo n.º 24
0
 public string[] DS()
 {
     return(Adresy.Select(m => m.DS).Where(m => !string.IsNullOrEmpty(m)).ToArray());
 }
Exemplo n.º 25
0
 partial void DeleteAdresy(Adresy instance);
Exemplo n.º 26
0
 partial void UpdateAdresy(Adresy instance);
Exemplo n.º 27
0
 partial void InsertAdresy(Adresy instance);
Exemplo n.º 28
0
	private void detach_Adresies(Adresy entity)
	{
		this.SendPropertyChanging();
		entity.Miasta = null;
	}
Exemplo n.º 29
0
	private void attach_Adresies(Adresy entity)
	{
		this.SendPropertyChanging();
		entity.Miasta = this;
	}
Exemplo n.º 30
0
 public Form_Ustaw(int n, Adresy Adres_kursor)
 {
     InitializeComponent();
     this.Adres_kursor = Adres_kursor;
     this.number       = n;
 }