Пример #1
0
        private void Button1_Click(object sender, EventArgs e)
        {
            Controlador c = new Controlador();

            if (Form1.tipo_e == "FullTimeEmployee")
            {
                Shared.Entities.FullTimeEmployee flte = new Shared.Entities.FullTimeEmployee()
                {
                    Id        = Form1.id_e,
                    Name      = Name.Text,
                    StartDate = date.Value,
                    Salary    = Int32.Parse(atr.Text)
                };
                c.UpdateEmployee(flte);
            }
            else
            {
                Shared.Entities.PartTimeEmployee flte = new Shared.Entities.PartTimeEmployee()
                {
                    Id         = Form1.id_e,
                    Name       = Name.Text,
                    StartDate  = date.Value,
                    HourlyRate = Int32.Parse(atr.Text)
                };
                c.UpdateEmployee(flte);
            }
            this.Close();
        }
Пример #2
0
        private void Button1_Click(object sender, EventArgs e)
        {
            Controlador c = new Controlador();

            if (comboBox1.Text == "FullTimeEmployee")
            {
                Shared.Entities.FullTimeEmployee fte = new Shared.Entities.FullTimeEmployee()
                {
                    Name      = Name.Text,
                    StartDate = dateTimePicker1.Value,
                    Salary    = Int32.Parse(Salary.Text),
                };
                c.AddEmployee(fte);
            }
            else
            {
                Shared.Entities.PartTimeEmployee fte = new Shared.Entities.PartTimeEmployee()
                {
                    Name       = Name.Text,
                    StartDate  = dateTimePicker1.Value,
                    HourlyRate = Int32.Parse(Rate.Text),
                };
                c.AddEmployee(fte);
            }
            this.Close();
        }
Пример #3
0
 private void Button3_Click(object sender, EventArgs e)
 {
     if (dataGridView1.SelectedRows.Count != 0)
     {
         DataGridViewRow row = this.dataGridView1.SelectedRows[0];
         int             id  = (int)row.Cells[0].Value;
         Controlador     c   = new Controlador();
         c.DeleteEmployee(id);
         this.employeesTableAdapter.ClearBeforeFill = true;
         this.employeesTableAdapter.Fill(this.practico_EntregableDataSet.EmployeesTPH);
     }
 }
Пример #4
0
        private void datos()
        {
            Controlador c       = new Controlador();
            Employee    empEdit = c.GetEmployee(Form1.id_e);

            if (empEdit.GetType().Name == "FullTimeEmployee")
            {
                Atributo.Text = "Salary:";
                Shared.Entities.FullTimeEmployee edit = (Shared.Entities.FullTimeEmployee)empEdit;
                Name.Text  = edit.Name;
                date.Value = edit.StartDate;
                atr.Text   = edit.Salary.ToString();
                Tipo.Text  = "FullTimeEmployee";
            }
            else
            {
                Atributo.Text = "Hourly Rate:";
                Shared.Entities.PartTimeEmployee edit = (Shared.Entities.PartTimeEmployee)empEdit;
                Name.Text  = edit.Name;
                date.Value = edit.StartDate;
                atr.Text   = edit.HourlyRate.ToString();
                Tipo.Text  = "PartTimeEmployee";
            }
        }