Exemplo n.º 1
0
        /// <summary>
        /// Muestra la ventana detalle en modo edit
        /// </summary>
        /// <history>
        /// [emoguel] 22/04/2016 Created
        /// </history>
        private void Cell_DoubleClick(object sender, RoutedEventArgs e)
        {
            ScoreRuleConcept          scoreRuleConcept   = (ScoreRuleConcept)dgrScoreRulesConcepts.SelectedItem;
            frmScoreRuleConceptDetail frmScoRulConDetail = new frmScoreRuleConceptDetail();

            frmScoRulConDetail.Owner               = this;
            frmScoRulConDetail.enumMode            = EnumMode.Edit;
            frmScoRulConDetail.oldScoreRuleConcept = scoreRuleConcept;
            if (frmScoRulConDetail.ShowDialog() == true)
            {
                int nIndex = 0;
                List <ScoreRuleConcept> lstScoreRulesConcepts = (List <ScoreRuleConcept>)dgrScoreRulesConcepts.ItemsSource;
                if (ValidateFilter(frmScoRulConDetail.scoreRuleConcept))                                //Validamos si cumple con los filtros actuales
                {
                    ObjectHelper.CopyProperties(scoreRuleConcept, frmScoRulConDetail.scoreRuleConcept); //Actualizamos los datos
                    lstScoreRulesConcepts.Sort((x, y) => string.Compare(x.spN, y.spN));                 //Ordenamos la lista
                    nIndex = lstScoreRulesConcepts.IndexOf(scoreRuleConcept);                           //Buscamos la posición del registro
                }
                else
                {
                    lstScoreRulesConcepts.Remove(scoreRuleConcept);                            //Quitamos el registro
                }
                dgrScoreRulesConcepts.Items.Refresh();                                         //Actualizamos la vista
                GridHelper.SelectRow(dgrScoreRulesConcepts, nIndex);                           //Seleccionamos el registro
                StatusBarReg.Content = lstScoreRulesConcepts.Count + " Score Rules Concepts."; //Actualizamos el contador
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// Abre la ventana detalle en modo add
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        /// <history>
        /// [emoguel] created 23/04/2016
        /// </history>
        private void btnAdd_Click(object sender, RoutedEventArgs e)
        {
            frmScoreRuleConceptDetail frmScoRulConDetail = new frmScoreRuleConceptDetail();

            frmScoRulConDetail.Owner    = this;
            frmScoRulConDetail.enumMode = EnumMode.Add;
            if (frmScoRulConDetail.ShowDialog() == true)
            {
                ScoreRuleConcept scoreRuleConcept = frmScoRulConDetail.scoreRuleConcept;
                if (ValidateFilter(scoreRuleConcept))//Validamos si cumple con los filtros actuales
                {
                    List <ScoreRuleConcept> lstScoreRulesConcepts = (List <ScoreRuleConcept>)dgrScoreRulesConcepts.ItemsSource;
                    lstScoreRulesConcepts.Add(scoreRuleConcept);                                   //Agregamos el registro
                    lstScoreRulesConcepts.Sort((x, y) => string.Compare(x.spN, y.spN));            //Ordenamos la lista
                    int nIndex = lstScoreRulesConcepts.IndexOf(scoreRuleConcept);                  //Buscamos la posición del registro
                    dgrScoreRulesConcepts.Items.Refresh();                                         //Actualizamos la vista
                    GridHelper.SelectRow(dgrScoreRulesConcepts, nIndex);                           //Seleccionamos el registro
                    StatusBarReg.Content = lstScoreRulesConcepts.Count + " Score Rules Concepts."; //Actualizamos el contador
                }
            }
        }