コード例 #1
0
        /// <summary>
        /// Llena los combobox de series
        /// </summary>
        /// <history>
        /// [emoguel] created 09/05/2016
        /// </history>
        private async void loadSeries()
        {
            try
            {
                List <string> lstSeries = await BRFoliosInvitationsOuthousePR.GetSeriesFolioOuthouse();

                cmbSerieA.ItemsSource = lstSeries;
                cmbSerieB.ItemsSource = lstSeries;
            }
            catch (Exception ex)
            {
                UIHelper.ShowMessage(ex);
            }
        }
コード例 #2
0
        /// <summary>
        /// Valida los datos de los folios cancelados
        /// </summary>
        /// <param name="lstFoliosCancell">Lista a validar</param>
        /// <param name="lstFoliosPR">Lista de FOlios a asignar</param>
        /// <returns>Cadena de texto</returns>
        /// <history>
        /// [emoguel] created 09/05/2016
        /// </history>
        private string ValidateCancelled(List <FolioInvitationOuthousePRCancellation> lstFoliosCancell, List <FolioInvitationOuthousePR> lstFoliosPR)
        {
            string strMsj = "";
            int    nIndex = 0;
            ValidationFolioData validate;

            foreach (FolioInvitationOuthousePRCancellation folio in lstFoliosCancell)
            {
                nIndex = lstFoliosCancell.IndexOf(folio);
                if (string.IsNullOrWhiteSpace(folio.ficSerie))
                {
                    GridHelper.SelectRow(dgrCancelled, nIndex, 0, true);
                    strMsj = "Serie is a required value, cannot be empty.";
                }
                else if (folio.ficrcf == null)
                {
                    GridHelper.SelectRow(dgrCancelled, nIndex, 3, true);
                    strMsj = "Reason is a required value, cannot be empty.";
                    break;
                }
                else if (folio.ficFrom == 0 || folio.ficTo == 0)
                {
                    GridHelper.SelectRow(dgrCancelled, nIndex, 0, true);
                    strMsj = "Values must be greatter than 0";
                    break;
                }
                else if (folio.ficTo <= folio.ficFrom)
                {
                    GridHelper.SelectRow(dgrCancelled, nIndex, 1, true);
                    strMsj = "From value must be greatter or equal than To value.";
                    break;
                }
                else if (!ValidateFoliosRange(lstFoliosPR, folio))
                {
                    GridHelper.SelectRow(dgrCancelled, nIndex, 0, true);
                    strMsj = "The range of the canceled folios must be in the range of the asigned folios.";
                    break;
                }

                validate = BRFoliosInvitationsOuthousePR.ValidateFolio(personnel.peID, folio.ficSerie, folio.ficFrom, folio.ficTo, true);
                if (validate.Result == 1)
                {
                    GridHelper.SelectRow(dgrAssigned, nIndex, 0, true);
                    strMsj = "There is a PR with same Folio, check PR: " + validate.PR.ToString();
                    break;
                }
            }
            return(strMsj);
        }
コード例 #3
0
        /// <summary>
        /// Carga el grid de asignados
        /// </summary>
        /// <history>
        /// [emoguel] created 09/05/2016
        /// </history>
        private async void LoadFoliosByPr()
        {
            try
            {
                List <FolioInvitationOuthousePR> lstFolios = await BRFoliosInvitationsOuthousePR.GetFoliosByPr(personnel.peID);

                _lstFolios = await BRFoliosInvitationsOuthousePR.GetFoliosByPr(personnel.peID);

                dgrAssigned.ItemsSource = lstFolios;
            }
            catch (Exception ex)
            {
                UIHelper.ShowMessage(ex);
            }
        }
コード例 #4
0
        /// <summary>
        /// valida que los en rango de registros exista en FOlios Invitation outhouse
        /// </summary>
        /// <param name="lstFolios">Lista de folios a validar</param>
        /// <returns>cadena de texto</returns>
        /// <history>
        /// [emoguel] created
        /// </history>
        private string ValidateFolioOuthouse(List <FolioInvitationOuthousePR> lstFolios)
        {
            string strMsj = "";
            int    nIndex = 0;
            ValidationFolioData validate;

            foreach (FolioInvitationOuthousePR folio in lstFolios)
            {
                nIndex = lstFolios.IndexOf(folio);
                if (string.IsNullOrWhiteSpace(folio.fipSerie))
                {
                    GridHelper.SelectRow(dgrAssigned, nIndex, 0, true);
                    strMsj = "Serie is a required value, cannot be empty.";
                }
                else if (folio.fipFrom == 0 || folio.fipTo == 0)
                {
                    GridHelper.SelectRow(dgrAssigned, nIndex, 1, true);
                    strMsj = "Values must be greatter than 0.";
                    break;
                }
                else if (folio.fipTo <= folio.fipFrom)
                {
                    GridHelper.SelectRow(dgrAssigned, nIndex, 2, true);
                    strMsj = "From value must be greatter or equal than To value.";
                    break;
                }
                else if (!BRFoliosInvitationsOuthousePR.ValidateFolioRange(folio.fipSerie, folio.fipFrom, folio.fipTo))
                {
                    GridHelper.SelectRow(dgrAssigned, nIndex, 0, true);
                    strMsj = "The assigned range does not exists in the Folios Invitations Outhouse catalog.";
                    break;
                }
                validate = BRFoliosInvitationsOuthousePR.ValidateFolio(personnel.peID, folio.fipSerie, folio.fipFrom, folio.fipTo, false);
                if (validate.Result == 1)
                {
                    GridHelper.SelectRow(dgrAssigned, nIndex, 0, true);
                    strMsj = "There is a PR with same Folio and Serie, check PR: " + validate.PR.ToString();
                    break;
                }
            }
            return(strMsj);
        }
