/// <summary> /// Muestra la ventana detalle en modo edit /// </summary> /// <history> /// [emoguel] 27/04/2016 Created /// </history> private void Cell_DoubleClick(object sender, RoutedEventArgs e) { object dTeamLog = dgrTeamsLog.SelectedItem; TeamLog teamLog = (TeamLog)dTeamLog.GetType().GetProperty("teamLog").GetValue(dTeamLog, null); frmTeamLogDetail frmTeamLogDetail = new frmTeamLogDetail(); frmTeamLogDetail.Owner = this; frmTeamLogDetail.oldTeamLog = teamLog; frmTeamLogDetail.enumMode = (_blnEdit) ? EnumMode.Edit : EnumMode.ReadOnly; if (frmTeamLogDetail.ShowDialog() == true) { List <object> lstTeamsLog = (List <object>)dgrTeamsLog.ItemsSource; int nIndex = 0; if (ValidateFilter(frmTeamLogDetail.teamLog)) { ObjectHelper.CopyProperties(teamLog, frmTeamLogDetail.teamLog); //Actualizamos los datos lstTeamsLog.Sort((x, y) => DateTime.Compare(Convert.ToDateTime(y.GetType().GetProperty("tlDT").GetValue(y, null)), Convert.ToDateTime(x.GetType().GetProperty("tlDT").GetValue(x, null)))); //Reordenamos la lista nIndex = lstTeamsLog.IndexOf(dTeamLog); //Buscamos la posición del registro } else { lstTeamsLog.Remove(dTeamLog); //Quitamos el registro } dgrTeamsLog.Items.Refresh(); //Actualizamos la vista GridHelper.SelectRow(dgrTeamsLog, nIndex); //Seleccionamos el registro StatusBarReg.Content = lstTeamsLog.Count + " Teams Log."; //Actualizamos el contador } }
/// <summary> /// Abre la ventana de busqueda en modo search /// </summary> /// <param name="sender"></param> /// <param name="e"></param> /// <history> /// [emoguel] created 27/04/2016 /// </history> private void btnSearch_Click(object sender, RoutedEventArgs e) { frmTeamLogDetail frmTeamLogDetail = new frmTeamLogDetail(); frmTeamLogDetail.Owner = this; frmTeamLogDetail.enumMode = EnumMode.Search; frmTeamLogDetail.oldTeamLog = _teamLogFilter; frmTeamLogDetail.blnDate = _blnDate; if (frmTeamLogDetail.ShowDialog() == true) { _teamLogFilter = frmTeamLogDetail.teamLog; _blnDate = frmTeamLogDetail.blnDate; LoadTeamsLog(); } }
/// <summary> /// Abre la ventana detalle en modo Add /// </summary> /// <param name="sender"></param> /// <param name="e"></param> /// <history> /// [emoguel] created 27/04/2016 /// </history> private async void btnAdd_Click(object sender, RoutedEventArgs e) { frmTeamLogDetail frmTeamLogDetail = new frmTeamLogDetail(); frmTeamLogDetail.Owner = this; frmTeamLogDetail.enumMode = EnumMode.Add; if (frmTeamLogDetail.ShowDialog() == true) { TeamLog teamLog = frmTeamLogDetail.teamLog; if (ValidateFilter(teamLog))//Validamos que cumpla con los filtros actuales { var team = await BRTeamsLog.GetTeamsLog(teamLog); object dTeamLog = team.FirstOrDefault(); //Obtenemos el registro nuevo List <object> lstTeamsLog = (List <object>)dgrTeamsLog.ItemsSource; lstTeamsLog.Add(dTeamLog); //Agregamos el registro lstTeamsLog.Sort((x, y) => DateTime.Compare(Convert.ToDateTime(y.GetType().GetProperty("tlDT").GetValue(y, null)), Convert.ToDateTime(x.GetType().GetProperty("tlDT").GetValue(x, null)))); //Reordenamos la lista int nIndex = lstTeamsLog.IndexOf(dTeamLog); //Obtenemos la posición del registro dgrTeamsLog.Items.Refresh(); //Actualizamos la vista GridHelper.SelectRow(dgrTeamsLog, nIndex); //Seleccionamos el registro StatusBarReg.Content = lstTeamsLog.Count + " Teams Log."; //Actualizamos el contador } } }