Beispiel #1
0
        /// <summary>
        /// Muestra la ventada detalle en modo ReadOnly
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        /// <history>
        /// [Emoguel] created 03/03/2016
        /// </history>
        private void Cell_DoubleClick(object sender, RoutedEventArgs e)
        {
            CreditCardType           creditCardType = (CreditCardType)dgrCreditCard.SelectedItem;
            frmCreditCardTypesDetail frmCrediCard   = new frmCreditCardTypesDetail();

            frmCrediCard.Owner         = this;
            frmCrediCard.mode          = ((_blnEdit == true) ? EnumMode.Edit : EnumMode.ReadOnly);
            frmCrediCard.oldCreditCard = creditCardType;
            if (frmCrediCard.ShowDialog() == true)
            {
                int nIndex = 0;
                List <CreditCardType> lstCreditCradTypes = (List <CreditCardType>)dgrCreditCard.ItemsSource;
                if (!ValidateFilters(frmCrediCard.creditCardType)) //Validamos si cumple con los registros
                {
                    lstCreditCradTypes.Remove(creditCardType);     //Quitamos el registro de la lista
                }
                else
                {
                    ObjectHelper.CopyProperties(creditCardType, frmCrediCard.creditCardType);
                    lstCreditCradTypes.Sort((x, y) => string.Compare(x.ccN, y.ccN));//Ordenamos la lista
                    nIndex = lstCreditCradTypes.IndexOf(creditCardType);
                }
                dgrCreditCard.Items.Refresh();//refrescamos la lista
                GridHelper.SelectRow(dgrCreditCard, nIndex);
                StatusBarReg.Content = lstCreditCradTypes.Count + " Credit Card Types.";
            }
        }
Beispiel #2
0
        /// <summary>
        /// Abre la ventana de detalle en modo agregar
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        /// <history>
        /// [Emoguel] created 07/03/2016
        /// </history>
        private void btnAdd_Click(object sender, RoutedEventArgs e)
        {
            frmCreditCardTypesDetail frmCreditCard = new frmCreditCardTypesDetail();

            frmCreditCard.Owner = this;
            frmCreditCard.mode  = EnumMode.Add;
            if (frmCreditCard.ShowDialog() == true)
            {
                if (ValidateFilters(frmCreditCard.creditCardType))//Validamos que cumpla con los filtros
                {
                    List <CreditCardType> lstCreditCradTypes = (List <CreditCardType>)dgrCreditCard.ItemsSource;
                    lstCreditCradTypes.Add(frmCreditCard.creditCardType);                  //Agregamos el registro nuevo
                    lstCreditCradTypes.Sort((x, y) => string.Compare(x.ccN, y.ccN));       //Ordenamos la lista
                    int nIndex = lstCreditCradTypes.IndexOf(frmCreditCard.creditCardType); //Obtenemos el index del registro nuevo
                    dgrCreditCard.Items.Refresh();                                         //refrescamos la lista
                    GridHelper.SelectRow(dgrCreditCard, nIndex);
                    StatusBarReg.Content = lstCreditCradTypes.Count + " Credit Card Types.";
                }
            }
        }