Esempio n. 1
0
        /// <summary>
        /// Carga e incializa las variables
        /// </summary>
        /// <history>
        /// [jorcanche] 02/02/2016 Created
        /// [erosado] 19/05/2016  Modified. Se agregó asincronía
        /// </history>
        private async void Window_Loaded(object sender, RoutedEventArgs e)
        {
            //Indicamos al statusbar que me muestre cierta informacion cuando oprimimos cierto teclado
            KeyboardHelper.CkeckKeysPress(StatusBarCap, Key.Capital);
            KeyboardHelper.CkeckKeysPress(StatusBarIns, Key.Insert);
            KeyboardHelper.CkeckKeysPress(StatusBarNum, Key.NumLock);
            //Cargamos los datos del huesped
            _guest = await BRGuests.GetGuest(_guestId);

            EnabledControls(true, true, false);
            //Cargamos los PR
            cbopnPR.ItemsSource = await BRPersonnel.GetPersonnel(Context.User.Location.loID, "ALL", "PR");

            // desplegamos los datos del huesped
            txtguID.Text         = _guest.guID.ToString();
            txtguLastName1.Text  = _guest.guLastName1;
            txtguFirstName1.Text = _guest.guFirstName1;
            txtguCheckInD.Text   = _guest.guCheckInD.ToString("dd/MM/yyyy");
            txtguCheckOutD.Text  = _guest.guCheckOutD.ToString("dd/MM/yyyy");

            //Cargamos el datagrid
            _pRNoteViewSource        = (CollectionViewSource)FindResource("pRNoteViewSource");
            _pRNoteViewSource.Source = await BRNotes.GetNoteGuest(_guestId);

            //Si no tiene ninguna nota se inhabilita el control
            if (dgNotes.Items.Count < 1)
            {
                btnShowInfo.IsEnabled = false;
            }
        }
Esempio n. 2
0
        /// <summary>
        /// Carga e inicializa las variables
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        /// <history>
        /// [jorcanche] created  05/03/016
        /// [erosado] 19/05/2016  Modified. Se agregó asincronía
        /// </history>
        private async void Window_Loaded(object sender, RoutedEventArgs e)
        {
            Mouse.OverrideCursor = Cursors.Wait;
            _guest = await BRGuests.GetGuest(_guestID);

            LoadContact();
        }
Esempio n. 3
0
        /// <summary>
        /// Obtiene los Guests By PR
        /// </summary>
        /// <param name="dateFrom">fecha inicial</param>
        /// <param name="dateTo">fecha final</param>
        /// <param name="leadSources">LeadoSource</param>
        /// <param name="PR">Pr</param>
        /// <param name="filters">Filters</param>
        /// <history>
        /// [erosado]       16/Mar/2016 Created
        /// [edgrodriguez]  26/Sep/2016 Modified. Se agrega el parámetro Program.
        /// </history>
        public async void DoGetGuestsByPR(DateTime dateFrom, DateTime dateTo, string leadSources, string program, string PR, List <bool> filters)
        {
            try
            {
                var data = await BRGuests.GetGuestsByPR(dateFrom, dateTo, leadSources, program, PR, filters);

                if (data.Count > 0)
                {
                    dtgr.DataContext     = data;
                    StatusBarReg.Content = $"{(dtgr.SelectedIndex + 1).ToString()}/{dtgr.Items.Count.ToString()}";
                }
                else
                {
                    UIHelper.ShowMessage("There is no data");
                    dtgr.DataContext = null;
                }
                StaEnd();
                imgButtonOk.IsEnabled    = true;
                imgButtonPrint.IsEnabled = true;
            }
            catch (Exception ex)
            {
                StaEnd();
                imgButtonOk.IsEnabled = true;
                UIHelper.ShowMessage(ex);
            }
        }
Esempio n. 4
0
        private async void btnSave_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                if (Validate())
                {
                    //guardamos la informacion de disponibilidad
                    _guest.guum          = txtguum.Text != string.Empty ? Convert.ToByte(txtguum.Text) : (byte)0;
                    _guest.guOriginAvail = chkguOriginAvail.IsChecked.Value;
                    _guest.guAvail       = chkguAvail.IsChecked.Value;
                    _guest.guPRAvail     = cboguPRAvail.SelectedValue == null ? _user.User.peID : cboguPRAvail.SelectedValue.ToString();

                    //Enviamos los parametros para que guarde los cambios del guest y el log del Guest.
                    //Si hubo un erro al ejecutar el metodo SaveChangedOfGuest nos devolvera 0, indicando que ningun paso
                    //se realizo, es decir ni se guardo el Guest ni el Log, y siendo así ya no modificamos la variable
                    //_wasSaved que es el que indica que se guardo el Avail.
                    if (await BRGuests.SaveChangedOfGuest(_guest, Context.User.LeadSource.lsHoursDif, _user.User.peID) != 0)
                    {
                        WasSaved = true;
                    }
                    else
                    {
                        //De no ser así informamos que no se guardo la información por algun motivo
                        UIHelper.ShowMessage("There was an error saving the information, consult your system administrator",
                                             MessageBoxImage.Error, "Information can not keep");
                    }
                    Close();
                }
            }
            catch (Exception ex)
            {
                UIHelper.ShowMessage(ex);
            }
        }
