Example #1
0
        public static string GetBoxContentStr(VoucherType type, Barcode_Model barcode)
        {
            PrintLibrary.Barcode_Model PrintInfo = GetPrintBarcodeByServiceBarcode(barcode);
            if (PrintInfo == null)
            {
                return(string.Empty);
            }

            switch (type)
            {
            case VoucherType.采购订单:
                return(PrintLibrary.PrintLibrary_Func.GetPurchaseReceiveInnerContentStr(GetPrintBarcodeByServiceBarcode(barcode), Print_Var.OutboxDPI));

            case VoucherType.任意单据:
            case VoucherType.送货单:
                return(PrintLibrary.PrintLibrary_Func.GetDeliveryReceiceOutContentStr(PrintInfo, Print_Var.OutboxDPI));

            case VoucherType.无过账快速入:
            case VoucherType.需过账快速入:
                PrintInfo.DELIVERYNO = barcode.TrackNo;
                return(PrintLibrary.PrintLibrary_Func.GetDeliveryReceiceOutContentStr(PrintInfo, Print_Var.OutboxDPI));

            case VoucherType.生产订单:
                return(PrintLibrary.PrintLibrary_Func.GetProductionOrderOutContentStr(PrintInfo, Print_Var.OutboxDPI));

            case VoucherType.生产退料:
            //return PrintLibrary.PrintLibrary_Func.GetProductionReturnOutContentStr(PrintInfo, Print_Var.OutboxDPI);

            case VoucherType.检验退料单:
                return(PrintLibrary.PrintLibrary_Func.GetQualityReturnOutContentStr(PrintInfo, Print_Var.OutboxDPI));

            default:
                return(string.Empty);
            }
        }
Example #2
0
        public static string GetBoxClearStr(VoucherType type)
        {
            switch (type)
            {
            case VoucherType.采购订单:
                return(PrintLibrary.PrintLibrary_Func.GetPurchaseReceiveInnerClearStr());

            case VoucherType.任意单据:
            case VoucherType.无过账快速入:
            case VoucherType.需过账快速入:
            case VoucherType.送货单:
                return(PrintLibrary.PrintLibrary_Func.GetDeliveryReceiceOutClearStr());

            case VoucherType.生产订单:
                return(PrintLibrary.PrintLibrary_Func.GetProductionOrderOutClearStr());

            case VoucherType.生产退料:
            //return PrintLibrary.PrintLibrary_Func.GetProductionReturnOutClearStr();

            case VoucherType.检验退料单:
                return(PrintLibrary.PrintLibrary_Func.GetQualityReturnOutClearStr());

            default:
                return(string.Empty);
            }
        }
        /// <summary>
        /// Returns the VoucherList with the given filters and page settings.
        /// </summary>
        /// <param name="type"></param>
        /// <param name="status"></param>
        /// <param name="archived"></param>
        /// <param name="page"></param>
        /// <param name="pageSize"></param>
        /// <returns></returns>
        public LexOfficeResponse <ResourcePage <VoucherListEntry> > GetVoucherList(VoucherType type, VoucherStatus status, VoucherListArchived archived, int page = 0, int pageSize = 25)
        {
            var result   = PrepareVoucherListString(type, status, archived, page, pageSize);
            var response = client.SendGetRequest <ResourcePage <VoucherListEntry> >(result);

            return(new LexOfficeResponse <ResourcePage <VoucherListEntry> >(response));
        }
 private void ExecuteLoad(object obj)
 {
     if (obj != null)
     {
         byte id = Convert.ToByte(obj);
         if (!VTypeList.Any(x => x.VoucherId == id))
         {
             MessageBox.Show("Invalid Id.", MessageBoxCaption, MessageBoxButton.OK, MessageBoxImage.Exclamation);
             return;
         }
         SelectedVType = VTypeList.FirstOrDefault(x => x.VoucherId == id);
     }
     VType = new VoucherType
     {
         VoucherId             = SelectedVType.VoucherId,
         VoucherName           = SelectedVType.VoucherName,
         Rate                  = SelectedVType.Rate,
         RateStr               = SelectedVType.RateStr,
         Value                 = SelectedVType.Value,
         ValidStart            = SelectedVType.ValidStart,
         ValidEnd              = SelectedVType.ValidEnd,
         Validity              = SelectedVType.Validity,
         VehicleType           = SelectedVType.VehicleType,
         VoucherInfo           = SelectedVType.VoucherInfo,
         SkipVoucherGeneration = SelectedVType.SkipVoucherGeneration,
         NonVat                = SelectedVType.NonVat
     };
     SetAction(ButtonAction.Selected);
 }
