Ejemplo n.º 1
0
        /// <summary>
        /// Guarda|Actualiza un registro del catalogo de FoliosCXC
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        /// <history>
        /// [emoguel] created 22/03/2016
        /// </history>
        private void btnAccept_Click(object sender, RoutedEventArgs e)
        {
            btnAccept.Focus();
            if (ObjectHelper.IsEquals(folioCXC, oldFolioCxc) && enumMode != EnumMode.Add)
            {
                _isClosing = true;
                Close();
            }
            else
            {
                string strMsj = "";
                int    nRes   = 0;
                #region Validar El rango del folio
                if (folioCXC.fiFrom == 0)
                {
                    txtfiFrom.Text = "0";
                    strMsj        += "Start number can not be 0.";
                }
                else
                {
                    if (folioCXC.fiTo < folioCXC.fiFrom)
                    {
                        if (string.IsNullOrWhiteSpace(txtfiTo.Text))
                        {
                            txtfiTo.Text = txtfiFrom.Text;
                        }
                        strMsj += "Start number can not be greater than End Number.";
                    }
                }
                #endregion

                if (strMsj == "")
                {
                    nRes = BRFoliosCXC.SaveFolioCXC(folioCXC, (enumMode == EnumMode.Edit));
                    UIHelper.ShowMessageResult("Folio CxC", nRes);
                    if (nRes == 1)
                    {
                        _isClosing   = true;
                        DialogResult = true;
                        Close();
                    }
                }
                else
                {
                    UIHelper.ShowMessage(strMsj);
                }
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Llena el grid de folios
        /// </summary>
        /// <history>
        /// [emoguel] created 22/03/2016
        /// </history>
        private async void LoadFoliosCXC(FolioCXC folioCxc = null)
        {
            try
            {
                status.Visibility = Visibility.Visible;
                int             nIndex       = 0;
                List <FolioCXC> lstFoliosCXC = await BRFoliosCXC.GetFoliosCXC(_folioFilter, _nStatus);

                dgrFoliosCXC.ItemsSource = lstFoliosCXC;
                if (folioCxc != null && lstFoliosCXC.Count > 0)
                {
                    folioCxc = lstFoliosCXC.Where(fi => fi.fiID == folioCxc.fiID).FirstOrDefault();
                    nIndex   = lstFoliosCXC.IndexOf(folioCxc);
                }
                GridHelper.SelectRow(dgrFoliosCXC, nIndex);
                StatusBarReg.Content = lstFoliosCXC.Count + " Folios.";
                status.Visibility    = Visibility.Collapsed;
            }
            catch (Exception ex)
            {
                UIHelper.ShowMessage(ex);
            }
        }