Esempio n. 5
0
        /// <summary>
        /// Guarda los cambios
        /// </summary>
        /// <history>
        /// [jorcanche] 30/03/2016 created
        /// </history>
        private async void ValidateSave()
        {
            try
            {
                //Invertimos el valor del Check si cancelo o lo descancelo
                Cancelado = chkguBookCanc.IsChecked = chkguBookCanc.IsChecked != null && !chkguBookCanc.IsChecked.Value;
                //Guardamos el BookCanceled
                _guest.guBookCanc = Cancelado.Value;

                //Enviamos los parametros para que guarde los cambios del guest y el log del Guest.
                //Si hubo un erro al ejecutar el metodo SaveChangedOfGuest nos devolvera 0, indicando que ningun paso
                //se realizo, es decir ni se guardo el Guest ni el Log, y siendo así ya no modificamos la variable
                //_wasSaved que es el que indica que se guardo el Avail.
                if (await BRGuests.SaveChangedOfGuest(_guest, Context.User.LeadSource.lsHoursDif, _user.peID) == 0)
                {
                    //De no ser así informamos que no se guardo la información por algun motivo
                    UIHelper.ShowMessage("There was an error saving the information, consult your system administrator",
                                         MessageBoxImage.Error, "Information can not keep");
                    //Regresamos el Valor a como estaba
                    Cancelado = chkguBookCanc.IsChecked = !chkguBookCanc.IsChecked.Value;
                }
                Close();
            }
            catch (Exception ex)
            {
                UIHelper.ShowMessage(ex);
            }
        }
Esempio n. 6
0
        private async void LoadControls()
        {
            _guest = await BRGuests.GetGuest(_guestId);

            cboguum.ItemsSource = await BRUnavailableMotives.GetUnavailableMotives(1);

            cboguPRAvail.ItemsSource = await BRPersonnel.GetPersonnel(Context.User.Location.loID, "ALL", "PR");

            if (_guest.guPRAvail != null)
            {
                cboguPRAvail.SelectedValue = _guest.guPRAvail;
            }
            if (_guest.guum != 0)
            {
                cboguum.SelectedValue = _guest.guum;
                txtguum.Text          = _guest.guum.ToString();
            }
            chkguOriginAvail.IsChecked         = _guest.guOriginAvail;
            chkguAvail.IsChecked               = _guest.guAvail;
            chkguAvailBySystem.IsChecked       = _guest.guAvailBySystem;
            txtguum.IsEnabled                  = cboguum.IsEnabled = cboguPRAvail.IsEnabled = btnCancel.IsEnabled =
                btnSave.IsEnabled              =
                    chkguOriginAvail.IsEnabled = chkguAvail.IsEnabled = txtguum.IsEnabled = cboguum.IsEnabled = false;
            btnEdit.IsEnabled                  = true;
        }
Esempio n. 7
0
        private async void btnSave_Click(object sender, RoutedEventArgs e)
        {
            Mouse.OverrideCursor = Cursors.Wait;
            try
            {
                if (Validate())
                {
                    //guardamos la informacion del seguimiento
                    _guest.guPRFollow = cboguPRFollow.SelectedValue.ToString();
                    _guest.guFollowD  = Convert.ToDateTime(txtguFollowD.Text).Date;
                    _guest.guFollow   = true;

                    //Enviamos los parametros para que guarde los cambios del guest y el log del Guest.
                    //Si hubo un erro al ejecutar el metodo SaveGuestAvailOrFollowUp nos devolvera 0, indicando que ningun paso
                    //se realizo, es decir ni se guardo el Guest ni el Log, y siendo así ya no modificamos la variable
                    //_wasSaved que es la que indica que se guardo el FollowUp.
                    if (await BRGuests.SaveChangedOfGuest(_guest, Context.User.LeadSource.lsHoursDif, _user.User.peID) != 0)
                    {
                        _wasSaved             = true;
                        chkguFollow.IsChecked = true;
                    }
                    else
                    {
                        UIHelper.ShowMessage("There was an error saving the information, consult your system administrator",
                                             MessageBoxImage.Error, "Information can not keep");
                    }
                    Close();
                }
            }
            catch (Exception ex)
            {
                UIHelper.ShowMessage(ex);
            }
            Mouse.OverrideCursor = null;
        }
