private async Task LoadInvitationGift(int guId) { var result = await BRInvitsGifts.GetInvitsGiftsByGuestID(guId); //Obtiene la informacion del InvitationGift InvitationGiftList = new ObservableCollection <InvitationGift>(result); //Crea una copia de la lista CloneInvitationGiftList = ObjectHelper.CopyProperties(result); }
/// <summary> /// Actualiza los regalos de la invitacion /// </summary> /// <param name="ReceiptID"></param> /// <param name="GuestID"></param> /// <history> /// [vipacheco] 13/Mayo/2016 Created /// </history> private async void UpdateInvitsGifts(int ReceiptID, int GuestID) { // Seleccionamos los regalos de la invitacion List <InvitationGift> _lstInvitationGifts = await BRInvitsGifts.GetInvitsGiftsByGuestID(GuestID); foreach (InvitationGift Current in _lstInvitationGifts) { Current.iggr = ReceiptID; await BREntities.OperationEntity(Current, Model.Enums.EnumMode.Edit); } }
/// <summary> /// Agrega los regalos de un recibo de regalos /// </summary> /// <param name="GuestID"></param> /// <param name="ReceiptID"></param> /// <history> /// [vipacheco] 13/Mayo/2016 Created /// </history> private async void AddGifts(int GuestID, int ReceiptID) { // Obtenemos los regalos del huesped List <InvitationGift> _lstInvitationGifts = await BRInvitsGifts.GetInvitsGiftsByGuestID(GuestID); List <GiftsReceiptDetail> _lstGiftReceiptDetail = new List <GiftsReceiptDetail>(); // Recorremos los regalos de la invitacion foreach (InvitationGift current in _lstInvitationGifts) { GiftsReceiptDetail _newGiftDetail = new GiftsReceiptDetail { gegr = ReceiptID, gegi = current.iggi, gect = "MARKETING", geQty = current.igQty, geAdults = current.igAdults, geMinors = current.igMinors, gePriceA = current.igPriceA, gePriceM = current.igPriceM, geCharge = 0, geInElectronicPurse = false, geCancelElectronicPurse = false, geExtraAdults = 0, geInPVPPromo = false, geCancelPVPPromo = false, geInOpera = false, gePromotionOpera = null, gePriceAdult = 0, gePriceMinor = 0, gePriceExtraAdult = 0, geSale = false }; _lstGiftReceiptDetail.Add(_newGiftDetail); } // Aplicamos los cambios en la BD if (_lstGiftReceiptDetail.Count > 0) { _lstGiftReceiptDetail.ForEach(async item => await BREntities.OperationEntity(item, Model.Enums.EnumMode.Add)); } }
/// <summary> /// /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private async void Window_Loaded(object sender, RoutedEventArgs e) { _dsSalesRoom = ((CollectionViewSource)(this.FindResource("dsSalesRoom"))); _dsPrograms = ((CollectionViewSource)(this.FindResource("dsPrograms"))); _dsLeadSource = ((CollectionViewSource)(this.FindResource("dsLeadSource"))); _dsGifts = ((CollectionViewSource)(this.FindResource("dsGifts"))); _dsGiftsReceiptDetailCancel = ((CollectionViewSource)(this.FindResource("dsGiftsReceiptDetailCancel"))); _dsGiftsReceiptDetail = ((CollectionViewSource)(this.FindResource("dsGiftsReceiptDetail"))); // Cargamos los Sales Room _dsSalesRoom.Source = frmHost._lstSalesRoom; //Cargamos los Programs _dsPrograms.Source = frmHost._lstPrograms; // Cargamos los LeadSources _dsLeadSource.Source = frmHost._lstLeadSources; // Cargamos los Gifts _dsGifts.Source = frmHost._lstGifts; // Obtenemos los regalos a cancelar. List <GiftsReceiptDetailCancel> lstResultCancel = BRGiftsReceiptDetail.GetGiftsReceiptDetailCancel(_ReceiptID, _EnumExternalProduct); _obsGiftsCancel = new ObservableCollection <GiftsReceiptDetailCancel>(lstResultCancel); _dsGiftsReceiptDetailCancel.Source = _obsGiftsCancel; //Obtenemos los datos del Huesped. _Guest = await BRGuests.GetGuestShort(_GuestID); txtReceipt.Text = $"{_ReceiptID}"; txtGuestID.Text = $"{ _GuestID}"; txtNameInvitation.Text = _Guest.Name; cboSalesRoom.SelectedValue = _Guest.gusr; // Si es Inhouse if (_Guest.lspg.Equals("IH")) { // Si es una invitacion inhouse externa if (string.IsNullOrEmpty(_Guest.guHReservID)) { PropertyOpera = _Guest.lsPropertyOpera; } } // Si es OutHouse else { PropertyOpera = _Guest.srPropertyOpera; } cboProgram.SelectedValue = _Guest.lspg; cboLeadSource.SelectedValue = _Guest.gulsOriginal; txtReservation.Text = _Guest.guHReservID == "" ? null : _Guest.guHReservID; dtpArrival.Value = _Guest.guCheckInD; dtpDeparture.Value = _Guest.guCheckOutD; txtQtyEPurses.Text = $"{_Guest.guQtyGiftsCard}"; txtAccountInvitation.Text = _Guest.guAccountGiftsCard == "" ? null : _Guest.guAccountGiftsCard; // Monto maximo de reagalos txtMaxAuthGifts.Text = string.Format("{0:C2}", _MaxAuthGifts); // Totales de regalos txtTotalGiftsInvitation.Text = string.Format("{0:C2}", BRGiftsReceipts.CalculateTotalsGiftsInvitation(_GuestID)); // Si se genera un recibo Exchange if (_Exchange) { txtTotalGiftsCancel.Text = string.Format("{0:C2}", 0.00); } // si se desea cancelar el recibo else { txtTotalGiftsCancel.Text = string.Format("{0:C2}", _TotalGifts); } txtTotalGiftsExchange.Text = string.Format("{0:C2}", 0.00); CalculateTotalGifts(); // Totales del cargo txtgrcxcAdj.Text = string.Format("{0:C2}", _CurAdjustment); // Activamos la bandera para saber si se ajustaran costos CxC _applicationAdj = _CurAdjustment > 0 ? true : false; ReceiptsGifts.CalculateCharge(_GuestID, _FrmGiftsReceipt.cmbgrct.SelectedItem as ChargeTo, txtTotalCost, _isExchangeReceipt, ref txtgrcxcGifts, ref txtTotalCxC, ref _FrmGiftsReceipt.txtgrCxCAdj, ref _FrmGiftsReceipt._validateMaxAuthGifts, _Guest.gulsOriginal, ref _FrmGiftsReceipt.txtgrMaxAuthGifts, ref _FrmGiftsReceipt.txbgrMaxAuthGifts); // Si se desea cancelar el recibo if (!_Exchange) { stkGiftsExchange.Visibility = Visibility.Collapsed; WindowMain.Height = 424; // Ajustamos la ventana } // Impedimos modificar los datos si el sistema esta en modo de solo lectura if (ConfigHelper.GetString("ReadOnly").ToUpper().Equals("TRUE")) { btnSave.Visibility = Visibility.Hidden; } // si se debe generar un recibo exchange if (_Exchange) { List <GiftsReceiptDetail> lstResult = await BRInvitsGifts.GetGiftsInvitationWithoutReceipt(0); _obsGifts = new ObservableCollection <GiftsReceiptDetail>(lstResult); _obsGiftsComplet = new ObservableCollection <GiftsReceiptDetail>(lstResult); _dsGiftsReceiptDetail.Source = _obsGifts; } // Si se desea cancelar el recibo else { CheckAllCell(ref dtgCancel, _CancelField); TextBox x = null; ReceiptsGifts.CalculateTotalGifts(dtgCancel, EnumGiftsType.ReceiptGifts, ref txtTotalCost, ref x, ref x); dtgCancel.IsReadOnly = true; } }