Example #5
0
        public async Task <IActionResult> Create([FromBody] CreateViewModel model)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            VoucherType modelo = new VoucherType
            {
                Description = model.Description,
                CompanyId   = model.CompanyId,
                Enabled     = true
            };


            _context.VoucherTypes.Add(modelo);
            try
            {
                await _context.SaveChangesAsync();
            }
            catch
            {
                return(BadRequest());
            }

            return(Ok());
        }
        public async Task <SuccessResponseVM> Handle(CreateVoucherType command, CancellationToken cancellationToken)
        {
            var result = new SuccessResponseVM();

            var request = command.Payload.VoucherType;
            var actor   = command.Actor.Name;

            using (var role = _vocTypeRepository.CreateTransaction((int)IsolationLevel.Serializable))
            {
                try
                {
                    VoucherType data = new VoucherType
                    {
                        Name = request.Name
                    };
                    _vocTypeRepository.SetActor(actor);

                    var roleCreated = await _vocTypeRepository.CreateAsync(data);

                    result.IsSuccess = true;

                    await _vocTypeRepository.CommitTransaction(role);
                }
                catch (Exception ex)
                {
                    await _vocTypeRepository.RollbackTransaction(role);

                    throw ex;
                }
            }

            return(result);
        }
 /// <summary>
 ///     解析记账凭证类别表达式
 /// </summary>
 /// <param name="s">表达式</param>
 /// <param name="typeT">记账凭证类别</param>
 /// <returns>是否解析成功</returns>
 private static bool TryParse(string s, out VoucherType typeT)
 {
     // Don't use Enum.TryParse here:
     // Enum.TryParse("1001", out _) gives true
     switch (s)
     {
         case "Ordinary":
             typeT = VoucherType.Ordinary;
             return true;
         case "Carry":
             typeT = VoucherType.Carry;
             return true;
         case "AnnualCarry":
             typeT = VoucherType.AnnualCarry;
             return true;
         case "Depreciation":
             typeT = VoucherType.Depreciation;
             return true;
         case "Devalue":
             typeT = VoucherType.Devalue;
             return true;
         case "Amortization":
             typeT = VoucherType.Amortization;
             return true;
         case "Uncertain":
             typeT = VoucherType.Uncertain;
             return true;
         default:
             typeT = VoucherType.General;
             return false;
     }
 }
        private void ProcessVouchers(IEnumerable <OcrVoucher> vouchers, VoucherType voucherType)
        {
            var voucherActions = new Dictionary <VoucherType, Func <A2iATableConfig> >
            {
                { VoucherType.Credit, () => new A2iATableConfig(configuration.CreditTablePath, configuration.CreditMaxProcessorCount) },
                { VoucherType.Debit, () => new A2iATableConfig(configuration.DebitTablePath, configuration.DebitMaxProcessorCount) }
            };

            var voucherSubset = vouchers.Where(v => v.VoucherType == voucherType);
            var tableConfig   = voucherActions[voucherType].Invoke();

            a2iAOcrServices[voucherType].OpenOcrChannel(tableConfig.TableFilename, tableConfig.ProcessorCount);

            var ocrVouchers = vouchers as IList <OcrVoucher> ?? voucherSubset.ToList();

            foreach (var voucher in ocrVouchers)
            {
                a2iAOcrServices[voucherType].ProcessVoucher(voucher);
            }

            foreach (var voucher in ocrVouchers)
            {
                a2iAOcrServices[voucherType].GetIcrChannelResult(voucher);
            }
        }
        public async Task <IActionResult> PutVoucherType([FromRoute] int id, [FromBody] VoucherType voucherType)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != voucherType.Voucher_Type_Id)
            {
                return(BadRequest());
            }

            _context.Entry(voucherType).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!VoucherTypeExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
        private void ProcessVouchers(IEnumerable<OcrVoucher> vouchers, VoucherType voucherType)
        {
            var voucherTable = new Dictionary<VoucherType, string>
            {
                {VoucherType.Credit, "Credit"},
                {VoucherType.Debit, "Debit"}
            };

            var voucherSubset = vouchers.Where(v => v.VoucherType == voucherType);
            var enumerable = voucherSubset as IList<OcrVoucher> ?? voucherSubset.ToList();
            if (!enumerable.Any()) return;
            a2iAOcrService.SelectDocumentTable(voucherTable[voucherType]);
            Debug.WriteLine("Process {0} vouchers of type {1}", enumerable.Count, voucherType);
            var ocrVouchers = enumerable.ToList();
            foreach (var voucher in ocrVouchers)
            {
                a2iAOcrService.ProcessVoucher(voucher);
                Log.Debug("Adding voucher id {0} with request id {1} to queue", voucher.Id, voucher.RequestId);
                voucherQueue.Add(voucher);
            }

            while (!voucherQueue.IsCompleted)
            {
                OcrVoucher voucher = null;

                try
                {
                    voucher = voucherQueue.Take();
                }
                catch (InvalidOperationException) { }
                if (voucher == null) continue;
                Log.Debug("Retrieving voucher id {0} with request id {1} to queue", voucher.Id, voucher.RequestId);
                a2iAOcrService.GetIcrChannelResult(voucher);
            }
        }