Esempio n. 8
0
        /// <summary>
        /// Guarda/Actualiza los datos de un Guest.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private async void btnSave_Click(object sender, RoutedEventArgs e)
        {
            if (!Validate())
            {
                return;
            }
            try
            {
                var agency = (cmbOtherInfoAgency.SelectedItem as AgencyShort);
                ((GuestInvitation)DataContext).Guest.gumk = (await BRAgencies.GetAgenciesByIds(new List <string> {
                    agency.agID
                })).FirstOrDefault()?.agmk;
                _catObj.Guest.guCheckOutHotelD            = (DateTime)dtpDeparture.Value;
                var result = await BRGuests.SaveGuest((GuestInvitation)DataContext);

                if (result > 0)
                {
                    ((GuestInvitation)DataContext).Guest = await BRGuests.GetGuest(result);

                    UIHelper.ShowMessage("Guest saved successfully.");
                }
                DialogResult = true;
                Close();
            }
            catch (Exception ex)
            {
                UIHelper.ShowMessage(ex);
            }
        }
Esempio n. 9
0
        /// <summary>
        /// Guarda la nota
        /// </summary>
        /// <history>
        /// [jorcanche] created 07/04/2016
        /// </history>
        public async void Save()
        {
            try
            {
                EnabledControls(true, true, false);
                if (AfterValidate())
                {
                    //Agregamos la nota
                    var note = new PRNote
                    {
                        pnDT   = Convert.ToDateTime(txtpnDT.Text),
                        pngu   = _guestId,
                        pnPR   = txtpnPR.Text,
                        pnText = txtpnText.Text
                    };

                    //Actualizamos el guest si no tiene ninguna nota
                    Guest guest = null;
                    if (!await BRNotes.GetCountNoteGuest(_guestId))
                    {
                        guest = await BRGuests.GetGuest(_guestId);

                        guest.guPRNote = true;
                        SaveNote       = true;
                    }
                    else
                    {
                        SaveNote = false;
                    }
                    //Enviamos los parametros para que agregue la nueva nota y modificamos el guest.
                    //Si hubo un erro al ejecutar el metodo SaveNoteGuest nos devolvera 0, indicando que ningun paso
                    //se realizo, es decir ni se agrego la nota y se modifico el guest, y siendo así ya no modificamos la variable
                    //_saveNote que es el que indica que se guardo el Avail.
                    if (await BRNotes.SaveNoteGuest(note, guest) != 0)
                    {
                        //Actualizamos el datagrid
                        _pRNoteViewSource.Source = await BRNotes.GetNoteGuest(_guestId);

                        DgNotes_OnSelectedCellsChanged(dgNotes, null);
                    }
                    else
                    {
                        //De no ser así informamos que no se guardo la información por algun motivo
                        UIHelper.ShowMessage("There was an error saving the information, consult your system administrator",
                                             MessageBoxImage.Error, "Information can not keep");
                    }
                    CleanControls();
                    _creatingNote = false;
                }
                else
                {
                    EnabledControls(false, false, true);
                }
            }
            catch (Exception ex)
            {
                UIHelper.ShowMessage(ex);
            }
        }
Esempio n. 10
0
        /// <summary>
        /// Carga el Program para la invitacion
        /// </summary>
        /// <param name="module">EnumModule</param>
        /// <param name="invitationType">EnumInvitationType</param>
        /// <param name="guId">GuestID</param>
        /// <history>
        /// [erosado] 10/08/2016  Created.
        /// </history>
        private async Task LoadProgram(EnumModule module, EnumInvitationType invitationType, int guId)
        {
            EnumProgram program = EnumProgram.All;

            //Si se tiene el GuestID
            if (guId != 0 && module != EnumModule.Host)
            {
                //Obtenemos la informacion del Guest
                var guest = await BRGuests.GetGuest(guId);

                //Obtenemos la informacion de program
                var result = await BRLeadSources.GetLeadSourceProgram(guest.gulsOriginal);

                //Asignamos el Program
                if (result == EnumToListHelper.GetEnumDescription(EnumProgram.Inhouse))
                {
                    program = EnumProgram.Inhouse;
                }
                else
                {
                    program = EnumProgram.Outhouse;
                }
            }
            //Si NO hay un Guest para obtener el program
            else
            {
                //De que modulo me estan hablando
                switch (module)
                {
                case EnumModule.InHouse:
                    if (invitationType == EnumInvitationType.newExternal)
                    {
                        program = EnumProgram.Inhouse;
                    }
                    break;

                case EnumModule.OutHouse:
                    if (invitationType == EnumInvitationType.newOutHouse)
                    {
                        program = EnumProgram.Outhouse;
                    }
                    break;

                case EnumModule.Host:
                    if (invitationType == EnumInvitationType.newOutHouse)
                    {
                        program = EnumProgram.Outhouse;
                    }
                    else
                    {
                        program = EnumProgram.Inhouse;
                    }
                    break;
                }
            }
            Program         = program;
            AllowReschedule = program == EnumProgram.Inhouse;
        }
