private async void ToIncreaseFund() { if (_AckStockCode == null) { _AckStockCode = await _ackrooBusinessLogic.GetAckrooStockCode(); } if (string.IsNullOrEmpty(_AckStockCode)) { ShowNotification("Ackroo Stock is not found.~Ackroo Stock", null, null, ApplicationConstants.ButtonWarningColor ); return; } _CurrentType = AckReqType.INCREASE; NotifyInfo = null; CardNumber = null; AckrooAmount = null; EnablePrint = false; EnableCommand = true; Ackr_Label1 = _resourceloader.GetString("Ackr_Label1_IncreaseFund"); NavigateService.Instance.NavigateAckrooFrame(typeof(AckrooIncreaseFund)); }
private async void ToActivateCard() { if (_AckStockCode == null) { _AckStockCode = await _ackrooBusinessLogic.GetAckrooStockCode(); } if (string.IsNullOrEmpty(_AckStockCode)) { ShowNotification("Ackroo Stock is not found.~Ackroo Stock", null, null, ApplicationConstants.ButtonWarningColor ); return; } _CurrentType = AckReqType.ACTIVATION; NotifyInfo = null; CardNumber = null; AckrooAmount = "0.00"; EnablePrint = false; EnableCommand = true; NavigateService.Instance.NavigateAckrooFrame(typeof(AckrooCardActivation)); }
public AckrooVM(ICacheBusinessLogic cacheBussinessLogic, IReportsBussinessLogic reportsBusinessLogic, IAckrooBusinessLogic ackrooBusinessLogic, ISaleBussinessLogic saleBussinessLogic ) { _cacheBussinessLogic = cacheBussinessLogic; _reportsBusinessLogic = reportsBusinessLogic; _ackrooBusinessLogic = ackrooBusinessLogic; _saleBussinessLogic = saleBussinessLogic; MessengerInstance.Register <AkrooMessage>(this, GetM); InitialCommands(); EnablePrint = false; _CurrentType = AckReqType.BALANCE; BalanceInfo = null; _resourceloader = ResourceLoader.GetForCurrentView(); }
private async void ToCarwashSell() { if (_CarwashCategories == null) { _CarwashCategories = await _ackrooBusinessLogic.GetCarwashCategories(); } if (_CarwashCategories == null || _CarwashCategories.Count <= 0) { ShowNotification("Ackroo Carwash categories are not available.~Ackroo Carwash", null, null, ApplicationConstants.ButtonWarningColor ); return; } if (CarwashCategories == null) { CarwashCategories = new List <string>(); foreach (var c in _CarwashCategories) { CarwashCategories.Add(c.Category); } } SelectedCarwashCategory = CarwashCategories[0]; _CurrentType = AckReqType.CARWASH; CarwashUnits = "1"; NotifyInfo = null; CardNumber = null; AckrooAmount = null; EnablePrint = false; EnableCommand = true; NavigateService.Instance.NavigateAckrooFrame(typeof(AckrooSellCarwashUnits)); }
private void CheckBalance() { _CurrentType = AckReqType.BALANCE; BalanceInfo = null; CardNumber = null; EnablePrint = false; EnableCommand = true; NavigateService.Instance.NavigateAckrooFrame(typeof(AckrooBalance)); //string sTemp = ""; //string sLine = ""; //string param1 = ""; //string param2 = ""; //if(_ReceiptHeader!=null) //{ // List<string> olist = new List<string>(); // foreach(var c in _ReceiptHeader) // { // olist.Add(c); // } // olist.Add(""); // olist.Add(""); // param1 ="Date: "+ string.Format("{0:MM/dd/yyyy}", DateTime.Now); // param2 = "Time:" + string.Format("{0:HH:mm:ss}", DateTime.Now); // sLine = string.Format("{0,-18} {1,-18}", param1, param2); // //sTemp = "Date:" + string.Format("{0:MM/dd/yyyy}", DateTime.Now) + " Time:" + string.Format("{0:HH:mm:ss}", DateTime.Now); // olist.Add(sLine); // if (("CASHIER-" + _cacheBussinessLogic.UserName).Length > 9) // param1 = "UserID: " + _cacheBussinessLogic.UserName; // else // param1 = "UserID: CASHIER-" + _cacheBussinessLogic.UserName; // param2 = "Line: " + _cacheBussinessLogic.TillNumber + "/" + _cacheBussinessLogic.ShiftNumber; // sLine = string.Format("{0,-18} {1,-18}", param1, param2); // olist.Add(sLine); // olist.Add(""); // olist.Add("Ackroo Trans Type: Check Balance"); // olist.Add(""); // olist.Add("Trans No: " + _cacheBussinessLogic.SaleNumber); // olist.Add(""); // olist.Add("Ackroo Card #: 612573*****255765*"); // olist.Add("Expiry Date: "); // olist.Add(""); // param1 = "Gift Balace:"; // param2 = "$0.00"; // sLine = string.Format("{0,20} {1,10}", param1, param2); // olist.Add(sLine); // param1 = "Loyalty Balance:"; // param2 = "$21,045.06"; // sLine = string.Format("{0,20} {1,10}", param1, param2); // olist.Add(sLine); // param1 = "CAR WASH - BASIC:"; // param2 = "134"; // sLine = string.Format("{0,20} {1,10}", param1, param2); // olist.Add(sLine); // param1 = "CAR WASH - PREMIUM:"; // param2 = "307"; // sLine = string.Format("{0,20} {1,10}", param1, param2); // olist.Add(sLine); // olist.Add(""); // olist.Add(""); // param1 = "APPROVED"; // sLine = string.Format(" {0,4}", param1); // olist.Add(sLine); // olist.Add(""); // olist.Add(""); // param1 = "Thank You!"; // sLine = string.Format(" {0,4}", param1); // olist.Add(sLine); // PerformPrint(olist, 1, true, null); //} }
private string TPSRequest(AckReqType AckType, string RedeemType = null, double?amount = null) { string sRequest = "<?xml version=\"1.0\" encoding=\"utf-8\" ?>"; string sPrefix_Junk = "11"; XDocument doc = null; switch (AckType) { case AckReqType.BALANCE: doc = new XDocument( new XDeclaration("1.0", "UTF-8", "yes"), new XElement( "AckrooTPSRequest", new XElement("Transaction", new XAttribute("Type", "PreAuth"), null ), new XElement("Source", new XAttribute("Type", "POS" ), null ), new XElement("Lane", _cacheBussinessLogic.TillNumber), new XElement("InvoiceNo", _cacheBussinessLogic.SaleNumber), new XElement("Card", new XElement("Type", "Loyalty" ), new XElement("Track2", GetCardNum()), null) ) ); sRequest += doc.ToString(); break; case AckReqType.REDEEM: doc = new XDocument( new XDeclaration("1.0", "UTF-8", "yes"), new XElement( "AckrooTPSRequest", new XElement("Transaction", new XAttribute("Type", "REDEEM"), null ), new XElement("Source", new XAttribute("Type", "POS" ), null ), new XElement("Lane", _cacheBussinessLogic.TillNumber), new XElement("InvoiceNo", _cacheBussinessLogic.SaleNumber), new XElement("RequestAmount", string.Format("{0:0.00}", amount)), new XElement("Card", new XElement("Type", RedeemType ), new XElement("Track2", GetCardNum()), null) ) ); sRequest += doc.ToString(); break; } return(sPrefix_Junk + sRequest); }
private AckrooBalanceInfo GetBalaceInfo(XDocument doc, AckReqType cType) { AckrooBalanceInfo ackbalance = new AckrooBalanceInfo(); XElement xe; xe = GetElement(doc, "TransactionStatus"); if (xe != null) { ackbalance.TransactionStatus = xe.Value; } xe = GetElement(doc, "ResponseMessage"); if (xe != null) { ackbalance.ResponseMessage = xe.Value; } switch (cType) { case AckReqType.ACTIVATION: xe = GetElement(doc, "AmountFunded"); if (xe != null) { if (!string.IsNullOrEmpty(xe.Value)) { ackbalance.AmountFunded = xe.Value; } } xe = GetElement(doc, "ElBalance"); if (xe != null && !string.IsNullOrEmpty(xe.Value)) { ackbalance.LoyaltyBalace = string.Format("{0:C2}", double.Parse(xe.Value, System.Globalization.NumberStyles.Any, System.Globalization.CultureInfo.InvariantCulture)); } else { ackbalance.LoyaltyBalace = string.Format("{0:C2}", 0); } xe = GetElement(doc, "GcBalance"); if (xe != null && !string.IsNullOrEmpty(xe.Value)) { ackbalance.GiftBalance = string.Format("{0:C2}", double.Parse(xe.Value, System.Globalization.NumberStyles.Any, System.Globalization.CultureInfo.InvariantCulture)); } else { ackbalance.GiftBalance = string.Format("{0:C2}", 0); } break; case AckReqType.BALANCE: xe = GetElement(doc, "Active"); if (xe != null) { if (Boolean.Parse(xe.Value) == true) { ackbalance.Active = "Active"; } else { ackbalance.Active = "InActive"; } } xe = GetElement(doc, "Gift"); if (xe != null) { ackbalance.GiftBalance = string.Format("{0:C2}", double.Parse(xe.Value, System.Globalization.NumberStyles.Any, System.Globalization.CultureInfo.InvariantCulture)); } xe = GetElement(doc, "Loyalty"); if (xe != null) { ackbalance.LoyaltyBalace = string.Format("{0:C2}", double.Parse(xe.Value, System.Globalization.NumberStyles.Any, System.Globalization.CultureInfo.InvariantCulture)); } XNamespace ns = doc.Root.GetDefaultNamespace(); IEnumerable <XElement> clist = from c in doc.Descendants(ns + "Carwash") select c; AckrooItem ackitem = null; int iCount; if (clist != null) { ackbalance.Categories = new List <AckrooItem>(); foreach (XElement item in clist) { iCount = 0; foreach (XElement xxe in item.Elements()) { if (iCount == 0 && ackitem == null) { ackitem = new AckrooItem(); } if (xxe.Name.LocalName == "Category") { ackitem.Name = xxe.Value; iCount++; } if (xxe.Name.LocalName == "Balance") { ackitem.Value = xxe.Value; iCount++; } if (iCount == 2) { iCount = 0; ackbalance.Categories.Add(ackitem); ackitem = null; } } } } break; case AckReqType.INCREASE: xe = GetElement(doc, "AmountFunded"); if (xe != null) { ackbalance.Increment = string.Format("{0:C2}", double.Parse(xe.Value, System.Globalization.NumberStyles.Any, System.Globalization.CultureInfo.InvariantCulture)); } xe = GetElement(doc, "ElBalance"); if (xe != null) { ackbalance.LoyaltyBalace = string.Format("{0:C2}", double.Parse(xe.Value, System.Globalization.NumberStyles.Any, System.Globalization.CultureInfo.InvariantCulture)); } xe = GetElement(doc, "GcBalance"); if (xe != null) { ackbalance.GiftBalance = string.Format("{0:C2}", double.Parse(xe.Value, System.Globalization.NumberStyles.Any, System.Globalization.CultureInfo.InvariantCulture)); } break; case AckReqType.CARWASH: xe = GetElement(doc, "ElBalance"); if (xe != null) { ackbalance.LoyaltyBalace = string.Format("{0:C2}", double.Parse(xe.Value, System.Globalization.NumberStyles.Any, System.Globalization.CultureInfo.InvariantCulture)); } xe = GetElement(doc, "GcBalance"); if (xe != null) { ackbalance.GiftBalance = string.Format("{0:C2}", double.Parse(xe.Value, System.Globalization.NumberStyles.Any, System.Globalization.CultureInfo.InvariantCulture)); } break; case AckReqType.REDEEM: xe = GetElement(doc, "ElBalance"); if (xe != null && !string.IsNullOrEmpty(xe.Value)) { ackbalance.LoyaltyBalace = string.Format("{0:C2}", double.Parse(xe.Value, System.Globalization.NumberStyles.Any, System.Globalization.CultureInfo.InvariantCulture)); } else { ackbalance.LoyaltyBalace = string.Format("{0:C2}", 0); } xe = GetElement(doc, "GcBalance"); if (xe != null && !string.IsNullOrEmpty(xe.Value)) { ackbalance.GiftBalance = string.Format("{0:C2}", double.Parse(xe.Value, System.Globalization.NumberStyles.Any, System.Globalization.CultureInfo.InvariantCulture)); } else { ackbalance.GiftBalance = string.Format("{0:C2}", 0); } break; } return(ackbalance); }