예제 #1
0
        /// <summary>
        /// Valida el recibo exchange
        /// </summary>
        /// <returns></returns>
        /// <history>
        /// [vipacheco] 16/Mayo/2016 Created
        /// </history>
        private bool ValidateGiftsReceiptExchange()
        {
            // Si se debe generar un recibo exchange
            if (_Exchange)
            {
                // Validamos que no este en modo edicion
                if (GridHelper.IsInEditMode(dtgExchange))
                {
                    UIHelper.ShowMessage("The grid Gifts Receipt Exchange this mode edition");
                    return(false);
                }
                // validamos los regalos de intercambio
                if (!GiftsExchange.Validate(dtgExchange))
                {
                    return(false);
                }
                // validamos que no se vayan a duplicar los regalos en el recibo exchange
                else if (!ValidateGiftsRepeated())
                {
                    return(false);
                }
            }

            return(true);
        }
예제 #2
0
        /// <summary>
        /// Valida que no se vayan a duplicar los regalos en el recibo exchange
        /// </summary>
        /// <returns></returns>
        /// <history>
        /// [vipacheco] 16/Mayo/2016 Created
        /// </history>
        private bool ValidateGiftsRepeated()
        {
            List <string> aGiftsCancelled = GiftsCancel.GetItems(dtgCancel, EnumCheckedStatus.Checked, _CancelField);
            List <string> aGiftsExchange  = GiftsExchange.GetItems(dtgExchange);

            // si tiene regalos de intercambio
            if (aGiftsExchange.Count > 0)
            {
                // Recorremos los regalos de intercambio
                foreach (string item in aGiftsExchange)
                {
                    string result = aGiftsCancelled.Where(x => x == item).SingleOrDefault();

                    // si el regalo de intercambio esta en los regalos cancelados
                    if (result != null && result != "")
                    {
                        // localizamos el regalo
                        Gift _Gift = frmHost._lstGifts.Where(x => x.giID == result).First();
                        UIHelper.ShowMessage(" The Gift '" + _Gift.giN + "' from 'Gifts exchange' can not be added \r\n" +
                                             "to receipt exchange because would ve repeated. \r\n \r\n" +
                                             "To solve this situation, delete this gift from 'Gifts exchange' \r\n" +
                                             "or not cancel it from 'Gifts to cancel'", MessageBoxImage.Exclamation);
                        return(false);
                    }
                }
            }

            return(true);
        }
예제 #3
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);
                }
            }
        }