Esempio n. 11
0
        /// <summary>
        /// Carga la informacion de los Guest adicionales, esta informacion se presenta en el dtgAdditionalGuest
        /// </summary>
        /// <param name="guId">Guest ID</param>
        /// <history>
        /// [erosado] 04/08/2016  Created.
        /// </history>
        private async Task LoadAdditionalGuest(int guId)
        {
            var result = await BRGuests.GetAdditionalGuest(guId);

            ////Obtiene la informacion del AdditionalGuest
            AdditionalGuestList = new ObservableCollection <Guest>(result);
            ////Crea una copia de la lista
            CloneAdditionalGuestList = ObjectHelper.CopyProperties(result);
        }
Esempio n. 12
0
        /// <summary>
        /// Inicializa el datagrid
        /// </summary>
        /// <history>
        /// [jorcanche] 20/06/2016 created
        /// </history>
        private async void Window_Loaded(object sender, RoutedEventArgs e)
        {
            Mouse.OverrideCursor = Cursors.Wait;
            Title = $"IM Guest Movements - Guest ID {_guestID}";
            var movement = await BRGuests.GetGuestMovement(_guestID);

            guestMovementsDataGrid.ItemsSource = movement;
            Mouse.OverrideCursor = null;
        }
Esempio n. 13
0
        /// <summary>
        /// Cuando se pierde el Focus de los comentarios lo guarda en la base lo que se halla escrito
        /// </summary>
        /// <history>
        /// [jorcanche] created 05/05/2016
        /// </history>
        private async void guCommentsColumnArrival_LostFocus(object sender, RoutedEventArgs e)
        {
            var   txt = sender as TextBox;
            var   row = dgGuestPremanifest.SelectedItem as GuestPremanifestOuthouse;
            Guest pre = await BRGuests.GetGuest(row.guID);

            pre.guComments = txt.Text;
            await BREntities.OperationEntity(pre, EnumMode.Edit);
        }
Esempio n. 14
0
        /// <summary>
        /// Carga los resultados en el grid
        /// </summary>
        /// <history>
        /// [vipacheco] 06/Junio/2016 Created
        /// </history>
        private async void Load_Grid()
        {
            _busyIndicator.IsBusy      = true;
            _busyIndicator.BusyContent = "Loading guests...";
            grdGuest.ItemsSource       = await BRGuests.GetSearchGuestGeneral(_dateParent, dtpStart.Value.Value.Date, dtpEnd.Value.Value.Date, string.IsNullOrEmpty(txtguID.Text)? 0 : Convert.ToInt32(txtguID.Text),
                                                                              string.IsNullOrEmpty(txtName.Text)? "" : txtName.Text, cboLeadSource.SelectedValue == null? "" : cboLeadSource.SelectedValue.ToString(),
                                                                              cboSalesRoom.SelectedValue == null? "" : cboSalesRoom.SelectedValue.ToString(), string.IsNullOrEmpty(txtRoomNum.Text)? "" : txtRoomNum.Text,
                                                                              string.IsNullOrEmpty(txtReservation.Text)? "" : txtReservation.Text, string.IsNullOrEmpty(txtPR.Text)? "" : txtPR.Text, _module);

            _busyIndicator.IsBusy = false;
        }
Esempio n. 15
0
        /// <summary>
        /// Carga los huespedes
        /// </summary>
        /// <history>
        /// [aalcocer] 24/02/2016 Created
        /// </history>
        private void LoadGrid()
        {
            StaStart("Loading guests...");

            _dtmServerdate     = BRHelpers.GetServerDate();
            _ltsGuestsMailOuts = BRGuests.GetGuestsMailOuts(Context.User.LeadSource.lsID, _dtmServerdate, _dtmServerdate.AddDays(1), _dtmServerdate.AddDays(2));

            List <ObjGuestsMailOuts> _ltsObjGuestsMailOuts = _ltsGuestsMailOuts.Select(parent => new ObjGuestsMailOuts(parent)).ToList();

            _objGuestsMailOutsViewSource.Source = _ltsObjGuestsMailOuts;
            dtgDatos.SelectedItem = null;
            StaEnd();
        }
