/// <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; } }
/// <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); } }
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; }
/// <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(); }
/// <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); } }
/// <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; }
/// <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); }
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; }
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; }
/// <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(); }
/// <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(); }
/// <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); }
/// <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); }
/// <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; }
/// <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; }
/// <summary> /// Agrega un recibo de regalos /// </summary> /// <param name="GuestID"></param> /// <returns></returns> /// <history> /// [vipacheco] 13/Mayo/2016 Created /// </history> private async Task <int> AddReceipt(int GuestID) { // Obtenemos los datos del huesped Guest _Guest = await BRGuests.GetGuest(GuestID); string _FullName = Common.GetFullName(_Guest.guLastName1 ?? "", _Guest.guFirstName1 ?? ""); string _FullName2 = Common.GetFullName(_Guest.guLastname2 ?? "", _Guest.guFirstName2 ?? ""); bool boolTemp = false; // Creamos el recibo de regalos GiftsReceipt _GiftsReceipt = new GiftsReceipt { grNum = null, grD = _frmGiftsReceipt.dtpgrD.Value.Value, grgu = _Guest.guID, grGuest = _FullName.Length > _frmGiftsReceipt.txtgrGuest.MaxHeight ? _FullName.Substring(0, 20) : _FullName, grPax = _Guest.guPax, grHotel = _Guest.guHotel, grRoomNum = _Guest.guRoomNum, grpe = (_frmGiftsReceipt.cmbgrpe.SelectedItem as PersonnelShort).peID, grlo = _frmGiftsReceipt.cmbgrlo.SelectedValue.ToString(), grls = _frmGiftsReceipt.cmbgrlo.SelectedValue.ToString(), grsr = _frmGiftsReceipt.cmbSalesRoom.SelectedValue.ToString(), grWh = _frmGiftsReceipt.cmbSalesRoom.SelectedValue.ToString(), grMemberNum = null, grHost = (_frmGiftsReceipt.cmbgrHost.SelectedItem as PersonnelShort).peID, grComments = null, grDeposit = 0, grDepositTwisted = 0, grcu = "US", grcxcPRDeposit = 0, grcucxcPRDeposit = "US", grCxCClosed = false, grExchangeRate = 0, grct = _frmGiftsReceipt.cmbgrct.SelectedValue.ToString(), grMaxAuthGifts = _frmGiftsReceipt.CalculateMaxAuthGifts(_frmGiftsReceipt.cmbgrct.SelectedValue.ToString(), _Guest.guls, ref boolTemp), grcxcGifts = 0, grcxcAdj = 0, grcxcComments = null, grTaxiIn = 0, grTaxiOut = 0, grCancel = false, grClosed = false, grCxCAppD = null, grTaxiOutDiff = 0, grGuest2 = _FullName2.Length > _frmGiftsReceipt.txtgrGuest2.MaxHeight ? _FullName2.Substring(0, 20) : _FullName2, grpt = "CS", grReimpresion = 0, grrm = null, grAuthorizedBy = null, grAmountToPay = null, grup = null, grcxcTaxiOut = 0, grcucxcTaxiOut = "US", grcxcAuthComments = null, grCancelD = null, grAmountPaid = 0, grBalance = 0 }; // Guardamos el ReceiptGifts y Obtenemos el ID generado. return(await BRGiftsReceipts.SaveGiftReceipt(_GiftsReceipt)); }
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; }