/// <summary>
        /// Do Following Transactions [Fill,Bleed,Drop,Adjustment]
        /// </summary>
        /// <param name="vault_ID">Specify Device ID </param>
        /// <param name="VaultName">Specify Device Name </param>
        /// <param name="withdrawalflag">0 - [Fill], 1 - [Bleed,-ve adjustment]</param>
        /// <param name="vtype">Specify VaultTransactionType</param>
        /// <param name="transactiontype">Type must be "FILL" or "DROP"</param>
        /// <param name="transaction_reason_id">1- [Fill], 4-[Drop]</param>
        public CVaultFillCassette(int vault_ID, string VaultName, int withdrawalflag,
            VaultTransactionType vtype, string transactiontype, int transaction_reason_id,
            string Manufacturer, string TypePrefix, string TransactionReason, List<DenomCombo> lst_denoms, bool DropFollowedByFill, Action act_refresh)
        {
            InitializeComponent();

            _vaultid = vault_ID;
            _VaultName = VaultName;
            _withdrawalflag = withdrawalflag;
            _transactiontype = transactiontype;
            _transaction_reason_id = transaction_reason_id;
            _VType = vtype;
            _act_refresh = act_refresh;
            _isfinaldrop = (_VType == VaultTransactionType.FinalDrop);
            _isdroptransaction = (_VType == VaultTransactionType.StandardDrop) || _isfinaldrop;
            _isadjustment = (_VType == VaultTransactionType.NegativeAdjustment || _VType == VaultTransactionType.PositiveAdjustment);
            _isnegativechange = (_VType == VaultTransactionType.NegativeAdjustment || _VType == VaultTransactionType.Bleed);
            _lst_denoms = lst_denoms;
            txtManufacturer.Text = Manufacturer;
            txtTypePrefix.Text = TypePrefix;
            txtVault.Text = VaultName;
            txtNotes.Text = TransactionReason;
            txtNotes.IsEnabled = false;
            _DropFollowedByFill = DropFollowedByFill;
        }