Esempio n. 16
0
        private async void LoadFollwUp()
        {
            cboguPRFollow.IsEnabled   = false;
            cboguPRFollow.ItemsSource = await BRPersonnel.GetPersonnel(Context.User.Location.loID, "ALL", "PR");

            _guest = await BRGuests.GetGuest(_guestID);

            if (_guest.guFollowD.HasValue)
            {
                txtguFollowD.Text = _guest.guFollowD.Value.Date.ToString("dd-MM-yyyy");
            }
            if (_guest.guPRFollow != string.Empty)
            {
                cboguPRFollow.SelectedValue = _guest.guPRFollow;
            }
            chkguFollow.IsChecked = _guest.guFollow;

            btnEdit.IsEnabled = true; btnSave.IsEnabled = btnCancel.IsEnabled = false;
        }
Esempio n. 17
0
        private async void LoadContact()
        {
            cboguPRInfo.ItemsSource = await BRPersonnel.GetPersonnel(_userPrimero.Location.loID, "ALL", "PR");

            var guest = await BRGuests.GetGuest(_guestID);

            if (guest.guInfoD.HasValue)
            {
                txtguInfoD.Text = guest.guInfoD.Value.Date.ToString("dd-MM-yyyy");
            }
            if (guest.guPRInfo != string.Empty)
            {
                cboguPRInfo.SelectedValue = guest.guPRInfo;
            }
            chkguInfo.IsChecked = guest.guInfo;

            btnEdit.IsEnabled     = true; btnSave.IsEnabled = btnCancel.IsEnabled = false;
            cboguPRInfo.IsEnabled = false;
            Mouse.OverrideCursor  = null;
        }
Esempio n. 18
0
 /// <summary>
 /// Carga el DataGrid que contiene los Guest Premanifest de Outhouse
 /// </summary>
 /// <history>
 /// [jorcanche] 05/05/2016 created
 /// </history>
 private async void LoadGrid()
 {
     if (_outPremanifestViewSource == null)
     {
         return;
     }
     try
     {
         _outPremanifestViewSource.Source =
             await BRGuests.GetGuestPremanifestOuthouse(_bookInvit, _serverDate, Context.User.Location.loID);
     }
     catch (Exception ex)
     {
         UIHelper.ShowMessage(ex);
     }
     finally
     {
         StaEnd();
     }
 }
Esempio n. 19
0
 /// <summary>
 /// Carga el Grid GuestsGroupsIntegrants
 /// </summary>
 /// <param name="gx">Grupo al que pertenecen los integrantes</param>
 /// <history>[ECANUL] 29-03-2016 Created</history>
 void LoadGridGuestsGroupsIntegrants(GuestsGroup gx)
 {
     StaStart("Loading Integrants...");
     _lstGuest = BRGuests.GetGuestsGroupsIntegrants(gx);
     if (_lstGuest.Count != 0)
     {
         if (_enumAction == EnumAction.AddTo)
         {
             AddGuestToGridGuestsGroupsIntegrants(_guestID);
         }
         else
         {
             dtgGuestGroupIntegrants.ItemsSource = _lstGuest;
         }
         lblIntegrants.Content = "Integrants: " + dtgGuestGroupIntegrants.Items.Count;
     }
     _oldListGuests = (List <Guest>)dtgGuestGroupIntegrants.ItemsSource;
     dtgGuestGroupIntegrants.IsEnabled = true;
     StaEnd();
 }
Esempio n. 20
0
        /// <summary>
        /// Guarda los Gifts Receipt Additional ingresados
        /// </summary>
        /// <history>
        /// [vipacheco] 12/Mayo/2016 Created
        /// </history>
        private async void btnSave_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
        {
            int lngReceiptID = 0;
            int lngGuestID   = 0;

            foreach (GetGiftsReceiptsAdditional currentRow in dtgGuestsAdditional.Items)
            {
                // si se desea generar el recibo de regalos
                if (currentRow.Generate.Value)
                {
                    lngGuestID = currentRow.gaAdditional;

                    // Agregamos el recibo de regalos
                    lngReceiptID = await AddReceipt(lngGuestID);

                    GiftsReceiptsShort giftReceiptShort = new GiftsReceiptsShort()
                    {
                        grID = lngReceiptID, grNum = "", grExchange = false
                    };
                    _frmGiftsReceipt.obsGiftsReceipt.Add(giftReceiptShort);

                    // Agregamos los regalos del recibo
                    AddGifts(lngGuestID, lngReceiptID);

                    // Indica que el huesped ya tiene recibo de regalos
                    Guest _Guest = await BRGuests.GetGuest(lngGuestID, true);

                    _Guest.guGiftsReceived = true;
                    await BREntities.OperationEntity(_Guest, Model.Enums.EnumMode.Edit);

                    // Actualizamos los regalos de la invitacion
                    UpdateInvitsGifts(lngReceiptID, lngGuestID);

                    // Guardamos el historico del recibo
                    await BRGiftsReceiptLog.SaveGiftsReceiptsLog(lngReceiptID, _frmGiftsReceipt.txtChangedBy.Text);
                }
            }
            Close();
        }
