Ejemplo n.º 1
0
        /// <summary>
        /// Llena el combobox de promotionsistur
        /// </summary>
        /// <history>
        /// [emoguel] created 08/07/2016
        /// </history>
        private async void LoadPromotionSistur()
        {
            try
            {
                cmbgiPVPPromotion.ItemsSource = await SisturHelper.getPromotionsType("REGALO", "ACTIV");

                skpStatus.Visibility = Visibility.Collapsed;
                btnAccept.Visibility = Visibility.Visible;
            }
            catch (Exception ex)
            {
                UIHelper.ShowMessage(ex);
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Guarda los datos
        /// </summary>
        /// <history>
        /// [vipacheco] 26/Mayo/2016 Created
        /// </history>
        private async Task Save()
        {
            List <string> aGiftsCancelled = await CancelGifts();

            // si se cancelo al menos un regalo
            if (aGiftsCancelled.Count > 0)
            {
                _Cancelled = true;

                // si se debe generar un recibo exchange
                if (_Exchange)
                {
                    // guardamos el recibo de regalos exchange
                    await SaveReceiptExchange();

                    dtgExchange.IsReadOnly = true;
                    // si tiene regalos de intercambio
                    if (dtgExchange.Items.Count > 0)
                    {
                        // guardamos los regalos de intercambio
                        GiftsExchange.Save(ReceiptExchangeID, dtgExchange);

                        // Guardamos las promociones en Sistur
                        string msjSavePromotionsSistur = await SisturHelper.SavePromotionsSistur(ReceiptExchangeID, "", Context.User.User.peID);

                        if (!string.IsNullOrEmpty(msjSavePromotionsSistur))
                        {
                            UIHelper.ShowMessage(msjSavePromotionsSistur, MessageBoxImage.Information, "Save promotions in sistur");
                        }
                    }
                }

                // guardamos los regalos cancelados
                await GiftsCancel.Save(_ReceiptID, ReceiptExchangeID, aGiftsCancelled, useCxCCost, _giftsDataContext, _obsGifts, _obsGiftsCancel, _Exchange, _CancelField);

                // si se maneja el monto maximo de regalos
                if (_ValidateMaxAuthGifts)
                {
                    // actualizamos el cargo del recibo de regalos
                    decimal Charge     = Convert.ToDecimal(txtgrcxcGifts.Text.TrimStart('$'));
                    decimal Adjustment = Convert.ToDecimal(txtgrcxcAdj.Text.TrimStart('$'));
                    await BRGiftsReceipts.UpdateCharge(_GuestID, Charge, Adjustment);
                }
            }
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Llena el combobox de promotionsistur
        /// </summary>
        /// <history>
        /// [emoguel] created 04/07/2016
        /// </history>
        private async void LoadPromotionSistur()
        {
            try
            {
                var promotions = await SisturHelper.getPromotionsType("REGALO", "ACTIV");

                promotions.Insert(0, new Services.SisturService.PromocionesTipoResponse {
                    nombre = "ALL", clave = "ALL"
                });
                promotions.Insert(1, new Services.SisturService.PromocionesTipoResponse {
                    nombre = "ANY", clave = "ANY"
                });
                promotions.Insert(2, new Services.SisturService.PromocionesTipoResponse {
                    nombre = "NONE", clave = "NONE"
                });
                cmbPromSistur.ItemsSource = promotions;
                skpStatus.Visibility      = Visibility.Collapsed;
                btnAccept.Visibility      = Visibility.Visible;
            }
            catch (Exception ex)
            {
                UIHelper.ShowMessage(ex);
            }
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Cancela los regalos
        /// </summary>
        /// <param name="GiftsCancelled"></param>
        /// <returns></returns>
        /// <history>
        /// [vipacheco] 26/Mayo/2016 Created
        /// </history>
        private async Task <List <string> > CancelGifts()
        {
            string        strGift = "", GiftsCancellled = "", GiftsNotCancellled = "";
            List <string> aGiftsToCancel = new List <string>();
            List <string> GiftsCancelled = new List <string>();

            // recorremos los regalos
            foreach (var item in dtgCancel.Items)
            {
                Type type     = item.GetType();
                var  property = type.GetProperties(BindingFlags.Public | BindingFlags.Instance).ToList();

                // Si el regalo se desea cancelar
                if (((bool)type.GetProperty(_CancelField).GetValue(item, null)) == true)
                {
                    strGift = (string)type.GetProperty("gegi").GetValue(item, null);

                    // si el regalo es manejado por un sistema externo
                    // y no es un paquete (solo aplica para el monedero electronico)
                    Gift _Gift = null;
                    if ((Common.IsExternalProduct(_EnumExternalProduct, strGift, ref _Gift)) && (_EnumExternalProduct != EnumExternalProduct.expElectronicPurse || _EnumExternalProduct == EnumExternalProduct.expElectronicPurse && _Gift.giPack))
                    {
                        // agregamos el regalo a la lista de regalos por cancelar
                        aGiftsToCancel.Add(strGift);

                        // Si es el monedero electronico
                        if (_EnumExternalProduct != EnumExternalProduct.expElectronicPurse)
                        {
                            if (await SisturHelper.CancelPromotionSistur(strGift, (string)type.GetProperty("gePVPPromotion").GetValue(item, null), cboProgram.SelectedValue.ToString(),
                                                                         cboLeadSource.SelectedValue.ToString(), PropertyOpera, _ReceiptID, txtReservation, GiftsCancelled))
                            {
                                // Cancelamos el regalo en origos
                                await BRGiftsReceipts.CancelGiftPromotionSistur(_ReceiptID, strGift);
                            }
                        }
                    }
                }
            }

            // si se cancelaron todos los regalos
            if (aGiftsToCancel.Count == GiftsCancelled.Count)
            {
                UIHelper.ShowMessage("Gifts were successfully cancelled", MessageBoxImage.Information, "Intelligence Marketing");
            }
            // si no se cancelaron todos los regalos
            else
            {
                // si no se pudo cancelar ningun regalo
                if (GiftsCancelled.Count <= 0)
                {
                    UIHelper.ShowMessage("Gifts were not cancelled", MessageBoxImage.Information, "Intelligence Marketing");
                }
                // si se pudo cancelar al menos un regalo
                else
                {
                    // recorremos los regalos que se deseaban cancelar
                    foreach (string _Gift in aGiftsToCancel)
                    {
                        // localizamos el regalo
                        Gift _giftResult = frmHost._lstGifts.Where(x => x.giID == _Gift).Single();

                        // buscamos el regalo en el arreglo de regalos cancelados
                        int iIndex = GiftsCancelled.IndexOf(_Gift);

                        // si el regalo fue cancelado
                        if (iIndex > 0)
                        {
                            GiftsCancellled += _giftResult.giN + "\r\n";
                        }
                        // si el regalo no fue cancelado
                        else
                        {
                            GiftsNotCancellled += _giftResult.giN + "\r\n";
                        }
                    }
                    UIHelper.ShowMessage("The following gifts were cancelled from the account: \r\n" + GiftsCancellled + "\r\n\r\n" + "But the following gifts were not cancelled from the account: \r\n" + GiftsNotCancellled, MessageBoxImage.Exclamation, "Intelligence Marketing");
                }
            }

            return(GiftsCancelled);
        }