/// <summary> /// Removes the given item from the collection /// </summary> /// <returns>True, if the item was removed, otherwise False</returns> /// <param name="item">The item that should be removed</param> public override bool Remove(IModelElement item) { ITransaction transactionItem = item.As <ITransaction>(); if (((transactionItem != null) && this._parent.Transactions.Remove(transactionItem))) { return(true); } if ((this._parent.CashierShift == item)) { this._parent.CashierShift = null; return(true); } ITender tenderItem = item.As <ITender>(); if (((tenderItem != null) && this._parent.Tenders.Remove(tenderItem))) { return(true); } if ((this._parent.VendorShift == item)) { this._parent.VendorShift = null; return(true); } if ((this._parent.Line == item)) { this._parent.Line = null; return(true); } return(false); }
public void AddToGiftCard(IRetailTransaction retailTransaction, ITender gcTenderInfo) { //Start: added on 16/07/2014 for customer selection is must RetailTransaction retailTrans = retailTransaction as RetailTransaction; if (retailTrans != null) { if (Convert.ToString(retailTrans.Customer.CustomerId) == string.Empty || string.IsNullOrEmpty(retailTrans.Customer.CustomerId)) { using (LSRetailPosis.POSProcesses.frmMessage dialog = new LSRetailPosis.POSProcesses.frmMessage("Add a customer to transaction before making a deposit", MessageBoxButtons.OK, MessageBoxIcon.Error)) { LSRetailPosis.POSProcesses.POSFormsManager.ShowPOSForm(dialog); } return; } } //End: added on 16/07/2014 for customer selection is must LogMessage("Adding money to gift card.", LSRetailPosis.LogTraceLevel.Trace, "GiftCard.AddToGiftCard"); GiftCardController controller = new GiftCardController(GiftCardController.ContextType.GiftCardAddTo, (PosTransaction)retailTransaction, (Tender)gcTenderInfo); using (GiftCardForm giftCardForm = new GiftCardForm(controller)) { POSFormsManager.ShowPOSForm(giftCardForm); if (giftCardForm.DialogResult == DialogResult.OK) { // Add the gift card to the transaction. GiftCertificateItem giftCardItem = (GiftCertificateItem)this.Application.BusinessLogic.Utility.CreateGiftCardLineItem( ApplicationSettings.Terminal.StoreCurrency, this.Application.Services.Rounding, retailTransaction); giftCardItem.SerialNumber = controller.CardNumber; giftCardItem.StoreId = retailTransaction.StoreId; giftCardItem.TerminalId = retailTransaction.TerminalId; giftCardItem.StaffId = retailTransaction.OperatorId; giftCardItem.TransactionId = retailTransaction.TransactionId; giftCardItem.ReceiptId = retailTransaction.ReceiptId; giftCardItem.Amount = controller.Amount; giftCardItem.Balance = controller.Balance; giftCardItem.Date = DateTime.Now; giftCardItem.AddTo = true; giftCardItem.Price = giftCardItem.Amount; giftCardItem.StandardRetailPrice = giftCardItem.Amount; giftCardItem.Quantity = 1; giftCardItem.TaxRatePct = 0; giftCardItem.Description = ApplicationLocalizer.Language.Translate(55000); // Add to Gift Card giftCardItem.Comment = controller.CardNumber; giftCardItem.NoDiscountAllowed = true; giftCardItem.Found = true; ((RetailTransaction)retailTransaction).Add(giftCardItem); } } }
public BaseTender(ITender tender) : base(tender) { Identifier = tender.Identifier; AuctionPeriod = tender.AuctionPeriod; AuctionUrl = tender.AuctionUrl; AwardPeriod = tender.AwardPeriod; Status = tender.Status; Owner = tender.Owner; }
private void RunTenderParsing(ITender t) { try { t.ParsingTender(); } catch (Exception e) { Log.Logger(e); } }
protected void ParserTender(ITender t) { try { t.ParsingTender(); } catch (Exception e) { Log.Logger($"Exeption in {t.GetType()}", e); } }
/// <summary> /// Adds the given element to the collection /// </summary> /// <param name="item">The item to add</param> public override void Add(IModelElement item) { if ((this._parent.Tender == null)) { ITender tenderCasted = item.As <ITender>(); if ((tenderCasted != null)) { this._parent.Tender = tenderCasted; return; } } }
/// <summary> /// Adds the given element to the collection /// </summary> /// <param name="item">The item to add</param> public override void Add(IModelElement item) { ITransaction transactionsCasted = item.As <ITransaction>(); if ((transactionsCasted != null)) { this._parent.Transactions.Add(transactionsCasted); } if ((this._parent.CashierShift == null)) { ICashierShift cashierShiftCasted = item.As <ICashierShift>(); if ((cashierShiftCasted != null)) { this._parent.CashierShift = cashierShiftCasted; return; } } ITender tendersCasted = item.As <ITender>(); if ((tendersCasted != null)) { this._parent.Tenders.Add(tendersCasted); } if ((this._parent.VendorShift == null)) { IVendorShift vendorShiftCasted = item.As <IVendorShift>(); if ((vendorShiftCasted != null)) { this._parent.VendorShift = vendorShiftCasted; return; } } if ((this._parent.Line == null)) { ILineDetail lineCasted = item.As <ILineDetail>(); if ((lineCasted != null)) { this._parent.Line = lineCasted; return; } } }
/// <summary> /// Adds the given element to the collection /// </summary> /// <param name="item">The item to add</param> public override void Add(IModelElement item) { if ((this._parent.BankAccountDetail == null)) { IBankAccountDetail bankAccountDetailCasted = item.As <IBankAccountDetail>(); if ((bankAccountDetailCasted != null)) { this._parent.BankAccountDetail = bankAccountDetailCasted; return; } } if ((this._parent.Tender == null)) { ITender tenderCasted = item.As <ITender>(); if ((tenderCasted != null)) { this._parent.Tender = tenderCasted; return; } } }
public TenderDTO(ITender tender) : base(tender) { }
/// <summary> /// Creates a new observable property access proxy /// </summary> /// <param name="modelElement">The model instance element for which to create the property access proxy</param> public KindProxy(ITender modelElement) : base(modelElement, "kind") { }
protected override void OnLoad(EventArgs e) { if (!this.DesignMode) { LogMessage("Loading frmTenderCount", LSRetailPosis.LogTraceLevel.Trace, this.ToString()); TranslateLabels(); // Check which amounts the POS will expect per tendertype // Start by checking which tender types to count.... TenderData tenderData = new TenderData( ApplicationSettings.Database.LocalConnection, ApplicationSettings.Database.DATAAREAID); LoadFromTenderData(tenderData); LogMessage("Counting " + tendersToCount.Rows.Count + " tenders", LSRetailPosis.LogTraceLevel.Trace, this.ToString()); gridSource = new System.Collections.Generic.List <TenderViewModel>(); denominationDataSources = new Dictionary <int, List <DenominationViewModel> >(); foreach (DataRow row in tendersToCount.Rows) { ITender tmpTender = Dialog.InternalApplication.BusinessLogic.Utility.CreateTender(); tmpTender.TenderID = row["TENDERTYPEID"].ToString(); tmpTender.TenderName = row["NAME"].ToString(); tmpTender.PosisOperation = (PosisOperations)(row["POSOPERATION"]); LSRetailPosis.ApplicationLog.Log(this.ToString(), "Counting: " + tmpTender.TenderID + " " + tmpTender.TenderName + " " + tmpTender.PosisOperation.ToString(), LSRetailPosis.LogTraceLevel.Trace); switch (tmpTender.PosisOperation) { case PosisOperations.PayCash: cashCounted = true; TenderViewModel cashRow = new TenderViewModel() { TenderTypeId = tmpTender.TenderID, TenderOperationType = tmpTender.PosisOperation, TenderName = tmpTender.TenderName, DisplayName = ApplicationLocalizer.Language.Translate(STRING_ID_TENDER_NAME, ApplicationSettings.Terminal.StoreCurrency), Currency = ApplicationSettings.Terminal.StoreCurrency }; gridSource.Insert(0, cashRow); break; case PosisOperations.PayCurrency: foreignCurrencyCounted = true; ExchangeRateDataManager exchangeRateData = new ExchangeRateDataManager(ApplicationSettings.Database.LocalConnection, ApplicationSettings.Database.DATAAREAID); //Initialize with all number of currencies avialable foreach (string currency in exchangeRateData.GetCurrencyPair( ApplicationSettings.Terminal.StoreCurrency, ApplicationSettings.Terminal.ExchangeRateType, ApplicationSettings.Terminal.StorePrimaryId)) { TenderViewModel currencyRow = new TenderViewModel() { TenderTypeId = tmpTender.TenderID, TenderOperationType = tmpTender.PosisOperation, TenderName = tmpTender.TenderName, DisplayName = ApplicationLocalizer.Language.Translate(STRING_ID_TENDER_NAME, currency), Currency = currency }; gridSource.Insert(gridSource.Count > 0 ? 1 : 0, currencyRow); } break; default: otherTendersCounted = true; TenderViewModel otherRow = new TenderViewModel() { TenderTypeId = tmpTender.TenderID, TenderOperationType = tmpTender.PosisOperation, TenderName = tmpTender.TenderName, DisplayName = tmpTender.TenderName }; gridSource.Add(otherRow); break; } } this.gridTenders.DataSource = gridSource; this.Text = lblHeader.Text = formHeadingText; this.gvTenders.Appearance.HeaderPanel.ForeColor = this.ForeColor; this.gvTenders.Appearance.Row.ForeColor = this.ForeColor; UpdateTotalAmount(); } base.OnLoad(e); }
public void IssueGiftCard(IPosTransaction posTransaction, ITender gcTenderInfo) { //Start: added on 16/07/2014 for customer selection is must RetailTransaction retailTrans = posTransaction as RetailTransaction; if (retailTrans != null) { if (Convert.ToString(retailTrans.Customer.CustomerId) == string.Empty || string.IsNullOrEmpty(retailTrans.Customer.CustomerId)) { using (LSRetailPosis.POSProcesses.frmMessage dialog = new LSRetailPosis.POSProcesses.frmMessage("Add a customer to transaction before making a deposit", MessageBoxButtons.OK, MessageBoxIcon.Error)) { LSRetailPosis.POSProcesses.POSFormsManager.ShowPOSForm(dialog); } return; } } //End :added on 16/07/2014 for customer selection is must LogMessage("Issuing a gift card", LSRetailPosis.LogTraceLevel.Trace, "GiftCard.IssueGiftCard"); if (FiscalPrinter.FiscalPrinter.Instance.FiscalPrinterEnabled()) { //The operation should proceed after the fiscal printer handles IssueGiftCard FiscalPrinter.FiscalPrinter.Instance.IssueGiftCard(posTransaction, gcTenderInfo); } GiftCardController controller = new GiftCardController(GiftCardController.ContextType.GiftCardIssue, (PosTransaction)posTransaction, (Tender)gcTenderInfo); //controller.CardNumber = "111111"; testing for autogenerate no req sailendra da using (GiftCardForm giftCardForm = new GiftCardForm(controller)) { POSFormsManager.ShowPOSForm(giftCardForm); if (giftCardForm.DialogResult == DialogResult.OK) { // Add the gift card to the transaction. RetailTransaction retailTransaction = posTransaction as RetailTransaction; GiftCertificateItem giftCardItem = (GiftCertificateItem)this.Application.BusinessLogic.Utility.CreateGiftCardLineItem( ApplicationSettings.Terminal.StoreCurrency, this.Application.Services.Rounding, retailTransaction); giftCardItem.SerialNumber = controller.CardNumber; giftCardItem.StoreId = posTransaction.StoreId; giftCardItem.TerminalId = posTransaction.TerminalId; giftCardItem.StaffId = posTransaction.OperatorId; giftCardItem.TransactionId = posTransaction.TransactionId; giftCardItem.ReceiptId = posTransaction.ReceiptId; giftCardItem.Amount = controller.Amount; giftCardItem.Balance = controller.Balance; giftCardItem.Date = DateTime.Now; // Necessary property settings for the the gift certificate "item"... giftCardItem.Price = giftCardItem.Amount; giftCardItem.StandardRetailPrice = giftCardItem.Amount; giftCardItem.Quantity = 1; giftCardItem.TaxRatePct = 0; giftCardItem.Description = ApplicationLocalizer.Language.Translate(55001); // Gift Card giftCardItem.Comment = controller.CardNumber; giftCardItem.NoDiscountAllowed = true; giftCardItem.Found = true; retailTransaction.Add(giftCardItem); } } }
public ProjectTenderController(ITender tenders) { _tenders = tenders; }
/// <summary> /// Gift card payment related methods /// </summary> /// <param name="valid"></param> /// <param name="comment"></param> /// <param name="posTransaction"></param> /// <param name="cardInfo"></param> /// <param name="gcTenderInfo"></param> public void AuthorizeGiftCardPayment(ref bool valid, ref string comment, IPosTransaction posTransaction, ICardInfo cardInfo, ITender gcTenderInfo) { if (cardInfo == null) { throw new ArgumentNullException("cardInfo"); } LogMessage("Authorizing a gift card payment", LogTraceLevel.Trace); valid = false; GiftCardController controller = new GiftCardController(GiftCardController.ContextType.GiftCardPayment, (PosTransaction)posTransaction, (Tender)gcTenderInfo); controller.CardNumber = cardInfo.CardNumber; using (GiftCardForm giftCardForm = new GiftCardForm(controller)) { POSFormsManager.ShowPOSForm(giftCardForm); if (giftCardForm.DialogResult == DialogResult.OK) { valid = true; cardInfo.CardNumber = controller.CardNumber; cardInfo.Amount = controller.Amount; cardInfo.CurrencyCode = controller.Currency; } } }
public void AddLoyaltyPayment(IRetailTransaction retailTransaction, ICardInfo cardInfo, decimal amount) { try { try { NewMessageWindow(50051, LSPosMessageTypeButton.NoButtons, System.Windows.Forms.MessageBoxIcon.Information); this.transaction = (RetailTransaction)retailTransaction; // Getting the loyalty info for the card, how many points have previously been earned LoyaltyItem paymentLoyaltyItem = GetLoyaltyItem(ref cardInfo); if (paymentLoyaltyItem != null) { //customerData. if (this.transaction.Customer == null || string.Equals(this.transaction.Customer.CustomerId, paymentLoyaltyItem.CustID, StringComparison.OrdinalIgnoreCase) == false) { UpdateTransactionWithNewCustomer(paymentLoyaltyItem.CustID); } // if the amount is higher than the "new" NetAmountWithTax, then it is acceptable to lower the amount if (Math.Abs(amount) > Math.Abs(this.transaction.TransSalePmtDiff)) { amount = this.transaction.TransSalePmtDiff; } // Getting all possible loyalty posssiblities for the found scheme id DataTable loyaltyPointsTable = GetLoyaltyPointsSchemeFromDB(paymentLoyaltyItem.SchemeID); decimal totalNumberOfPoints = 0; bool tenderRuleFound = false; // now we add the points needed to pay current tender totalNumberOfPoints = CalculatePointsForTender(ref tenderRuleFound, cardInfo.TenderTypeId, amount, loyaltyPointsTable); if (tenderRuleFound) { bool cardIsValid = false; string comment = string.Empty; int loyaltyTenderTypeBase = 0; decimal pointsEarned = 0; // check to see if the user can afford so many points GetPointStatus(ref pointsEarned, ref cardIsValid, ref comment, ref loyaltyTenderTypeBase, paymentLoyaltyItem.LoyaltyCardNumber); if ((cardIsValid) && ((LoyaltyTenderTypeBase)loyaltyTenderTypeBase != LoyaltyTenderTypeBase.NoTender)) { if (pointsEarned >= (totalNumberOfPoints * -1)) { //customerData. if (this.transaction.Customer == null || string.Equals(this.transaction.Customer.CustomerId, paymentLoyaltyItem.CustID, StringComparison.OrdinalIgnoreCase) == false) { UpdateTransactionWithNewCustomer(paymentLoyaltyItem.CustID); } //Add loyalty item to transaction. this.transaction.LoyaltyItem = paymentLoyaltyItem; this.transaction.LoyaltyItem.UsageType = LoyaltyItemUsageType.UsedForLoyaltyTender; // Gathering tender information TenderData tenderData = new TenderData(ApplicationSettings.Database.LocalConnection, ApplicationSettings.Database.DATAAREAID); ITender tenderInfo = tenderData.GetTender(cardInfo.TenderTypeId, ApplicationSettings.Terminal.StoreId); // this is the grand total decimal totalAmountDue = this.transaction.TransSalePmtDiff - amount; TenderRequirement tenderRequirement = new TenderRequirement((Tender)tenderInfo, amount, true, this.transaction.TransSalePmtDiff); if (!string.IsNullOrWhiteSpace(tenderRequirement.ErrorText)) { using (LSRetailPosis.POSProcesses.frmMessage dialog = new LSRetailPosis.POSProcesses.frmMessage(tenderRequirement.ErrorText, System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error)) { LSRetailPosis.POSProcesses.POSFormsManager.ShowPOSForm(dialog); } } //Add a loyalty tender item to transaction. LoyaltyTenderLineItem loyaltyTenderItem = (LoyaltyTenderLineItem)this.Application.BusinessLogic.Utility.CreateLoyaltyTenderLineItem(); loyaltyTenderItem.CardNumber = paymentLoyaltyItem.LoyaltyCardNumber; loyaltyTenderItem.CardTypeId = cardInfo.CardTypeId; loyaltyTenderItem.Amount = amount; //tenderInfo. loyaltyTenderItem.Description = tenderInfo.TenderName; loyaltyTenderItem.TenderTypeId = cardInfo.TenderTypeId; loyaltyTenderItem.LoyaltyPoints = totalNumberOfPoints; //convert from the store-currency to the company-currency... loyaltyTenderItem.CompanyCurrencyAmount = this.Application.Services.Currency.CurrencyToCurrency( ApplicationSettings.Terminal.StoreCurrency, ApplicationSettings.Terminal.CompanyCurrency, amount); // the exchange rate between the store amount(not the paid amount) and the company currency loyaltyTenderItem.ExchrateMST = this.Application.Services.Currency.ExchangeRate( ApplicationSettings.Terminal.StoreCurrency) * 100; // card tender processing and printing require an EFTInfo object to be attached. // however, we don't want loyalty info to show up where other EFT card info would on the receipt // because loyalty has its own receipt template fields, so we just assign empty EFTInfo object loyaltyTenderItem.EFTInfo = Application.BusinessLogic.Utility.CreateEFTInfo(); // we don't want Loyalty to be 'captured' by payment service, so explicitly set not to capture to be safe loyaltyTenderItem.EFTInfo.IsPendingCapture = false; loyaltyTenderItem.SignatureData = LSRetailPosis.POSProcesses.TenderOperation.ProcessSignatureCapture(tenderInfo, loyaltyTenderItem); this.transaction.Add(loyaltyTenderItem); } else { using (LSRetailPosis.POSProcesses.frmMessage dialog = new LSRetailPosis.POSProcesses.frmMessage(50057, System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error)) { LSRetailPosis.POSProcesses.POSFormsManager.ShowPOSForm(dialog); } // Not enough points available to complete payment } } else { LSRetailPosis.POSProcesses.frmMessage dialog = null; try { if (string.IsNullOrEmpty(comment)) { dialog = new LSRetailPosis.POSProcesses.frmMessage(50058, System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error); } else { dialog = new LSRetailPosis.POSProcesses.frmMessage(comment, System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error); } LSRetailPosis.POSProcesses.POSFormsManager.ShowPOSForm(dialog); // Invalid loyaltycard } finally { if (dialog != null) { dialog.Dispose(); } } } } else { using (LSRetailPosis.POSProcesses.frmMessage dialog = new LSRetailPosis.POSProcesses.frmMessage(50059, System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error)) { LSRetailPosis.POSProcesses.POSFormsManager.ShowPOSForm(dialog); // Not enough points available to complete payment } } } } finally { CloseExistingMessageWindow(); } } catch (Exception ex) { NetTracer.Error(ex, "Loyalty::AddLoyaltyPayment failed for retailTransaction {0} cardInfo {1} amount {2}", retailTransaction.TransactionId, cardInfo.CardNumber, amount); LSRetailPosis.ApplicationExceptionHandler.HandleException(this.ToString(), ex); throw; } }
public Tender(ITender tender) : base(tender) { }
private void AddCorporateCardTenderLine() { try { LogMessage("Adding the tender line to the transaction", LSRetailPosis.LogTraceLevel.Trace, "CorporateCard.AddCorporateCardTenderLine"); bool getAdditionalInfo = false; // Generate the tender line for the card CorporateCardTenderLineItem cardTenderLine = (CorporateCardTenderLineItem)this.Application.BusinessLogic.Utility.CreateCorporateCardTenderLineItem(); cardTenderLine.TenderTypeId = iCardInfo.TenderTypeId; cardTenderLine.CardName = iCardInfo.CardName; cardTenderLine.Description = LSRetailPosis.ApplicationLocalizer.Language.Translate(50150) + " " + iCardInfo.CardName; //Card payment cardTenderLine.Amount = this.amountValue; if (iCardInfo.CardEntryType == CardEntryTypes.MAGNETIC_STRIPE_READ) { // We have the track, from which we need to get the card number and exp date string track2Data = LSRetailPosis.Settings.HardwareProfiles.MSR.Track2Data(iCardInfo.Track2); cardTenderLine.CardNumber = track2Data.Substring(0, track2Data.IndexOf("-")); cardTenderLine.ExpiryDate = track2Data.Substring(track2Data.IndexOf("-") + 1, 4); } else { // We have the card number and the exp. date cardTenderLine.CardNumber = iCardInfo.CardNumber; cardTenderLine.ExpiryDate = iCardInfo.ExpDate; getAdditionalInfo = true; } // Get information about the tender... TenderData tenderData = new TenderData(ApplicationSettings.Database.LocalConnection, ApplicationSettings.Database.DATAAREAID); ITender tenderInfo = tenderData.GetTender(iCardInfo.TenderTypeId, ApplicationSettings.Terminal.StoreId); cardTenderLine.OpenDrawer = tenderInfo.OpenDrawer; cardTenderLine.ChangeTenderID = tenderInfo.ChangeTenderID; cardTenderLine.MinimumChangeAmount = tenderInfo.MinimumChangeAmount; cardTenderLine.AboveMinimumTenderId = tenderInfo.AboveMinimumTenderId; //Get additional information on corporate card if needed if (getAdditionalInfo && !GetAdditionalInformation(cardTenderLine, this.Application)) { return; } //convert from the store-currency to the company-currency... cardTenderLine.CompanyCurrencyAmount = this.Application.Services.Currency.CurrencyToCurrency( ApplicationSettings.Terminal.StoreCurrency, ApplicationSettings.Terminal.CompanyCurrency, this.amountValue); // the exchange rate between the store amount(not the paid amount) and the company currency cardTenderLine.ExchrateMST = this.Application.Services.Currency.ExchangeRate( ApplicationSettings.Terminal.StoreCurrency) * 100; cardTenderLine.SignatureData = LSRetailPosis.POSProcesses.TenderOperation.ProcessSignatureCapture(tenderInfo, cardTenderLine); retailTransaction.Add(cardTenderLine); ((IPosTransactionV2)retailTransaction).LastRunOperationIsValidPayment = true; } catch (Exception x) { LSRetailPosis.ApplicationExceptionHandler.HandleException(this.ToString(), x); throw; } }