Example #11
0
 public Voucher(String voucherCode, Decimal VoucherPrice, Currencies VoucherCurrency, VoucherType VoucherType)
 {
     Price    = VoucherPrice;
     Currency = VoucherCurrency;
     Type     = VoucherType;
     Code     = voucherCode;
 }
        public bool Update(VoucherType voucherType)
        {
            MySoftCorporationDbContext mySoftCorporationDbContext = new MySoftCorporationDbContext();

            mySoftCorporationDbContext.Entry(voucherType).State = EntityState.Modified;
            return(mySoftCorporationDbContext.SaveChanges() > 0);
        }
        private async Task GenerateVouchers(SqlTransaction tran, string BillNo)
        {
            string Status = "{0} of " + TotQty.ToString() + " Done";

            await Task.Run(() =>
            {
                for (int i = 1; i <= TotQty; i++)
                {
                    VoucherType vt = SelectedVoucherType;

                    Voucher v = new Voucher()
                    {
                        BillNo      = BillNo,
                        ExpDate     = DateTime.Today.AddDays(vt.Validity),
                        ValidStart  = vt.ValidStart,
                        ValidEnd    = vt.ValidEnd,
                        VoucherName = vt.VoucherName,
                        Value       = vt.Value,
                        Sno         = i,
                        VoucherId   = vt.VoucherId,
                        FYID        = GlobalClass.FYID
                    };
                    do
                    {
                        v.Barcode = "#" + new Random().Next(1677215).ToString("X");
                    }while (tran.Connection.ExecuteScalar <int>("SELECT COUNT(*) FROM ParkingVouchers WHERE Barcode = @Barcode", v, transaction: tran) > 0);
                    v.Save(tran);
                    // ParkingVouchers.Add(v);
                    GenCount = string.Format(Status, i);
                    Progress = i / TotQty * 100;
                }
            });
        }
Example #14
0
        public override TaskList GetTask()
        {
            //string sql = "SELECT * FROM " + headtable + " WHERE operflag = 0 ";

            string sql = " SELECT distinct T.* FROM " + headtable + " T WITH(NOLOCK) ";

            sql += " INNER JOIN " + bodytable + " B WITH(NOLOCK) ON T.id = B.id  ";
            sql += " INNER JOIN MES_CQ_RdRecords11 MB WITH(NOLOCK) ON MB.MoCode = B.MoCode ";
            sql += " INNER JOIN MES_CQ_RdRecord11 MT WITH(NOLOCK) ON MT.id = MB.id  AND MT.operflag = 1  and T.opertype = MT.opertype and T.operflag = 0";

            string    curid = "";
            DataTable dt    = new DataTable();

            dt = DbHelperSQL.Query(sql).Tables[0];
            if (null == dt || dt.Rows.Count == 0)
            {
                return(null);
            }
            TaskList tl = new TaskList();

            for (int i = 0; i < dt.Rows.Count; i++)
            {
                Task        t = new Task();
                VoucherType v = new VoucherType();
                v.SourceCardNo = "MO21";
                //v.SourceVoucherNo = dt.Rows[i][""].ToString();
                v.CardNo      = cardNo;
                v.VoucherName = "产成品入库单";
                t.VouchType   = v;
                t.taskType    = 0; //MES接口任务
                t.OperType    = (int)dt.Rows[i]["OperType"];
                try
                {
                    t.id = dt.Rows[i]["id"].ToString();  //int.Parse(dt.Rows[i]["id"].ToString());
                }
                catch (Exception ee)
                {
                    BLL.Common.ErrorMsg(SysInfo.productName, "id 值出错!");
                }
                try
                {
                    t.OperType = int.Parse(dt.Rows[i]["opertype"].ToString());
                }
                catch (Exception ee)
                {
                    BLL.Common.ErrorMsg(SysInfo.productName, "opertype 值出错!");
                }
                tl.Add(t);
                curid += "'" + t.id + "',";
                break;
            }
            if (!string.IsNullOrEmpty(curid))
            {
                curid = curid.Substring(0, curid.Length - 1);
                string[] ids  = curid.Split(',');
                string   msql = " update " + headtable + " set " + taskStatusflagColName + " = 2 where id in (" + ids[0] + ") ";
                DbHelperSQL.ExecuteSql(msql);
            }
            return(tl);
        }