Example #2
0
 public List<GetNGADetailsResult> GetCassetteDetails(List<DenomCombo> Denom, int vaultID, bool isDropTransaction, VaultTransactionType vtype)
 {
     return objVaultBiz.GetCassetteDetails(Denom ,vaultID, isDropTransaction,vtype);
 }
        public List<GetNGADetailsResult> GetCassetteDetails(List<DenomCombo> lst_denom, int vaultID, bool isDropTransaction, VaultTransactionType vtype)
        {
            List<GetNGADetailsResult> lst_NGA = new List<GetNGADetailsResult>();


            var redcolor = new System.Windows.Media.SolidColorBrush(Colors.DarkRed);
            var blackcolor = new System.Windows.Media.SolidColorBrush(Colors.Black);

            var BoldFont = System.Windows.FontWeights.Bold;

            var NormalFont = System.Windows.FontWeights.Normal;

            bool isFinalDrop = false;
            bool isStandardFill = false;
            bool isAdjustment = false;

            switch (vtype)
            {
                case VaultTransactionType.NegativeAdjustment:
                case VaultTransactionType.PositiveAdjustment:
                    isAdjustment = true;
                    break;
                case VaultTransactionType.FinalDrop:
                    isFinalDrop = true;
                    break;
                case VaultTransactionType.StandardFill:
                    isStandardFill = true;
                    break;
            }
            bool _EnableTotal = (isAdjustment ? false : (!isDropTransaction));

            Func<int, bool, bool> fn_FillRejection = (int CassetteTypeID, bool FillRejection) =>
            {
                if (CassetteTypeID == (int)CassetteTypes.RejectionCassette)
                {
                    if (vtype == VaultTransactionType.StandardFill || vtype == VaultTransactionType.Fill)
                    {
                        return FillRejection;
                    }
                    else if (vtype == VaultTransactionType.Bleed)
                    {
                        return false;
                    }
                    else
                    {
                        return true;
                    }
                }
                else
                {
                    return true;
                }
            };
            lst_NGA = (from c in objVaultDataAccess.GetCassetteDetails(vaultID)
                       select new GetNGADetailsResult
                       {
                           Alert_Level = c.Alert_Level,
                           Capacity = c.Capacity,
                           Cassette_ID = c.Cassette_ID,
                           Cassette_Name = c.Cassette_Name,
                           Cassette_Type = c.Cassette_Type,
                           CassetteAlertLevel = c.CassetteAlertLevel,
                           Created_Date = c.Created_Date,
                           CurrentBalance = c.CurrentBalance,//dont change order or else u get exception
                           Quantity = isStandardFill ? c.StandardQuantity : (isAdjustment ? Convert.ToInt32((c.CurrentBalance.Value) / Convert.ToDecimal(c.Denom)) : 0),
                           CanChangeDenom = (isStandardFill) && (c.CanChangeDenom ?? false),
                           Denom = c.Denom,
                           Manufacturer = c.Manufacturer,
                           MaxBleedAmount = c.MaxBleedAmount,
                           MaxFillAmount = c.MaxFillAmount,
                           MinBleedAmount = c.MinBleedAmount,
                           MinFillAmount = c.MinFillAmount,
                           Serial_No = c.Serial_No,
                           StandardFillAmount = c.StandardFillAmount,
                           VaultType = c.VaultType,
                           Amount = isStandardFill ? c.StandardFillAmount : (isAdjustment ? (c.CurrentBalance.Value) : 0.0m),
                           Total = isStandardFill ? (c.StandardFillAmount + c.CurrentBalance ?? 0) : (c.CurrentBalance ?? 0.00m),
                           IsChecked = fn_FillRejection(c.Cassette_Type, c.FillRejection.Value),
                           IsNotFinalDrop = isFinalDrop ? false : (isAdjustment ? false : fn_FillRejection(c.Cassette_Type, c.FillRejection.Value)),
                           IsDROP = (!isDropTransaction),
                           EnableTotal = _EnableTotal,
                           lstDenoms = lst_denom.FindAll(o => o.CassetteTypes == c.Cassette_Type),
                           EnableControls = true,
                           FontColor = blackcolor,
                           DroppedRecently = c.DroppedRecently ?? false,
                           CustomFontWeight = NormalFont,
                           IsStandardFill = isStandardFill,
                           FillRejection = c.FillRejection ?? false,
                           OldAmount = isStandardFill ? c.StandardFillAmount : 0.00m//amount

                       }).ToList<GetNGADetailsResult>();



            if (lst_NGA != null && lst_NGA.Count > 0)
            {
                decimal tot_currentbal = lst_NGA.Sum(c => c.CurrentBalance ?? 0.00m);
                decimal tot_standardamount = lst_NGA.Sum(c => c.StandardFillAmount);
                lst_NGA.Add(new GetNGADetailsResult
                {
                    Alert_Level = 0,
                    Capacity = 0,
                    Cassette_ID = 0,
                    Cassette_Name = "Total",
                    Cassette_Type = 0,
                    CassetteAlertLevel = 0,
                    Created_Date = null,
                    CurrentBalance = tot_currentbal,//dont change order or else u get exception
                    Quantity = 0,
                    CanChangeDenom = false,
                    Denom = 0,
                    Manufacturer = "",
                    MaxBleedAmount = 0,
                    MaxFillAmount = 0,
                    MinBleedAmount = 0,
                    MinFillAmount = 0,
                    Serial_No = "",
                    StandardFillAmount = 0,
                    VaultType = "",
                    Amount = isStandardFill ? tot_standardamount : (isAdjustment ? (tot_currentbal) : 0.0m),
                    Total = isStandardFill ? (tot_standardamount + tot_currentbal) : tot_currentbal,
                    IsChecked = false,
                    IsNotFinalDrop = false,
                    IsDROP = false,
                    lstDenoms = null,
                    EnableControls = false,
                    DroppedRecently = false,
                    FontColor = redcolor,
                    CustomFontWeight = BoldFont,
                    OldAmount = 0
                });
            }
            return lst_NGA;
        }
Example #4
0
 public List <GetNGADetailsResult> GetCassetteDetails(List <DenomCombo> Denom, int vaultID, bool isDropTransaction, VaultTransactionType vtype)
 {
     return(objVaultBiz.GetCassetteDetails(Denom, vaultID, isDropTransaction, vtype));
 }
