/// <summary> /// Muestra la ventana detalle en modo edit /// </summary> /// <history> /// [emoguel] 28/04/2016 Created /// </history> private void Cell_DoubleClick(object sender, RoutedEventArgs e) { TourTimesSchema tourTimeSchema = (TourTimesSchema)dgrTourTimesSchemas.SelectedItem; frmTourTimeSchemaDetail frmTourTimeSchemaDetail = new frmTourTimeSchemaDetail(); frmTourTimeSchemaDetail.Owner = this; frmTourTimeSchemaDetail.oldTourTimeSchema = tourTimeSchema; frmTourTimeSchemaDetail.enumMode = (_blnEdit) ? EnumMode.Edit : EnumMode.Add; if (frmTourTimeSchemaDetail.ShowDialog() == true) { List <TourTimesSchema> lstTourTimesSchemas = (List <TourTimesSchema>)dgrTourTimesSchemas.ItemsSource; int nIndex = 0; if (ValidateFilter(frmTourTimeSchemaDetail.tourTimeSchema)) //Verificamos que cumpla con los filtros actuales { ObjectHelper.CopyProperties(tourTimeSchema, frmTourTimeSchemaDetail.tourTimeSchema); //Actualizamos los datos del objeto lstTourTimesSchemas.Sort((x, Y) => string.Compare(x.tcN, Y.tcN)); //Reordenamos la lista nIndex = lstTourTimesSchemas.IndexOf(tourTimeSchema); //Obtenemos la posición del registro } else { lstTourTimesSchemas.Remove(tourTimeSchema); //Quitamos el registro } dgrTourTimesSchemas.Items.Refresh(); //Actualizamos la vista GridHelper.SelectRow(dgrTourTimesSchemas, nIndex); //Seleccionamos el registro StatusBarReg.Content = lstTourTimesSchemas.Count + " Schemas."; //Actualizamos el contador } }
/// <summary> /// Abre la ventana detalle en modo Add /// </summary> /// <param name="sender"></param> /// <param name="e"></param> /// <history> /// [emoguel] created 28/04/2016 /// </history> private void btnAdd_Click(object sender, RoutedEventArgs e) { frmTourTimeSchemaDetail frmTourTimeSchema = new frmTourTimeSchemaDetail(); frmTourTimeSchema.Owner = this; frmTourTimeSchema.enumMode = EnumMode.Add; if (frmTourTimeSchema.ShowDialog() == true) { if (ValidateFilter(frmTourTimeSchema.tourTimeSchema))//Validamos que cumpla con los filtros actuales { List <TourTimesSchema> lstTourTimesSchemas = (List <TourTimesSchema>)dgrTourTimesSchemas.ItemsSource; lstTourTimesSchemas.Add(frmTourTimeSchema.tourTimeSchema); //Agregamos el registro lstTourTimesSchemas.Sort((x, y) => string.Compare(x.tcN, y.tcN)); //Reordenamos la lista int nIndex = lstTourTimesSchemas.IndexOf(frmTourTimeSchema.tourTimeSchema); //Buscamos la posicion del registro dgrTourTimesSchemas.Items.Refresh(); //Actualizamos la vista GridHelper.SelectRow(dgrTourTimesSchemas, nIndex); //Seleccionar el registro StatusBarReg.Content = lstTourTimesSchemas.Count + " Schemas"; //Actualizamos el contador } } }