private void buttonGuardar_Click(object sender, EventArgs e) { try { if (FormValidate()) { DepartamentML Departament = new DepartamentML(); Departament.Name = textBoxNombre.Text; Departament.Manager = textBoxEncargado.Text; Departament.Description = textBoxDescripcion.Text; if (IdDepartament > 0) { Departament.Id = IdDepartament; } DepartamentBLL.Save(Departament); cFMDE100010 FrmDataGrid = this.Owner as cFMDE100010; FrmDataGrid.LoadDataGridView(); cFAT100010 Alert = new cFAT100010("Información", "Información Guardado con exito!!", MessageBoxIcon.Information); Alert.ShowDialog(); Clear(); this.Close(); } } catch (Exception ex) { MessageBox.Show(String.Format("buttonGuardar_Click: {0}", ex.Message), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void buttonGuardar_Click(object sender, EventArgs e) { try { if (FormValidate()) { AbsenteeismML Absenteeism = new AbsenteeismML(); Absenteeism.IsKey = textBoxClave.Text; Absenteeism.Concept = textBoxConcepto.Text; Absenteeism.description = textBoxDescripcion.Text; if (IdAbsenteeism > 0) { Absenteeism.Id = IdAbsenteeism; } AbsenteeismBLL.Save(Absenteeism); cFMCO100010 FrmDataGrid = this.Owner as cFMCO100010; FrmDataGrid.LoadDataGridView(); cFAT100010 Alert = new cFAT100010("Información", "Información Guardado con éxito!!", MessageBoxIcon.Information); Alert.ShowDialog(); Clear(); this.Close(); } } catch (Exception ex) { MessageBox.Show(String.Format("buttonGuardar_Click: {0}", ex), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void buttonEliminar_Click(object sender, EventArgs e) { try { if (dataGridViewDepartamento.RowCount > 0) { IdRowSelect = dataGridViewDepartamento.CurrentRow.Index; int idDepartament = Int32.Parse(dataGridViewDepartamento.Rows[IdRowSelect].Cells["Id"].Value.ToString()); cFAT100010 Alert = new cFAT100010("Información", String.Format("¿Desea eliminar el registro {0}?", idDepartament), MessageBoxIcon.Question); Alert.ShowDialog(); if (Alert.DialogResult == DialogResult.Yes) { DepartamentML Departament = new DepartamentML { Id = idDepartament, }; DepartamentBLL.Delete(Departament); dataGridViewDepartamento.Rows.Remove(dataGridViewDepartamento.CurrentRow); } } else { cFAT100010 Alert = new cFAT100010("Información", "No hay datos", MessageBoxIcon.Information); Alert.ShowDialog(); } } catch (Exception ex) { MessageBox.Show(String.Format("buttonEliminar_Click: {0}", ex), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
public void LoadObject(int IdObject) { try { EmployeeBLL EmployeeBLL = new EmployeeBLL(); if (EmployeeBLL.GetIdEntity(IdObject) != null) { EmployeeML Employee = EmployeeBLL.GetIdEntity(IdObject); textBoxNumControl.Text = Employee.Id.ToString(); textBoxNombre.Text = Employee.Name.ToString(); textBoxApellidoP.Text = Employee.LastName.ToString(); DepartamentBLL DepartamentBLL = new DepartamentBLL(); DepartamentML Departament = DepartamentBLL.GetIdEntity(Employee.IdDepartament); textBoxDepartamento.Text = Departament.Name.ToString(); JobBLL JobBLL = new JobBLL(); JobML Job = JobBLL.GetIdEntity(Employee.IdJob); textBoxPuesto.Text = Job.Name; } else { cFAT100010 Alert = new cFAT100010("Información", "El empleado no existe", MessageBoxIcon.Information); Alert.ShowDialog(); } } catch (Exception ex) { MessageBox.Show(String.Format("LoadObject: {0}", ex), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void buttonUser_Click(object sender, EventArgs e) { try { if (dataGridViewDataEmpleado.RowCount > 0) { cFMEM120010 Catalogo = new cFMEM120010(); AddOwnedForm(Catalogo); Catalogo.FormBorderStyle = FormBorderStyle.None; Catalogo.TopLevel = false; Catalogo.Dock = DockStyle.Fill; this.Controls.Add(Catalogo); this.Tag = Catalogo; Catalogo.BringToFront(); Catalogo.Show(); } else { cFAT100010 Alert = new cFAT100010("Información", "No hay datos", MessageBoxIcon.Information); Alert.ShowDialog(); } } catch (Exception ex) { MessageBox.Show(String.Format("buttonUser_Click: {0}", ex), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void buttonSeleccionar_Click(object sender, EventArgs e) { try { if (dataGridViewDataEmpleado.RowCount > 0) { IdRowSelect = dataGridViewDataEmpleado.CurrentRow.Index; if (IdRowSelect >= 0) { Forms.cFMAA110010 Catalogo = this.Owner as Forms.cFMAA110010; int IdObject = Int32.Parse(dataGridViewDataEmpleado.Rows[IdRowSelect].Cells["Id"].Value.ToString()); //Catalogo.IdOject = IdObject; Catalogo.LoadObject(IdObject); this.Close(); } else { cFAT100010 Alert = new cFAT100010("Información", "No tiene Seleccionado un Empleado", MessageBoxIcon.Information); Alert.ShowDialog(); } } else { cFAT100010 Alert = new cFAT100010("Información", "No hay datos registrados", MessageBoxIcon.Information); Alert.ShowDialog(); } } catch (Exception ex) { MessageBox.Show(String.Format("buttonSeleccionar_Click: {0}", ex), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void buttonEditar_Click(object sender, EventArgs e) { try { if (dataGridViewData.RowCount > 0) { IdRowSelect = dataGridViewData.CurrentRow.Index; if (IdRowSelect >= 0) { cFMTU110010 Catalogo = new cFMTU110010() { IdTurn = Int32.Parse(dataGridViewData.Rows[IdRowSelect].Cells[TurnML.DataBase.Id].Value.ToString()) }; AddOwnedForm(Catalogo); Catalogo.FormBorderStyle = FormBorderStyle.None; Catalogo.TopLevel = false; Catalogo.Dock = DockStyle.Fill; this.Controls.Add(Catalogo); this.Tag = Catalogo; Catalogo.BringToFront(); Catalogo.Show(); } else { cFAT100010 Alert = new cFAT100010("Información", "No tiene Seleccionado un Turno", MessageBoxIcon.Information); Alert.ShowDialog(); } } else { cFAT100010 Alert = new cFAT100010("Información", "No hay datos", MessageBoxIcon.Information); Alert.ShowDialog(); } } catch (Exception ex) { MessageBox.Show(String.Format("buttonEditar_Click: {0}", ex), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void buttonGuardar_Click(object sender, EventArgs e) { try { if (FormValidate()) { TurnML Turn = new TurnML() { Name = textBoxTurno.Text, Description = textBoxDescripcion.Text, TimeEntry = dateTimeHoraEntrada.Value, StartEntry = dateTimeIniciaEntrada.Value, LimitEntry = dateTimeLimiteEntrada.Value, Departuretime = dateTimeHoraSalida.Value, LimitDeparture = dateTimeLimiteSalida.Value, HoursJornada = Convert.ToDateTime(textBoxHorasJornada.Text) }; if (IdTurn > 0) { Turn.Id = IdTurn; } TurnBLL.Save(Turn); cFMTU100010 FrmDataGrid = this.Owner as cFMTU100010; FrmDataGrid.LoadDataGridView(); cFAT100010 Alert = new cFAT100010("Información", "Información Guardado con exito!!", MessageBoxIcon.Information); Alert.ShowDialog(); Clear(); this.Close(); } } catch (Exception ex) { MessageBox.Show(String.Format("buttonGuardar_Click: {0}", ex), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void buttonEditar_Click(object sender, EventArgs e) { try { if (dataGridViewDepartamento.RowCount > 0) { IdRowSelect = dataGridViewDepartamento.CurrentRow.Index; if (IdRowSelect >= 0) { cFMDE110010 Catalogo = new cFMDE110010(); Catalogo.IdDepartament = Int32.Parse(dataGridViewDepartamento.Rows[IdRowSelect].Cells["Id"].Value.ToString()); Catalogo.textBoxNombre.Text = dataGridViewDepartamento.Rows[IdRowSelect].Cells["Nombre"].Value.ToString(); Catalogo.textBoxEncargado.Text = dataGridViewDepartamento.Rows[IdRowSelect].Cells["Encargado"].Value.ToString(); Catalogo.textBoxDescripcion.Text = dataGridViewDepartamento.Rows[IdRowSelect].Cells["Descripcion"].Value.ToString(); AddOwnedForm(Catalogo); Catalogo.FormBorderStyle = FormBorderStyle.None; Catalogo.TopLevel = false; Catalogo.Dock = DockStyle.Fill; this.Controls.Add(Catalogo); this.Tag = Catalogo; Catalogo.BringToFront(); Catalogo.Show(); } else { cFAT100010 Alert = new cFAT100010("Información", "No tiene Seleccionado un Departamento", MessageBoxIcon.Information); Alert.ShowDialog(); } } else { cFAT100010 Alert = new cFAT100010("Información", "No hay datos", MessageBoxIcon.Information); Alert.ShowDialog(); } }catch (Exception ex) { MessageBox.Show(String.Format("buttonEditar_Click: {0}", ex), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void buttonGuardar_Click(object sender, EventArgs e) { try { if (FormValidate()) { AbsenteeismAssignmentML AsigAusentismo = new AbsenteeismAssignmentML { ControlNumber = textBoxNumControl.Text.ToString(), KeyAbsenteeism = comboBoxAusentismo.SelectedValue.ToString(), Status = comboBoxEstadoAsig.SelectedValue.ToString(), DateStar = dateTimeFechaInicio.Value, DateEnd = dateTimeFechaFin.Value, Description = textBoxDescripcion.Text }; if (IdAbsenteeismAssignment > 0) { AsigAusentismo.Id = IdAbsenteeismAssignment; } AbsenteeismAssignmentBLL.Save(AsigAusentismo); cFMAA100010 FrmDataGrid = this.Owner as cFMAA100010; FrmDataGrid.LoadDataGridView(); cFAT100010 Alert = new cFAT100010("Información", "Información Guardado con éxito!!", MessageBoxIcon.Information); Alert.ShowDialog(); Clear(); this.Close(); } } catch (Exception ex) { MessageBox.Show(String.Format("buttonGuardar_Click: {0}", ex), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void buttonGuardar_Click(object sender, EventArgs e) { try { if (FormValidate()) { JobML Job = new JobML(); Job.Name = textBoxPuesto.Text; Job.Description = textBoxDescripcion.Text; if (IdJob > 0) { Job.Id = IdJob; Job.Name = textBoxPuesto.Text; Job.Description = textBoxDescripcion.Text; //Job.IdUserUpdate = 1; } JobBLL.Save(Job); cFMPU100010 FrmDataGrid = this.Owner as cFMPU100010; FrmDataGrid.LoadDataGridView(); cFAT100010 Alert = new cFAT100010("Información", "Información Guardado con exito!!", MessageBoxIcon.Information); Alert.ShowDialog(); Clear(); this.Close(); } } catch (Exception ex) { MessageBox.Show(String.Format("buttonGuardar_Click: {0}", ex), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void buttonGuardar_Click(object sender, EventArgs e) { try { if (FormValidate()) { CompanyBLL CompanyBLL = new CompanyBLL(); CompanyML Company = CompanyBLL.GetEntity(); UsersML User = new UsersML { UserName = textBoxUsuario.Text, Password = textBoxPassword.Text, Image = System.IO.Path.GetFileName(PathFileNameTextBox.Text), Rol = int.Parse(comboBoxRol.SelectedValue.ToString()) }; if (IdUser > 0) { User.Id = IdUser; } UsersBLL UsersBALL = new UsersBLL(); EmployeeML Employee = new EmployeeML { RFC = textBoxRfc.Text, Curp = textBoxCurp.Text, Name = textBoxNombre.Text, LastName = textBoxApellidos.Text, Scholarship = comboBoxEscolaridad.SelectedValue.ToString(), Birthdate = dateTimeFechaNacimiento.Value, Nationality = textBoxNacionalidad.Text, Address = textBoxCalle.Text, Municipality = textBoxMunicipio.Text, Country = textBoxPais.Text, Email = textBoxEmail.Text, Telephone = textBoxTelefono.Text, CivilStatus = comboBoxEstadoCivil.SelectedValue.ToString(), PostalCode = (String.IsNullOrEmpty(textBoxCodigoPostal.Text))?0: int.Parse(textBoxCodigoPostal.Text), Colony = textBoxColonia.Text, StateCountry = textBoxEstado.Text, AdmissionDate = dateTimeFechaIngreso.Value, IdDepartament = Int32.Parse(comboBoxDepartamento.SelectedValue.ToString()), IdJob = Int32.Parse(comboBoxPuesto.SelectedValue.ToString()), SureType = comboBoxTipoSeguro.SelectedValue.ToString(), NumberSure = textBoxNumSeguro.Text, Salary = Convert.ToDecimal(textBoxSueldo.Text), HoursDay = Convert.ToDateTime(textBoxNumHours.Text), }; if (radioButtonHombre.Checked) { Employee.Gender = "Hombre"; } else { Employee.Gender = "Mujer"; } if (IdEmployee > 0) { Employee.Id = IdEmployee; } Employee.IdUser = UsersBALL.Save(User); EmployeeBLL EmployeeBLL = new EmployeeBLL(); int IdNewEmployee = EmployeeBLL.Save(Employee); DaysOfWorkEmployeeBLL DaysOfWorkEmployeeBLL = new DaysOfWorkEmployeeBLL(); DaysOfWorkEmployeeBLL.DeleteRegistrys(IdEmployee); foreach (object item in checkedListBoxDias.CheckedItems) { DaysOfWorkEmployeeML DaysOfWorkEmployee = new DaysOfWorkEmployeeML() { IdDays = Int32.Parse(item.GetType().GetProperty("Value").GetValue(item, null).ToString()), IdEmployee = IdNewEmployee }; DaysOfWorkEmployeeBLL.Save(DaysOfWorkEmployee); } TurnsOfEmployeeBLL TurnsOfEmployeeBLL = new TurnsOfEmployeeBLL(); TurnsOfEmployeeBLL.DeleteRegistrys(IdEmployee); foreach (object item in checkedListBoxTurns.CheckedItems) { TurnsOfEmployeeML TurnsOfEmployee = new TurnsOfEmployeeML() { IdTurn = Int32.Parse(item.GetType().GetProperty("Value").GetValue(item, null).ToString()), IdEmployee = IdNewEmployee, IdUserInsert = GlobalBLL.userML.Id }; TurnsOfEmployeeBLL.Save(TurnsOfEmployee); } if (!string.IsNullOrEmpty(PathFileNameTextBox.Text) && !string.IsNullOrEmpty(PathFileImage) && System.IO.Path.GetFileName(PathFileImageOld) != PathFileImage) { if (!System.IO.Directory.Exists(DirectoryFiles)) { System.IO.Directory.CreateDirectory(DirectoryFiles); } System.IO.File.Delete(string.Format("{0}/{1}", DirectoryFiles, PathFileNameTextBox.Text)); System.IO.File.Copy(PathFileImage, string.Format("{0}/{1}", DirectoryFiles, System.IO.Path.GetFileName(PathFileNameTextBox.Text))); } ZKTecoDeviceBLL zKTecoDevice = new ZKTecoDeviceBLL(); BiometricCore.UserInfo _userInfo = new BiometricCore.UserInfo() { EnrollNumber = string.Format("{0}", IdNewEmployee), Name = Employee.Name, Privelage = (int)BiometricCore.Enums.Privileges.CommonUser, TmpData = "", Password = string.Format("{0}", IdNewEmployee) }; zKTecoDevice.SetUserInfo(_userInfo, Convert.ToInt32(Company.NumberUserEmploye)); cFMEM100010 FrmDataGrid = this.Owner as cFMEM100010; FrmDataGrid.LoadDataGridView(); cFAT100010 Alert = new cFAT100010("Información", "Información Guardado con exito!!", MessageBoxIcon.Information); Alert.ShowDialog(); Alert.Dispose(); Clear(); this.Close(); } } catch (Exception ex) { MessageBox.Show(String.Format("buttonGuardar_Click: {0}", ex.Message), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }