/// <summary> /// Muestra la ventada detalle /// </summary> /// <param name="sender"></param> /// <param name="e"></param> /// <history> /// [emoguel] created 05/04/2016 /// </history> private void Cell_DoubleClick(object sender, RoutedEventArgs e) { NotBookingMotive notBookingMotive = (NotBookingMotive)dgrNotBokMotives.SelectedItem; frmNotBookingMotiveDetail frmNotBokMotDetail = new frmNotBookingMotiveDetail(); frmNotBokMotDetail.Owner = this; frmNotBokMotDetail.enumMode = (_blnEdit == true) ? EnumMode.Edit : EnumMode.ReadOnly; frmNotBokMotDetail.oldNotBookingMotive = notBookingMotive; if (frmNotBokMotDetail.ShowDialog() == true) { int nIndex = 0; List <NotBookingMotive> lstNotBokMotives = (List <NotBookingMotive>)dgrNotBokMotives.ItemsSource; if (!ValidateFilter(frmNotBokMotDetail.notBookingMotive)) { lstNotBokMotives.Remove(notBookingMotive);//Quitamos el registro de la lista } else { ObjectHelper.CopyProperties(notBookingMotive, frmNotBokMotDetail.notBookingMotive); //Actualizamos los datos del registro lstNotBokMotives.Sort((x, y) => string.Compare(x.nbN, y.nbN)); //Ordenamos la lista nIndex = lstNotBokMotives.IndexOf(notBookingMotive); //Buscamos la posicion del registro } dgrNotBokMotives.Items.Refresh(); //Actualizamos la vista GridHelper.SelectRow(dgrNotBokMotives, nIndex); //Seleccionamos el registro StatusBarReg.Content = lstNotBokMotives.Count + " Not Booking Motives."; } }
/// <summary> /// Abre la ventana detalle en modo Add /// </summary> /// <param name="sender"></param> /// <param name="e"></param> /// <history> /// [emoguel] created 05/04/2016 /// </history> private void btnAdd_Click(object sender, RoutedEventArgs e) { frmNotBookingMotiveDetail frmNotBokMotDetail = new frmNotBookingMotiveDetail(); frmNotBokMotDetail.Owner = this; frmNotBokMotDetail.enumMode = EnumMode.Add; if (frmNotBokMotDetail.ShowDialog() == true) { NotBookingMotive notBookingMotive = frmNotBokMotDetail.notBookingMotive; if (ValidateFilter(notBookingMotive))//verificamos que cumpla con los filtros actuales { List <NotBookingMotive> lstNotBokMotives = (List <NotBookingMotive>)dgrNotBokMotives.ItemsSource; lstNotBokMotives.Add(notBookingMotive); //Agregamos el registro lstNotBokMotives.Sort((x, y) => string.Compare(x.nbN, y.nbN)); //Ordenamos la lista int nIndex = lstNotBokMotives.IndexOf(notBookingMotive); //Obtenemos el index del nuevo registro dgrNotBokMotives.Items.Refresh(); //Actualizamos la vista GridHelper.SelectRow(dgrNotBokMotives, nIndex); //Seleccionamos el nuevo registro StatusBarReg.Content = lstNotBokMotives.Count + " Not Booking Motives."; //Actualizamos el contador } } }