Example #15
0
      public ActionResult EditVoucherType(int id)
      {
          VoucherType voucherType = voucherTypes.GetById(id);


          return(View(voucherType));
      }
Example #16
0
      public ActionResult EditVoucherType(VoucherType voucherType)
      {
          voucherTypes.Update(voucherType);
          voucherTypes.Commit();

          return(RedirectToAction("VoucherTypeList"));
      }
Example #17
0
 public ActionResult VoucherType(VoucherType obj)
 {
     try
     {
         if (obj_vouchertype.Save(obj))
         {
             if (obj.VoucherTypeID > 0)
             {
                 ModelState.Clear();
                 TempData["msg"] = " VoucherType Updated Successfully";
                 return(RedirectToAction("VoucherType", "VoucherType"));
             }
             else
             {
                 ModelState.Clear();
                 TempData["msg"] = " VoucherType Saved Successfully";
                 return(RedirectToAction("VoucherType", "VoucherType"));
             }
         }
         else
         {
             TempData["msg"] = "VoucherType Not Save";
         }
         return(RedirectToAction("VoucherType", "VoucherType"));
     }
     catch (Exception)
     {
         return(RedirectToAction("VoucherType", "VoucherType"));
     }
 }
Example #18
0
      public ActionResult CreateVoucherType(VoucherType voucherType)
      {
          voucherTypes.Insert(voucherType);
          voucherTypes.Commit();

          return(RedirectToAction("VoucherTypeList"));
      }
Example #19
0
        private bool PrintRow(Barcode_Model barcode, int iPrintQty, ref string sPrintCode)
        {
            VoucherType type     = (VoucherType)barcode.VOUCHERTYPE.ToInt32();
            string      strLogo  = Print_Func.GetBoxLogoStr(type);
            string      strClear = Print_Func.GetBoxClearStr(type);
            string      strOnce  = Print_Func.GetBoxContentStr(type, barcode);

            if (string.IsNullOrEmpty(strOnce))
            {
                return(Common.Common_Func.ErrorMessage("外箱标签 " + barcode.SERIALNO + " 打印失败", "打印失败"));
            }


            string strContent = string.Empty;

            for (int i = 1; i <= iPrintQty; i++)
            {
                strContent += strOnce;
            }

            sPrintCode += strLogo;
            sPrintCode += strContent;
            sPrintCode += strClear;
            return(true);
        }
