Ejemplo n.º 1
0
 private void firmClientGrid_KeyUp(object sender, KeyEventArgs e)
 {
     if (e.KeyCode == Keys.Delete)
     {
         var confirmResult = MessageBox.Show("Jesteś pewien, że chcesz usunąć firmę " + firmClientGrid.CurrentRow.Cells[1].Value.ToString() + "?",
                                             "Potwierdź usuwanie",
                                             MessageBoxButtons.YesNo);
         if (confirmResult == DialogResult.Yes)
         {
             FirmClient firm = new FirmClient();
             if (firm.delete(Convert.ToInt32(firmClientGrid.CurrentRow.Cells[0].Value)))
             {
                 home.notifyIcon1.Icon            = SystemIcons.Application;
                 home.notifyIcon1.BalloonTipText  = "Usunięto firmę " + firmClientGrid.CurrentRow.Cells[1].Value.ToString();
                 home.notifyIcon1.BalloonTipTitle = "Usuwanie firmy";
                 home.notifyIcon1.BalloonTipIcon  = ToolTipIcon.Info;
                 home.notifyIcon1.Visible         = true;
                 home.notifyIcon1.ShowBalloonTip(3000);
                 this.display();
             }
             else
             {
                 home.notifyIcon1.Icon            = SystemIcons.Exclamation;
                 home.notifyIcon1.BalloonTipText  = "Wystąpił błąd podczas usuwania firmy";
                 home.notifyIcon1.BalloonTipTitle = "Usuwanie firmy";
                 home.notifyIcon1.BalloonTipIcon  = ToolTipIcon.Error;
                 home.notifyIcon1.Visible         = true;
                 home.notifyIcon1.ShowBalloonTip(3000);
             }
         }
     }
 }
Ejemplo n.º 2
0
        private void firmClientGrid_CellEndEdit(object sender, DataGridViewCellEventArgs e)
        {
            var confirmResult = MessageBox.Show("Jesteś pewien, że chcesz edytować dane firmy " + firmClientGrid.CurrentRow.Cells[1].Value.ToString() + "?",
                                                "Potwierdź edycję",
                                                MessageBoxButtons.YesNo);

            if (confirmResult == DialogResult.Yes)
            {
                FirmClient firm = new FirmClient();
                if (firm.edit(this.firmClientGrid.CurrentCell.ColumnIndex, Convert.ToInt32(this.firmClientGrid.CurrentRow.Cells[0].Value), this.firmClientGrid.CurrentCell.Value.ToString()))
                {
                    home.notifyIcon1.Icon            = SystemIcons.Application;
                    home.notifyIcon1.BalloonTipText  = "Edytowano firmę " + firmClientGrid.CurrentRow.Cells[1].Value.ToString();
                    home.notifyIcon1.BalloonTipTitle = "Edycja firmy";
                    home.notifyIcon1.BalloonTipIcon  = ToolTipIcon.Info;
                    home.notifyIcon1.Visible         = true;
                    home.notifyIcon1.ShowBalloonTip(3000);
                    this.display();
                }
                else
                {
                    home.notifyIcon1.Icon            = SystemIcons.Exclamation;
                    home.notifyIcon1.BalloonTipText  = "Wystąpił błąd podczas edycji firmy";
                    home.notifyIcon1.BalloonTipTitle = "Edycja firmy";
                    home.notifyIcon1.BalloonTipIcon  = ToolTipIcon.Error;
                    home.notifyIcon1.Visible         = true;
                    home.notifyIcon1.ShowBalloonTip(3000);
                }
            }
        }
Ejemplo n.º 3
0
 private void addClient_button_Click(object sender, EventArgs e)
 {
     if (String.IsNullOrEmpty(client_type.Text) || String.IsNullOrEmpty(client_name.Text) || String.IsNullOrEmpty(client_surname.Text) ||
         String.IsNullOrEmpty(client_city.Text) || String.IsNullOrEmpty(client_houseNo.Text) ||
         String.IsNullOrEmpty(client_phoneNo.Text) || String.IsNullOrEmpty(client_email.Text))
     {
         MessageBox.Show("Wypełnij wszystkie pola formularza");
     }
     else
     {
         if (client_type.Text == "Firma")
         {
             Client firm = new FirmClient();
             if (firm.addClient(client_name.Text, client_surname.Text, client_city.Text, client_street.Text, client_houseNo.Text, client_locumNo.Text, client_phoneNo.Text, client_email.Text))
             {
                 home.notifyIcon1.Icon            = SystemIcons.Application;
                 home.notifyIcon1.BalloonTipText  = "Dodano klienta " + client_name.Text;
                 home.notifyIcon1.BalloonTipTitle = "Nowy klient";
                 home.notifyIcon1.BalloonTipIcon  = ToolTipIcon.Info;
                 home.notifyIcon1.Visible         = true;
                 home.notifyIcon1.ShowBalloonTip(3000);
                 this.Close();
             }
             else
             {
                 home.notifyIcon1.Icon            = SystemIcons.Exclamation;
                 home.notifyIcon1.BalloonTipText  = "Wystąpił błąd podczas dodawania nowego klienta. Sprawdź poprawność wprowadzanych danych i spróbuj ponownie";
                 home.notifyIcon1.BalloonTipTitle = "Nowy klient";
                 home.notifyIcon1.BalloonTipIcon  = ToolTipIcon.Error;
                 home.notifyIcon1.Visible         = true;
                 home.notifyIcon1.ShowBalloonTip(3000);
             }
         }
         else
         {
             Client individual = new IndividualClient();
             if (individual.addClient(client_name.Text, client_surname.Text, client_city.Text, client_street.Text, client_houseNo.Text, client_locumNo.Text, client_phoneNo.Text, client_email.Text))
             {
                 home.notifyIcon1.Icon            = SystemIcons.Application;
                 home.notifyIcon1.BalloonTipText  = "Dodano klienta " + client_name.Text + " " + client_surname.Text;
                 home.notifyIcon1.BalloonTipTitle = "Nowy klient";
                 home.notifyIcon1.BalloonTipIcon  = ToolTipIcon.Info;
                 home.notifyIcon1.Visible         = true;
                 home.notifyIcon1.ShowBalloonTip(3000);
                 this.Close();
             }
             else
             {
                 home.notifyIcon1.Icon            = SystemIcons.Exclamation;
                 home.notifyIcon1.BalloonTipText  = "Wystąpił błąd podczas dodawania nowego klienta. Sprawdź poprawność wprowadzanych danych i spróbuj ponownie";
                 home.notifyIcon1.BalloonTipTitle = "Nowy klient";
                 home.notifyIcon1.BalloonTipIcon  = ToolTipIcon.Error;
                 home.notifyIcon1.Visible         = true;
                 home.notifyIcon1.ShowBalloonTip(3000);
             }
         }
     }
 }
