Ejemplo n.º 1
0
        private void zwolnij_Click(object sender, EventArgs e)
        {
            if (this.selectedID > 0)
            {
                string nazwa = "";
                using (P_BankowoscEntities Dane = new P_BankowoscEntities()) {
                    var zalogowanyP = from p in Dane.Pracownik
                                      where p.ID == this.selectedID
                                      select p;
                    foreach (Pracownik p in zalogowanyP)
                    {
                        nazwa = p.Imię + " " + p.Nazwisko;
                    }
                    string            message = "Czy na pewno chcesz zwolnić pracownika\n" + nazwa;
                    string            title   = "Zwolnienie";
                    MessageBoxButtons buttons = MessageBoxButtons.YesNo;
                    DialogResult      result  = MessageBox.Show(message, title, buttons);

                    if (result == DialogResult.Yes)
                    {
                        Dane.zwolnienie(this.selectedID, System.DateTime.Today.Date);
                        Dane.SaveChanges();
                        Osoba.Items.Clear();
                        this.selectedID = -1;
                        this.idTab      = printDane();
                    }
                }
            }
        }
Ejemplo n.º 2
0
 private void yes_Click(object sender, EventArgs e)
 {
     using (P_BankowoscEntities Dane = new P_BankowoscEntities()) {
         Dane.usun(this.selectedId, System.DateTime.Today.Date);
         Dane.SaveChanges();
         form.reload();
         this.Close();
     }
 }
Ejemplo n.º 3
0
 private void Degraduj_Click(object sender, EventArgs e)
 {
     Osoba.Items.Clear();
     nowapensja = int.Parse(tekst_pensja.Text);
     using (P_BankowoscEntities Dane = new P_BankowoscEntities()) {
         Dane.Pracownik_Manage(this.next, this.id, this.nowapensja);
         Dane.SaveChanges();
         this.IdTab = printDane();
     }
     tekst_pensja.Text = "";
 }
Ejemplo n.º 4
0
 private void FormAwans_Click(object sender, EventArgs e)
 {
     try {
         float nowaPensja = float.Parse(Pensja2.Text);
         Osoba.Items.Clear();
         using (P_BankowoscEntities Dane = new P_BankowoscEntities()) {
             Dane.Pracownik_Manage(this.next, this.id, nowaPensja);
             Dane.SaveChanges();
             this.IdTab = printDane();
         }
     }
     catch (System.FormatException) {
     }
     Pensja2.Text = "";
 }