Esempio n. 21
0
        /// <summary>
        /// Visualiza como queda en el reporte de inviatacion
        /// </summary>
        ///<history>
        ///[jorcanche] created 12/05/2016
        ///</history>
        private async void btnPreview_Click(object sender, RoutedEventArgs e)
        {
            if (!UIRichTextBoxHelper.HasInfo(ref rtbHeader) || !UIRichTextBoxHelper.HasInfo(ref rtbFooter))
            {
                UIHelper.ShowMessage("The header and footer must contain information. \n They can not be empty");
                return;
            }
            StaStart("Preview Invit...");
            if (cmbLanguage.SelectedValue == null || cmbLeadSource.SelectedValue == null)
            {
                return;
            }
            EnableControls(true, false, true, false);
            var guest = await BRGuests.GetGuest(0);

            guest.guls = cmbLeadSource.SelectedValue.ToString();
            guest.gula = cmbLanguage.SelectedValue.ToString();
            await BREntities.OperationEntity(guest, EnumMode.Edit);

            RptInvitationHelper.RptInvitation(window: this);
            StaEnd();
        }
Esempio n. 22
0
        private async void btnSave_Click(object sender, RoutedEventArgs e)
        {
            Mouse.OverrideCursor = Cursors.Wait;
            try
            {
                if (Validate())
                {
                    //guardamos la informacion de contacto
                    _guest.guloInfo = _userLoguedo.User.peID;
                    _guest.guPRInfo = cboguPRInfo.SelectedValue.ToString();
                    _guest.guInfoD  = Convert.ToDateTime(txtguInfoD.Text).Date;
                    _guest.guInfo   = true;

                    //Enviamos los parametros para que guarde los cambios del guest y el log del Guest y de igual forma los moviemientos de este (SaveGuestMovement).
                    //Si hubo un erro al ejecutar el metodo SaveGuestContact nos devolvera 0, indicando que ningun paso
                    //se realizo, es decir ni se guardo el Guest, el Log ni los movimientos de este, siendo así ya no modificamos la variable
                    //_wasSaved que es la que indica que se guardo el Avail.
                    if (await BRGuests.SaveGuestContact(_guest, _userPrimero.LeadSource.lsHoursDif, _userLoguedo.User.peID,
                                                        EnumGuestsMovementsType.Contact, Environment.MachineName, ComputerHelper.GetIpMachine()) != 0)
                    {
                        //Modificamos las variable indicando que si se guardo la variable
                        _wasSave            = true;
                        chkguInfo.IsChecked = true;
                    }
                    else
                    {
                        UIHelper.ShowMessage("There was an error saving the information, consult your system administrator",
                                             MessageBoxImage.Error, "Information can not keep");
                    }
                    Close();
                }
            }
            catch (Exception ex)
            {
                UIHelper.ShowMessage(ex);
            }
            Mouse.OverrideCursor = null;
        }
Esempio n. 23
0
        /// <summary>
        /// Obtiene el nombre de un huesped
        /// </summary>
        /// <param name="guestId">Id del Guest</param>
        /// <returns>string</returns>
        /// <history>
        /// [aalcocer] 13/08/2016 Created
        /// </history>
        public static async Task <string> GetGuestName(int?guestId)
        {
            var strName = string.Empty;

            // validamos que se haya enviado una clave de huesped
            if (guestId == null || guestId == 0)
            {
                return(strName);
            }
            var guest = await BRGuests.GetGuest((int)guestId);

            // si se encontro el huesped
            if (guest != null)
            {
                strName = GetFullName(guest.guLastName1, guest.guFirstName1);
            }
            // si no se encontro el huesped
            else
            {
                UIHelper.ShowMessage("Guest not found");
            }
            return(strName);
        }
Esempio n. 24
0
        /// <summary>
        /// Metodo de busqueda de acuerdo a los criterios ingresados.
        /// </summary>
        /// <history>
        /// [vipacheco] 05/Agosto/2016 Created -> Se cambio del evento onclick porque se cambio el control
        /// </history>
        private async void btnSearch_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
        {
            if (ValidateCriteria())
            {
                _busyIndicator.IsBusy      = true;
                _busyIndicator.BusyContent = "Loading Guests...";

                dtgGuests.ItemsSource = await BRGuests.GetSearchGuestByLS(
                    cmbLeadSourse.SelectedValue != null?cmbLeadSourse.SelectedValue.ToString() : string.Empty,
                        _program == EnumProgram.Inhouse?string.Empty : cmbSalesRoom.SelectedIndex == -1?string.Empty : cmbSalesRoom.SelectedValue.ToString(),
                        txtName.Text,
                        txtRoom.Text,
                        txtReservation.Text,
                        (!txtGUID.Text.Equals(string.Empty) ? Convert.ToInt32(txtGUID.Text) : 0),
                        dtpFrom.Value.Value,
                        dtpTo.Value.Value,
                        _program,
                        txtPR.Text);

                StatusBarReg.Content  = dtgGuests.Items.Count.ToString() + (dtgGuests.Items.Count == 1 ? " Guest" : " Guests");
                _busyIndicator.IsBusy = false;
            }
        }
