private void InitializeView(int?Id) { if (Id != null) { var result = classScheduleServices.GetById((int)Id); if (result != null) { LblClassScheduleReview.Content = result.NameBranchOffice + " - " + result.Day + " - " + result.Subject; LblHoraInicio.Content = "Hora Inicio (" + result.StartHour + "):"; LblHoraFin.Content = "Hora Fin (" + result.EndHour + "):"; mkbHoraInicio.Value = result.StartHour; mkbHoraFin.Value = result.EndHour; LblIdTrainer.Content = result.IdTrainer.ToString(); LblIdClass.Content = Id.ToString(); _huella1 = result.HuellaTrainer1; _huella2 = result.HuellaTrainer2; if (result.WeekDay != null) { _DayOfWeek = (int)result.WeekDay; } } #region Fill CmbTRainer // CmbStaf var result0 = _trainer.GetAll().Where(a => a.Active == true).ToList(); CmbTrainer.ItemsSource = result0; result0.Insert(0, new TrainerModel { Id = 0, Name = null }); if (result.IdTrainer != null) { CmbTrainer.SelectedValue = result.IdTrainer.ToString(); } else { CmbTrainer.SelectedIndex = 0; } var result1 = _staff.GetAll().Where(a => a.Active == true).ToList(); result1.Insert(0, new StaffModel { Id = 0, Name = "Seleccione Staff" }); CmbStaf.ItemsSource = result1; #endregion TxtObservacion.Focus(); } }
private void Button_Cancel(object sender, RoutedEventArgs e) { GRDialogConsultation _var = new GRDialogConsultation(); _var.Message = "Desea Cancelar la clase?"; if (_var.ShowDialog() == true) { ClassScheduleReviewModel classScheduleReview = new ClassScheduleReviewModel(); if (!string.IsNullOrEmpty(TxtObservacion.Text.Trim())) { DateTime _date = DateTime.Now; int result = 0; // classScheduleReview.Id = int.Parse(LblId.Content.ToString()); classScheduleReview.IdClassSchedule = int.Parse(LblIdClass.Content.ToString()); classScheduleReview.Observation = TxtObservacion.Text; classScheduleReview.IdStaff = int.Parse(CmbStaf.SelectedValue.ToString()); classScheduleReview.IsTrainer = (LblIdTrainer.Content == CmbTrainer.SelectedValue); //if diferente Trainer then Susititute classScheduleReview.IdTrainer = int.Parse(CmbTrainer.SelectedValue.ToString()); classScheduleReview.Members = int.Parse(intMembers.Text); classScheduleReview.Start = new TimeSpan(_date.Hour, _date.Minute, _date.Second); classScheduleReview.End = new TimeSpan(_date.Hour, _date.Minute, _date.Second); classScheduleReview.Estatus = (int)Constants.StatusClass.CANCELED; result = services.Add(classScheduleReview); //result = task.Result; if (result > 0) { GRDialogInformation _msg = new GRDialogInformation(); _msg.Message = "Clase Cancelada"; _msg.ShowDialog(); this.Close(); } else { GRDialogError _err = new GRDialogError(); _err.Message = "Error guardando datos"; _err.ShowDialog(); } } else { GRDialogInformation _msg0 = new GRDialogInformation(); _msg0.Message = "Debe Ingresar una Observacion"; _msg0.ShowDialog(); TxtObservacion.Focus(); } } }
private void ucGe_Menu_event_btnGuardar_Click(object sender, EventArgs e) { try { if (Validar()) { return; } TxtObservacion.Focus(); Grabar(); } catch (Exception ex) { MessageBox.Show(ex.ToString()); Log_Error_bus.Log_Error(ex.ToString()); } }
public bool Validar() { bool Bandera = false; try { if (TxtObservacion.Text == "") { MessageBox.Show("Ingrese una Observacion ", "Guardar", MessageBoxButtons.OK, MessageBoxIcon.Error); TxtObservacion.Focus(); Bandera = true; return(Bandera); } if (cmbAnioFiscal.Text == "") { MessageBox.Show("Escoja un Año Fiscal ", "Guardar", MessageBoxButtons.OK, MessageBoxIcon.Error); TxtObservacion.Focus(); Bandera = true; return(Bandera); } foreach (var item in ListaGastos) { if (item.Monto_max == 0) { MessageBox.Show("Ingrese Monto Para Cada Item ", "Guardar", MessageBoxButtons.OK, MessageBoxIcon.Error); } } return(Bandera); } catch (Exception ex) { MessageBox.Show(ex.Message); return(Bandera); } }
private void Button_Cierre(object sender, RoutedEventArgs e) { ClassScheduleReviewModel classScheduleReview = new ClassScheduleReviewModel(); if (!string.IsNullOrEmpty(TxtObservacion.Text.Trim())) { if (int.Parse(intMembers.Text.ToString()) > 0) { #region Validar Huella Staff / Cerrar Clase if ( DigitalPersona4500.Instance.Validate( new DigitalPersona4500Template(new System.IO.MemoryStream(_huellaStaff1)), new DigitalPersona4500Template(new System.IO.MemoryStream(_huellaStaff2)))) { DateTime _date = DateTime.Now; bool result = false; classScheduleReview.Id = int.Parse(LblId.Content.ToString()); classScheduleReview.IdClassSchedule = int.Parse(LblIdClass.Content.ToString()); classScheduleReview.Observation = TxtObservacion.Text; classScheduleReview.IdStaff = int.Parse(CmbStaf.SelectedValue.ToString()); classScheduleReview.IsTrainer = (LblIdTrainer.Content == CmbTrainer.SelectedValue); //if diferente Trainer then Susititute classScheduleReview.IdTrainer = int.Parse(CmbTrainer.SelectedValue.ToString()); classScheduleReview.Members = int.Parse(intMembers.Text); classScheduleReview.End = new TimeSpan(_date.Hour, _date.Minute, _date.Second); classScheduleReview.Estatus = (int)Constants.StatusClass.CLOSE; result = services.Update(classScheduleReview); //result = task.Result; if (result) { GRDialogInformation _msg = new GRDialogInformation(); _msg.Message = "Clase Cerrada"; _msg.ShowDialog(); this.Close(); } else { GRDialogError _err = new GRDialogError(); _err.Message = "Error guardando datos"; _err.ShowDialog(); } } else { GRDialogError _err0 = new GRDialogError(); _err0.Message = "Error, Verificando huella"; _err0.ShowDialog(); } #endregion } else { GRDialogInformation _msg1 = new GRDialogInformation(); _msg1.Message = "Debe Ingresar en número de asistentes a la clase"; _msg1.ShowDialog(); intMembers.Focus(); } } else { GRDialogInformation _msg1 = new GRDialogInformation(); _msg1.Message = "Debe Ingresar una Observacion"; _msg1.ShowDialog(); TxtObservacion.Focus(); } }