/// <summary> /// Muestra la ventada efficiency detail dependiendo de los permisos /// </summary> /// <param name="sender"></param> /// <param name="e"></param> /// <history> /// [Emoguel] created 18/03/2016 /// </history> private void Cell_DoubleClick(object sender, RoutedEventArgs e) { EfficiencyType efficiencyType = (EfficiencyType)dgrEfcyTypes.SelectedItem; frmEfficiencyTypeDetail frmEfyTypeDetail = new frmEfficiencyTypeDetail(); frmEfyTypeDetail.Owner = this; frmEfyTypeDetail.enumMode = ((_blnEdit == true) ? EnumMode.Edit : EnumMode.ReadOnly); frmEfyTypeDetail.oldEffType = efficiencyType; if (frmEfyTypeDetail.ShowDialog() == true) { int nIndex = 0; List <EfficiencyType> lstEfcyType = (List <EfficiencyType>)dgrEfcyTypes.ItemsSource; if (!ValidateFilter(frmEfyTypeDetail.efficiencyType))//Si cumple con los filtros { lstEfcyType.Remove(efficiencyType); } else { ObjectHelper.CopyProperties(efficiencyType, frmEfyTypeDetail.efficiencyType); lstEfcyType.Sort((x, y) => string.Compare(x.etN, y.etN)); nIndex = lstEfcyType.IndexOf(efficiencyType); } dgrEfcyTypes.Items.Refresh(); GridHelper.SelectRow(dgrEfcyTypes, nIndex); StatusBarReg.Content = lstEfcyType.Count + " Efficiency Types."; } }
/// <summary> /// Abre la ventana detalle en modo add /// </summary> /// <param name="sender"></param> /// <param name="e"></param> /// <history> /// [emoguel] created 18/03/2016 /// </history> private void btnAdd_Click(object sender, RoutedEventArgs e) { frmEfficiencyTypeDetail frmEfyTypeDetail = new frmEfficiencyTypeDetail(); frmEfyTypeDetail.Owner = this; frmEfyTypeDetail.enumMode = EnumMode.Add; if (frmEfyTypeDetail.ShowDialog() == true) { EfficiencyType efficiencyType = frmEfyTypeDetail.efficiencyType; if (ValidateFilter(efficiencyType)) { List <EfficiencyType> lstEfyType = (List <EfficiencyType>)dgrEfcyTypes.ItemsSource; lstEfyType.Add(efficiencyType); lstEfyType.Sort((x, y) => string.Compare(x.etN, y.etN)); int nIndex = lstEfyType.IndexOf(efficiencyType); dgrEfcyTypes.Items.Refresh(); GridHelper.SelectRow(dgrEfcyTypes, nIndex); } } }