Esempio n. 25
0
        /// <summary>
        /// Carga e inicializa las variables
        /// </summary>
        /// <history>
        /// [jorcanche]  created 11/08/2016
        /// </history>
        private async void FrmNotBookingMotive_OnLoaded(object sender, RoutedEventArgs e)
        {
            Invit            = false;
            Save             = false;
            lblUserName.Text = Context.User.User.peN;
            //Cargamos los Controles y el Guest
            _guest = await BRGuests.GetGuest(_guestId);

            cbmgunb.ItemsSource = await BRNotBookingMotives.GetNotBookingMotives(1);

            cbmguPRNoBook.ItemsSource = await BRPersonnel.GetPersonnel(Context.User.Location.loID, "ALL", "PR");

            //Asignar valores
            if (_guest.guNoBookD != null)
            {
                txtguNoBookD.Text = _guest.guNoBookD.Value.ToShortDateString();
            }
            cbmgunb.SelectedValue       = _guest.gunb;
            cbmguPRNoBook.SelectedValue = _guest.guPRNoBook;

            // establecemos el modo lectura
            SetMode(EnumMode.ReadOnly);
        }
Esempio n. 26
0
        /// <summary>
        /// Se aplica cada vez que se quiere eliminar un guest en el grid presionando la tecla Delete
        /// </summary>
        /// <history>
        /// [jorcanche] created 05/05/2016
        /// </history>
        private async void dgGuestPremanifest_PreviewKeyDown(object sender, KeyEventArgs e)
        {
            var row = dgGuestPremanifest.SelectedItem as GuestPremanifestOuthouse;

            //Si no es una tecla Delete ó si row es igual a null Retornamos
            if (e.Key != Key.Delete || row == null)
            {
                return;
            }

            // Si se esta editando alguna celda del row no dejamos que elimine el registro
            if (((DataGridRow)dgGuestPremanifest.ItemContainerGenerator.ContainerFromItem(row)).IsEditing)
            {
                return;
            }

            //Si se presiono la tecla Delte y si  diferente de Null el row y si tiene Show el guest
            //No lo permitimos eliminar y retornamos
            if (row.guShow)
            {
                e.Handled = true;
                UIHelper.ShowMessage("You can not delete the Guest because has 'Show Up'");
                return;
            }

            var result = UIHelper.ShowMessage("Are you sure you want to delete this invitation?",
                                              MessageBoxImage.Question);

            if (result == MessageBoxResult.Yes)
            {
                await BRGuests.DeleteGuest(row.guID);
            }
            else
            {
                e.Handled = true;
            }
        }
Esempio n. 27
0
        /// <summary>
        /// Abre el formulario que funciona para buscar un Guest y lo transfiere al OutHouse que esta actual
        /// </summary>
        /// <history>
        /// [jorcanche] created 05/05/2016
        /// [vipacheco] 04/Agosto/2016 Modified -> Se agrego el parametro EnumProgram al frmSearchGuest
        /// </history>
        private async void btnTransfer_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                var frmsearchGuest = new frmSearchGuest(Context.User, EnumProgram.Outhouse)
                {
                    Owner         = this,
                    ShowInTaskbar = false
                };
                //Si ya se cerro la ventana
                //Valida que haya sido un OK y no un Cancel
                frmsearchGuest.ShowDialog();
                if (!frmsearchGuest.cancel)
                {
                    var guest = frmsearchGuest.lstGuestAdd[0];
                    guest.guls         = Context.User.LeadSource.lsID;
                    guest.guBookCanc   = false;
                    guest.guloInvit    = Context.User.LeadSource.lsID;
                    guest.gulsOriginal = Context.User.LeadSource.lsID;

                    //Enviamos los parametros para que guarde los cambios del guest y el log del Guest.
                    //Si hubo un error al ejecutar el metodo SaveChangedOfGuest nos devolvera 0, indicando que ningun paso
                    //se realizo, es decir ni se guardo el Guest ni el Log
                    if (await BRGuests.SaveChangedOfGuest(guest, Context.User.LeadSource.lsHoursDif, Context.User.User.peID) == 0)
                    {
                        //De no ser así informamos que no se guardo la información por algun motivo
                        UIHelper.ShowMessage("There was an error saving the information, consult your system administrator",
                                             MessageBoxImage.Error, "Information can not keep");
                    }
                }
            }
            catch (Exception ex)
            {
                UIHelper.ShowMessage(ex);
            }
        }