Ejemplo n.º 4
0
        private void display()
        {
            devicesCardsGrid.DataSource = new DeviceCard().list();
            Inameable individualClient = new IndividualClient();
            Inameable firmClient       = new FirmClient();
            Inameable status           = new Status();
            Inameable deviceType       = new DeviceType();

            for (int i = 0; i < devicesCardsGrid.RowCount; i++)
            {
                if (!String.IsNullOrEmpty(devicesCardsGrid.Rows[i].Cells[6].Value.ToString()))
                {
                    devicesCardsGrid.Rows[i].Cells[16].Value = individualClient.getName(Convert.ToInt32(devicesCardsGrid.Rows[i].Cells[6].Value));
                }
                else
                {
                    devicesCardsGrid.Rows[i].Cells[16].Value = firmClient.getName(Convert.ToInt32(devicesCardsGrid.Rows[i].Cells[7].Value));
                }
                devicesCardsGrid.Rows[i].Cells[17].Value = status.getName(Convert.ToInt32(devicesCardsGrid.Rows[i].Cells[8].Value));
                devicesCardsGrid.Rows[i].Cells[15].Value = deviceType.getName(Convert.ToInt32(devicesCardsGrid.Rows[i].Cells[9].Value));
            }
            devicesCardsGrid.Columns[0].HeaderText  = "ID";
            devicesCardsGrid.Columns[0].ReadOnly    = true;
            devicesCardsGrid.Columns[1].HeaderText  = "Producent";
            devicesCardsGrid.Columns[2].HeaderText  = "Model";
            devicesCardsGrid.Columns[3].HeaderText  = "Numer seryjny";
            devicesCardsGrid.Columns[4].HeaderText  = "Dodany do systemu";
            devicesCardsGrid.Columns[5].HeaderText  = "Modyfikowany";
            devicesCardsGrid.Columns[5].Visible     = false;
            devicesCardsGrid.Columns[6].Visible     = false;
            devicesCardsGrid.Columns[7].Visible     = false;
            devicesCardsGrid.Columns[8].Visible     = false;
            devicesCardsGrid.Columns[9].Visible     = false;
            devicesCardsGrid.Columns[10].Visible    = false;
            devicesCardsGrid.Columns[11].Visible    = false;
            devicesCardsGrid.Columns[12].Visible    = false;
            devicesCardsGrid.Columns[13].Visible    = false;
            devicesCardsGrid.Columns[14].Visible    = false;
            devicesCardsGrid.Columns[15].HeaderText = "Typ sprzętu";
            devicesCardsGrid.Columns[16].HeaderText = "Klient ( typ - id )";
            devicesCardsGrid.Columns[17].HeaderText = "Status";
        }
Ejemplo n.º 5
0
        private void display()
        {
            FirmClient firm = new FirmClient();

            firmClientGrid.DataSource             = firm.list();
            firmClientGrid.Columns[0].HeaderText  = "ID";
            firmClientGrid.Columns[0].ReadOnly    = true;
            firmClientGrid.Columns[1].HeaderText  = "Nazwa";
            firmClientGrid.Columns[2].HeaderText  = "Miasto";
            firmClientGrid.Columns[3].HeaderText  = "Ulica";
            firmClientGrid.Columns[4].HeaderText  = "Numer domu";
            firmClientGrid.Columns[5].HeaderText  = "Numer lokalu";
            firmClientGrid.Columns[6].HeaderText  = "Numer telefonu";
            firmClientGrid.Columns[7].HeaderText  = "Email";
            firmClientGrid.Columns[8].HeaderText  = "NIP";
            firmClientGrid.Columns[9].HeaderText  = "Utworzony";
            firmClientGrid.Columns[9].ReadOnly    = true;
            firmClientGrid.Columns[10].HeaderText = "Edytowany";
            firmClientGrid.Columns[10].ReadOnly   = true;
            firmClientGrid.Columns[11].Visible    = false;
        }