Example #20
0
        public void AddVoucher(string voucherCode, HttpContextBase httpContext)
        {
            Basket  basket  = GetBasket(httpContext);
            Voucher voucher = vouchers.GetAll().FirstOrDefault(v => v.VoucherCode == voucherCode);

            if (voucher != null)
            {
                VoucherType voucherType = voucherTypes.GetById(voucher.VoucherTypeId);
                if (voucher != null)
                {
                    BasketVoucher basketVoucher = new BasketVoucher();

                    try
                    {
                        // modulen måste aktiveras igenom att använda de fullständiga namnet av classen o innhållande projekt
                        // alltså : fullständiga namnet av klassen ska innehålla namespace ->
                        // alltså : eCommerce.Modules.Vouchers.MoneyOff.eVoucher,eCommerce.Modules.Vouchers.MoneyOff

                        IeVoucher voucherProcessor = Activator.CreateInstance(Type.GetType(voucherType.VoucherModule)) as IeVoucher;
                        voucherProcessor.ProcessVoucher(voucher, basket, basketVoucher);
                    }
                    catch (Exception ex)
                    {
                        basketVoucher.VoucherDescription = ex.ToString();
                    }

                    baskets.Commit();
                }
            }
        }
        public ActionResult Create(string selectedVoucher)
        {
            if (ModelState.IsValid)
            {
                VoucherType voucherType = new VoucherType();
                voucherType = db.VoucherTypes.Find(Int32.Parse(selectedVoucher));
                Guid guid    = Guid.NewGuid();
                var  voucher = new Voucher
                {
                    VoucherType   = voucherType,
                    Guid          = guid.ToString(),
                    Sender_Id     = int.Parse(User.Identity.GetUserId()),
                    Receiver_Id   = int.Parse(User.Identity.GetUserId()),
                    ActionType_Id = 0,
                    SpendFlag     = false,
                    CreatedOn     = DateTime.UtcNow,
                    UpdatedOn     = DateTime.UtcNow
                };
                db.Vouchers.Add(voucher);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(RedirectToAction("Create"));
        }
Example #22
0
        public void AddVoucher(string voucherCode, HttpContextBase httpContext)
        {
            Basket  basket  = GetBasket(httpContext);
            Voucher voucher = vouchers.GetAll().FirstOrDefault(v => v.VoucherCode == voucherCode);

            if (voucher != null)
            {
                VoucherType voucherType = voucherTypes.GetById(voucher.VoucherTypeId);
                if (voucherType != null)
                {
                    BasketVoucher basketVoucher = new BasketVoucher();
                    try
                    {
                        IeVoucher voucherProcessor = Activator.CreateInstance(Type.GetType(voucherType.VoucherModule)) as IeVoucher;
                        voucherProcessor.ProcessVoucher(voucher, basket, basketVoucher);
                    }
                    catch (Exception)
                    {
                        throw;
                    }
                    //BasketVoucher basketVoucher = new BasketVoucher();
                    //if (voucherType.Type == "MoneyOff")
                    //{
                    //    MoneyOff(voucher, basket, basketVoucher);
                    //}
                    //if (voucherType.Type == "PercentOff")
                    //{
                    //    PercentOff(voucher, basket, basketVoucher);
                    //}
                    baskets.Commit();
                }
            }
        }
        public static VoucherType ToVoucherType(this BaseVoucherTypeModel voucherType)
        {
            VoucherType _result = new VoucherType();

            if (voucherType.Id.HasValue)
            {
                _result.Id = voucherType.Id.GetValueOrDefault();
            }
            _result.VoucherTypeName          = voucherType.VoucherTypeName;
            _result.TypeOfVoucher            = voucherType.TypeOfVoucher;
            _result.MethodOfVoucherNumbering = voucherType.MethodOfVoucherNumbering;
            _result.IsTaxApplicable          = voucherType.IsTaxApplicable;
            _result.Narration    = voucherType.Narration;
            _result.IsActive     = voucherType.IsActive;
            _result.IsDefault    = voucherType.IsDefault;
            _result.Declaration  = voucherType.Declaration;
            _result.HeadingOne   = voucherType.HeadingOne;
            _result.HeadingTwo   = voucherType.HeadingTwo;
            _result.HeadingThree = voucherType.HeadingThree;
            _result.HeadingFour  = voucherType.HeadingFour;
            _result.CreatedDate  = voucherType.CreatedDate;
            _result.ModifiedDate = voucherType.ModifiedDate;
            _result.MasterId     = voucherType.MasterId;
            return(_result);
        }
 public VoucherTypeViewModel()
 {
     MessageBoxCaption = "Voucher Type Setup";
     VType             = new VoucherType();
     try
     {
         using (SqlConnection Conn = new SqlConnection(GlobalClass.TConnectionString))
         {
             string strSql = @"SELECT VoucherId, VoucherName, VehicleType, Rate, Value, Validity, ValidStart, ValidEnd, VoucherInfo, SkipVoucherGeneration, ISNULL(NonVat, 0) NonVat FROM VoucherTypes";
             VTypeList       = new ObservableCollection <VoucherType>(Conn.Query <VoucherType>(strSql));
             strSql          = @"SELECT VTypeID, [Description] FROM VehicleType";
             VehicleTypeList = new ObservableCollection <VehicleType>(Conn.Query <VehicleType>(strSql));
             VehicleTypeList.Add(new VehicleType {
                 VTypeID = 0, Description = "All Vehicle Type"
             });
         }
         LoadData      = new RelayCommand(ExecuteLoad, CanExecuteLoad);
         NewCommand    = new RelayCommand(ExecuteNew);
         EditCommand   = new RelayCommand(ExecuteEdit);
         SaveCommand   = new RelayCommand(ExecuteSave);
         UndoCommand   = new RelayCommand(ExecuteUndo);
         DeleteCommand = new RelayCommand(ExecuteDelete);
         SetAction(ButtonAction.Init);
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message, MessageBoxCaption, MessageBoxButton.OK, MessageBoxImage.Error);
     }
 }
 public static Voucher Create(string dt, VoucherType type) => new Voucher
 {
     Date    = dt.ToDateTime(),
     Type    = type,
     Remark  = " t 't\"-.\" %@!@#$%^&*( ",
     Details = new List <VoucherDetail>
     {
         new VoucherDetail
         {
             User     = "******",
             Currency = "JPY",
             Title    = 1001,
             Content  = "%@!@#$%^&*(\nas\rdf\\",
             Fund     = 123.45,
         },
         new VoucherDetail
         {
             User     = "******",
             Currency = "USD",
             Title    = 1002,
             SubTitle = 12,
             Fund     = -123.45,
             Remark   = "\\qw\ter%@!@#$%^&*(%",
         },
         new VoucherDetail
         {
             User     = "******",
             Currency = "EUR",
             Title    = 5555,
             Fund     = -5,
             Remark   = "  7' 46r0*\" &)%\" *%)^ Q23'4",
         },
     },
 };