Esempio n. 28
0
        /// <summary>
        /// Agrega un Huesped a la tabla GuestsGroupsIntegrants Cuando se manda desde frmRegister
        /// </summary>
        /// <param name="id">Si solo se tiene el ID | 0 si si ya se tiene el guesped a guardar</param>
        /// <param name="guest">Guesped a Guardar en caso de que ya se tenga toda la informacion</param>
        async void AddGuestToGridGuestsGroupsIntegrants(int id, Guest guest = null)
        {
            Guest gu;

            if (id != 0)
            {
                if (_lstGuest == null)
                {
                    _lstGuestTemp = new List <Guest>();
                }
                else
                {
                    _lstGuestTemp = _lstGuest;
                }
                _lstGuestTemp.Add(await BRGuests.GetGuest(id));
            }
            else
            {
                gu = guest;
                _lstGuestTemp.Add(gu);
            }
            dtgGuestGroupIntegrants.ItemsSource = _lstGuestTemp;
            lblIntegrants.Content = "Integrants: " + dtgGuestGroupIntegrants.Items.Count;
        }
Esempio n. 29
0
        /// <summary>
        /// Carga la variable de Guest
        /// </summary>
        /// <history>
        /// [jorcanche]  created 06072016
        /// </history>
        private async void FrmBookingCancel_OnLoaded(object sender, RoutedEventArgs e)
        {
            _guest = await BRGuests.GetGuest(_guestId);

            chkguBookCanc.IsChecked = _guest.guBookCanc;
        }
Esempio n. 30
0
        private async Task LoadGuest(UserData user, int guId)
        {
            Guest guestObj = new Guest();

            //Si tiene GuestID obtemos la informacion del GuestID
            if (guId != 0)
            {
                guestObj = await BRGuests.GetGuest(guId, true);
            }

            //Clonamos el Guest
            CloneGuest = new Guest();
            ObjectHelper.CopyProperties(CloneGuest, guestObj);

            //Obtenemos la fecha y hora del servidor
            var serverDate = BRHelpers.GetServerDate();
            var serverTime = BRHelpers.GetServerDateTime();

            //Calculamos el Modo de la invitacion
            GetInvitationMode(guestObj);

            //Si es una invitacion Nueva SIN GuestID
            if (InvitationMode == EnumMode.Add && guestObj.guID == 0)
            {
                //Valores Defualt Comunes entre los tipos de invitacion
                guestObj.guInvitD    = serverDate;
                guestObj.guInvitT    = serverTime;
                guestObj.guCheckInD  = serverDate;
                guestObj.guCheckOutD = serverDate.AddDays(7);
                guestObj.guRoomsQty  = 1;
                guestObj.gucu        = "US";
                guestObj.gula        = "EN";
                guestObj.gums1       = "N";
                guestObj.gums2       = "N";
                guestObj.gupt        = "CS";

                //Casos especiales de asignacion de valores default
                switch (_module)
                {
                case EnumModule.InHouse:
                    guestObj.guloInvit = user.LeadSource.lsID;
                    guestObj.guls      = user.LeadSource.lsID;
                    if (_invitationType == EnumInvitationType.newExternal)
                    {
                        guestObj.guag = "EXTERNAL";
                    }
                    break;

                case EnumModule.OutHouse:
                    guestObj.guloInvit = user.LeadSource.lsID;
                    guestObj.guag      = "OUTSIDE";
                    break;

                case EnumModule.Host:
                    guestObj.guDirect = true;
                    guestObj.gusr     = user.SalesRoom.srID;
                    break;
                }
            }
            //Si es un invitacion nueva CON GuestID
            else if (InvitationMode == EnumMode.Add && guestObj.guID != 0)
            {
                //Fecha y hora Invitacion
                guestObj.guInvitD = serverDate;
                guestObj.guInvitT = serverTime;

                //Casos especiales de asignacion de valores default
                switch (_module)
                {
                case EnumModule.InHouse:
                    guestObj.guloInvit = user.LeadSource.lsID;
                    if (_invitationType == EnumInvitationType.newExternal)
                    {
                        guestObj.guag = "EXTERNAL";
                    }
                    break;

                case EnumModule.OutHouse:
                    guestObj.guloInvit = user.SalesRoom.srID;
                    guestObj.guag      = "OUTSIDE";
                    break;

                case EnumModule.Host:
                    guestObj.guDirect = true;
                    guestObj.gusr     = user.SalesRoom.srID;
                    break;
                }
            }
            //Notificamos cambios
            Guest = guestObj;
        }