コード例 #5
0
        /// <summary>
        /// Llena el grid de personnels
        /// </summary>
        /// <param name="personnel">Objeto a seleccionar</param>
        /// <history>
        /// [emoguel] created 07/05/2016
        /// </history>
        private async void LoadPrs(PersonnelShort personnel = null)
        {
            try
            {
                status.Visibility = Visibility.Visible;
                int nIndex = 0;
                List <PersonnelShort> lstPersonnel = await BRFoliosInvitationsOuthousePR.GetPRbyFolioOuthouse(_prFilter);

                dgrPRs.ItemsSource = lstPersonnel;
                if (lstPersonnel.Count > 0 && personnel != null)
                {
                    personnel = lstPersonnel.Where(pe => pe.peID == personnel.peID).FirstOrDefault();
                    nIndex    = lstPersonnel.IndexOf(personnel);
                }
                GridHelper.SelectRow(dgrPRs, nIndex);
                StatusBarReg.Content = lstPersonnel.Count + " PRs.";
                status.Visibility    = Visibility.Collapsed;
            }
            catch (Exception ex)
            {
                UIHelper.ShowMessage(ex);
            }
        }
コード例 #6
0
        /// <summary>
        /// Agrega|Actualiza Folios
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        /// <history>
        /// [emoguel] created 07/05/2016
        /// </history>
        private async void btnAccept_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                btnAccept.Focus();
                #region Save
                if (enumMode != EnumMode.Search)
                {
                    #region ValidateChanges
                    List <FolioInvitationOuthousePR>             lstFoliosPR  = (List <FolioInvitationOuthousePR>)dgrAssigned.ItemsSource;
                    List <FolioInvitationOuthousePRCancellation> lstFoliosCan = (List <FolioInvitationOuthousePRCancellation>)dgrCancelled.ItemsSource;
                    bool blnHasChanged = ValidateChanges(lstFoliosPR, lstFoliosCan);

                    #endregion
                    if (enumMode != EnumMode.Add && !blnHasChanged)
                    {
                        blnClosing = true;
                        Close();
                    }
                    else
                    {
                        txtStatus.Text       = "Saving Data";
                        skpStatus.Visibility = Visibility.Visible;
                        PersonnelShort personnelSave = (PersonnelShort)cmbPersonnel.SelectedItem;
                        if (personnelSave != null)
                        {
                            string strMsj = "";

                            #region ListFolios
                            if (enumMode == EnumMode.Add)
                            {
                                var folio = await BRFoliosInvitationsOuthousePR.GetPRbyFolioOuthouse(personnelSave);

                                if (folio.FirstOrDefault() != null)
                                {
                                    UIHelper.ShowMessage("The current PR already has folios, edit the correspoding PR.");
                                    return;
                                }
                                if (lstFoliosPR.Count == 0)
                                {
                                    UIHelper.ShowMessage("Cannot save an empty record, please add folios..");
                                    return;
                                }
                            }
                            #endregion
                            #region FoliosPR
                            strMsj = ValidateFolioOuthouse(lstFoliosPR);
                            if (strMsj != "")
                            {
                                UIHelper.ShowMessage(strMsj);
                                return;
                            }
                            strMsj = ValidateCancelled(lstFoliosCan, lstFoliosPR);
                            if (strMsj != "")
                            {
                                UIHelper.ShowMessage(strMsj);
                                return;
                            }

                            int nRes = await BRFoliosInvitationsOuthousePR.SaveFoliosOuthousePR(personnelSave.peID, lstFoliosPR, lstFoliosCan);

                            UIHelper.ShowMessageResult("Folios", nRes);
                            if (nRes > 0)
                            {
                                blnClosing   = true;
                                DialogResult = true;
                                Close();
                            }

                            #endregion
                        }
                        skpStatus.Visibility = Visibility.Collapsed;
                    }
                }
                #endregion
                #region Search
                else
                {
                    #region Search
                    if (cmbPersonnel.SelectedItem != null)
                    {
                        personnel    = (PersonnelShort)cmbPersonnel.SelectedItem;
                        DialogResult = true;
                        Close();
                    }
                    else if (!string.IsNullOrWhiteSpace(personnel.peID))
                    {
                        cmbPersonnel.Focus();
                        UIHelper.ShowMessage("Please select a PR.");
                    }
                    else
                    {
                        Close();
                    }
                    #endregion
                }
                #endregion
            }
            catch (Exception ex)
            {
                UIHelper.ShowMessage(ex);
            }
        }