Example #26
0
 public Voucher(string code, string type, int value, int currentUses, int maxUses)
 {
     _code        = code;
     _type        = VoucherUtility.GetType(type);
     _value       = value;
     _currentUses = currentUses;
     _maxUses     = maxUses;
 }
Example #27
0
        public FrmInnerBarcodePrint()
        {
            InitializeComponent();

            Common.Common_Func.DelDataGridViewSortable(dgvList);

            _type = VoucherType.任意单据;
        }
Example #28
0
        public NewVoucher Create(VoucherType voucherType)
        {
            var voucher = new VoucherDto(voucherType);

            _vouchers.Add(voucher.Id, voucher);

            return(new NewVoucher(voucher.Id, voucher.VoucherType));
        }
Example #29
0
      public ActionResult DeleteVoucherType(int id)
      {
          VoucherType voucherType = voucherTypes.GetById(id);

          voucherTypes.Delete(id);
          voucherTypes.Commit();
          return(RedirectToAction("VoucherTypeList"));
      }
 public Voucher(string Code, string Type, int Value, int CurrentUses, int MaxUses)
 {
     this._code        = Code;
     this._type        = VoucherUtility.GetType(Type);
     this._value       = Value;
     this._currentUses = CurrentUses;
     this._maxUses     = MaxUses;
 }
 public bool Delete(VoucherType voucherType)
 {
     using (var context = new MySoftCorporationDbContext())
     {
         context.Entry(voucherType).State = EntityState.Deleted;
         return(context.SaveChanges() > 0);
     }
 }
Example #32
0
 public Voucher(string Code, string Type, int Value, int CurrentUses, int MaxUses)
 {
     this._code = Code;
     this._type = VoucherUtility.GetType(Type);
     this._value = Value;
     this._currentUses = CurrentUses;
     this._maxUses = MaxUses;
 }
Example #33
0
 public static string FromType(VoucherType Type)
 {
     switch (Type)
     {
         default:
         case VoucherType.CREDIT:
             return "credit";
         case VoucherType.DUCKET:
             return "ducket";
     }
 }
Example #34
0
 public void SetVoucherType(VoucherType voucherType)
 {
     VoucherType = voucherType;
 }
        private void ProcessVouchers(IEnumerable<OcrVoucher> vouchers, VoucherType voucherType)
        {
            var voucherActions = new Dictionary<VoucherType, Func<A2iATableConfig>>
            {
                { VoucherType.Credit, () => new A2iATableConfig(configuration.CreditTablePath, configuration.CreditMaxProcessorCount) },
                { VoucherType.Debit, () => new A2iATableConfig(configuration.DebitTablePath, configuration.DebitMaxProcessorCount) }
            };

            var voucherSubset = vouchers.Where(v => v.VoucherType == voucherType);
            var tableConfig = voucherActions[voucherType].Invoke();
            a2iAOcrServices[voucherType].OpenOcrChannel(tableConfig.TableFilename, tableConfig.ProcessorCount);

            var ocrVouchers = vouchers as IList<OcrVoucher> ?? voucherSubset.ToList();
            foreach (var voucher in ocrVouchers)
            {
                a2iAOcrServices[voucherType].ProcessVoucher(voucher);
            }

            foreach (var voucher in ocrVouchers)
            {
                a2iAOcrServices[voucherType].GetIcrChannelResult(voucher);
            }
        }