Example #5
0
        public List <GetNGADetailsResult> GetCassetteDetails(List <DenomCombo> lst_denom, int vaultID, bool isDropTransaction, VaultTransactionType vtype)
        {
            List <GetNGADetailsResult> lst_NGA = new List <GetNGADetailsResult>();


            var redcolor   = new System.Windows.Media.SolidColorBrush(Colors.DarkRed);
            var blackcolor = new System.Windows.Media.SolidColorBrush(Colors.Black);

            var BoldFont = System.Windows.FontWeights.Bold;

            var NormalFont = System.Windows.FontWeights.Normal;

            bool isFinalDrop    = false;
            bool isStandardFill = false;
            bool isAdjustment   = false;

            switch (vtype)
            {
            case VaultTransactionType.NegativeAdjustment:
            case VaultTransactionType.PositiveAdjustment:
                isAdjustment = true;
                break;

            case VaultTransactionType.FinalDrop:
                isFinalDrop = true;
                break;

            case VaultTransactionType.StandardFill:
                isStandardFill = true;
                break;
            }
            bool _EnableTotal = (isAdjustment ? false : (!isDropTransaction));

            Func <int, bool, bool> fn_FillRejection = (int CassetteTypeID, bool FillRejection) =>
            {
                if (CassetteTypeID == (int)CassetteTypes.RejectionCassette)
                {
                    if (vtype == VaultTransactionType.StandardFill || vtype == VaultTransactionType.Fill)
                    {
                        return(FillRejection);
                    }
                    else if (vtype == VaultTransactionType.Bleed)
                    {
                        return(false);
                    }
                    else
                    {
                        return(true);
                    }
                }
                else
                {
                    return(true);
                }
            };

            lst_NGA = (from c in objVaultDataAccess.GetCassetteDetails(vaultID)
                       select new GetNGADetailsResult
            {
                Alert_Level = c.Alert_Level,
                Capacity = c.Capacity,
                Cassette_ID = c.Cassette_ID,
                Cassette_Name = c.Cassette_Name,
                Cassette_Type = c.Cassette_Type,
                CassetteAlertLevel = c.CassetteAlertLevel,
                Created_Date = c.Created_Date,
                CurrentBalance = c.CurrentBalance,           //dont change order or else u get exception
                Quantity = isStandardFill ? c.StandardQuantity : (isAdjustment ? Convert.ToInt32((c.CurrentBalance.Value) / Convert.ToDecimal(c.Denom)) : 0),
                CanChangeDenom = (isStandardFill) && (c.CanChangeDenom ?? false),
                Denom = c.Denom,
                Manufacturer = c.Manufacturer,
                MaxBleedAmount = c.MaxBleedAmount,
                MaxFillAmount = c.MaxFillAmount,
                MinBleedAmount = c.MinBleedAmount,
                MinFillAmount = c.MinFillAmount,
                Serial_No = c.Serial_No,
                StandardFillAmount = c.StandardFillAmount,
                VaultType = c.VaultType,
                Amount = isStandardFill ? c.StandardFillAmount : (isAdjustment ? (c.CurrentBalance.Value) : 0.0m),
                Total = isStandardFill ? (c.StandardFillAmount + c.CurrentBalance ?? 0) : (c.CurrentBalance ?? 0.00m),
                IsChecked = fn_FillRejection(c.Cassette_Type, c.FillRejection.Value),
                IsNotFinalDrop = isFinalDrop ? false : (isAdjustment ? false : fn_FillRejection(c.Cassette_Type, c.FillRejection.Value)),
                IsDROP = (!isDropTransaction),
                EnableTotal = _EnableTotal,
                lstDenoms = lst_denom.FindAll(o => o.CassetteTypes == c.Cassette_Type),
                EnableControls = true,
                FontColor = blackcolor,
                DroppedRecently = c.DroppedRecently ?? false,
                CustomFontWeight = NormalFont,
                IsStandardFill = isStandardFill,
                FillRejection = c.FillRejection ?? false,
                OldAmount = isStandardFill ? c.StandardFillAmount : 0.00m           //amount
            }).ToList <GetNGADetailsResult>();



            if (lst_NGA != null && lst_NGA.Count > 0)
            {
                decimal tot_currentbal     = lst_NGA.Sum(c => c.CurrentBalance ?? 0.00m);
                decimal tot_standardamount = lst_NGA.Sum(c => c.StandardFillAmount);
                lst_NGA.Add(new GetNGADetailsResult
                {
                    Alert_Level        = 0,
                    Capacity           = 0,
                    Cassette_ID        = 0,
                    Cassette_Name      = "Total",
                    Cassette_Type      = 0,
                    CassetteAlertLevel = 0,
                    Created_Date       = null,
                    CurrentBalance     = tot_currentbal,//dont change order or else u get exception
                    Quantity           = 0,
                    CanChangeDenom     = false,
                    Denom              = 0,
                    Manufacturer       = "",
                    MaxBleedAmount     = 0,
                    MaxFillAmount      = 0,
                    MinBleedAmount     = 0,
                    MinFillAmount      = 0,
                    Serial_No          = "",
                    StandardFillAmount = 0,
                    VaultType          = "",
                    Amount             = isStandardFill ? tot_standardamount : (isAdjustment ? (tot_currentbal) : 0.0m),
                    Total              = isStandardFill ? (tot_standardamount + tot_currentbal) : tot_currentbal,
                    IsChecked          = false,
                    IsNotFinalDrop     = false,
                    IsDROP             = false,
                    lstDenoms          = null,
                    EnableControls     = false,
                    DroppedRecently    = false,
                    FontColor          = redcolor,
                    CustomFontWeight   = BoldFont,
                    OldAmount          = 0
                });
            }
            return(lst_NGA);
        }