Exemple #1
0
        /// <summary>
        /// Abre la ventana detalle en modo "detalle" o "edición" dependiendo de sus permisos
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        /// <history>
        /// [emoguel] created 25/05/2016
        /// </history>
        private void Cell_DoubleClick(object sender, RoutedEventArgs e)
        {
            ScoreRule          scoreRule          = (ScoreRule)dgrScoreRules.SelectedItem;
            frmScoreRuleDetail frmScoreRuleDetail = new frmScoreRuleDetail();

            frmScoreRuleDetail.Owner        = this;
            frmScoreRuleDetail.enumMode     = EnumMode.Edit;
            frmScoreRuleDetail.oldScoreRule = scoreRule;
            if (frmScoreRuleDetail.ShowDialog() == true)
            {
                int nIndex = 0;
                List <ScoreRule> lstScoreRules = (List <ScoreRule>)dgrScoreRules.ItemsSource;
                if (ValidateFilter(frmScoreRuleDetail.scoreRule))                         //Verificamos si cumple con los filtros
                {
                    ObjectHelper.CopyProperties(scoreRule, frmScoreRuleDetail.scoreRule); //Actualizamos el registro
                    lstScoreRules.Sort((x, y) => string.Compare(x.suN, y.suN));           //Reordenamos la lista
                    nIndex = lstScoreRules.IndexOf(scoreRule);                            //BUscamos la posición del index
                }
                else
                {
                    lstScoreRules.Remove(scoreRule);                          //Quitamos el registro
                }
                dgrScoreRules.Items.Refresh();                                //Actualizamos la vista
                GridHelper.SelectRow(dgrScoreRules, nIndex);                  //Seleccionamos el registro
                StatusBarReg.Content = lstScoreRules.Count + " Score Rules."; //Actualizamos el contador
            }
        }
Exemple #2
0
        /// <summary>
        /// Abre la ventana detalle en modo add
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        /// <history>
        /// [emoguel] created 26/05/2016
        /// </history>
        private void btnAdd_Click(object sender, RoutedEventArgs e)
        {
            frmScoreRuleDetail frmScoreRuleDetail = new frmScoreRuleDetail();

            frmScoreRuleDetail.Owner    = this;
            frmScoreRuleDetail.enumMode = EnumMode.Add;
            if (frmScoreRuleDetail.ShowDialog() == true)
            {
                if (ValidateFilter(frmScoreRuleDetail.scoreRule))//Verificamos que cumpla con los filtros
                {
                    List <ScoreRule> lstScoreRules = (List <ScoreRule>)dgrScoreRules.ItemsSource;
                    lstScoreRules.Add(frmScoreRuleDetail.scoreRule);                  //Agregamos el registro
                    lstScoreRules.Sort((x, y) => string.Compare(x.suN, y.suN));       //Ordenamos la lista
                    int nIndex = lstScoreRules.IndexOf(frmScoreRuleDetail.scoreRule); //Buscamos la posición del registro
                    dgrScoreRules.Items.Refresh();                                    //Actualizamos la vista
                    GridHelper.SelectRow(dgrScoreRules, nIndex);                      //Seleccionamos el registro
                    StatusBarReg.Content = lstScoreRules.Count + " Score Rules.";     //Actualizamos el contador
                }
            }
        }