/// <summary> /// Saves any new customer addresses /// </summary> /// <param name="customer"> /// The customer. /// </param> private void SaveNewAddresses(CustomerDisplay customer) { foreach (var address in customer.Addresses.Where(x => x.Key == Guid.Empty)) { _customerAddressService.Save(address.ToCustomerAddress(new CustomerAddress(customer.Key))); } }
/// <summary> /// Methdo to set cursor /// </summary> /// <param name="po">PO </param> /// <param name="customerDisplay">Customer dispaly</param> private void SetCursor(ref short po, ref CustomerDisplay customerDisplay) { po = (short)(po < 1 | po > 40 ? 0x31 : po + 0x30); var strCommand = "P" + System.Convert.ToString(Strings.Chr(po)); strCommand = '\u0004' + "\u0001" + strCommand + "\u0017"; customerDisplay.NonOposTexts.Add(strCommand); }
/// <summary> /// Saves any new customer addresses /// </summary> /// <param name="customer"> /// The customer. /// </param> private void SaveNewAddresses(CustomerDisplay customer) { foreach (var address in customer.Addresses.Where(x => x.Key == Guid.Empty)) { var customerAddress = address.ToCustomerAddress(new CustomerAddress(customer.Key)); customerAddress.AddressType = address.AddressType; _customerAddressService.Save(customerAddress); address.Key = customerAddress.Key; } }
public IAnonymousCustomer AddAnonymousCustomer(CustomerDisplay customer) { var newCustomer = _customerService.CreateAnonymousCustomerWithKey(); newCustomer.LastActivityDate = DateTime.Today; _customerService.Save(newCustomer); return(newCustomer); }
// Clear Display Range /// <summary> /// Method to clear display message /// </summary> /// <param name="st">Start index</param> /// <param name="ed">End index</param> /// <param name="customerDisplay">Customer display</param> private void ClearDisplayLcd(short st, ref short ed, ref CustomerDisplay customerDisplay) { st = (short)((st < 1) | st > 40 ? 0x31 : st + 0x30); ed = (short)(ed < 1 | ed > 40 ? 0x31 : ed + 0x30); var strCommand = "C" + System.Convert.ToString(Strings.Chr(st)) + System.Convert.ToString(Strings.Chr(ed)); strCommand = '\u0004' + "\u0001" + strCommand + "\u0017"; //PComLCD.Output = StrCommand' customerDisplay.NonOposTexts.Add(strCommand); }
public CustomerDisplay PutCustomer(CustomerDisplay customer) { RemoveDeletedAddresses(customer); SaveNewAddresses(customer); var merchCustomer = _customerService.GetByKey(customer.Key); merchCustomer = customer.ToCustomer(merchCustomer); _customerService.Save(merchCustomer); return(merchCustomer.ToCustomerDisplay()); }
/// <summary> /// Removes addresses deleted in the back office. /// </summary> /// <param name="customer"> /// The customer. /// </param> private void RemoveDeletedAddresses(CustomerDisplay customer) { var existing = _customerAddressService.GetByCustomerKey(customer.Key); var existingAddresses = existing as ICustomerAddress[] ?? existing.ToArray(); if (!existingAddresses.Any()) { return; } foreach (var delete in existingAddresses.Where(address => customer.Addresses.All(x => x.Key != address.Key)).ToList()) { _customerAddressService.Delete(delete); } }
public CustomerDisplay AddCustomer(CustomerDisplay customer) { var newCustomer = _customerService.CreateCustomer( string.IsNullOrEmpty(customer.LoginName) ? customer.Email : customer.LoginName, customer.FirstName, customer.LastName, customer.Email); newCustomer.LastActivityDate = DateTime.Today; ////((Customer)newCustomer).Addresses = customer.Addresses.Select(x => x.ToCustomerAddress(new CustomerAddress(customer.Key))); _customerService.Save(newCustomer); return(newCustomer.ToCustomerDisplay()); }
/// <summary> /// Method to format display message /// </summary> /// <param name="register">Register</param> /// <param name="st1">Message first part</param> /// <param name="st2">Message second part</param> /// <returns></returns> public CustomerDisplay DisplayMsgLcd(Register register, string st1, string st2) { var store = _policyManager.LoadStoreInfo(); var customerDisplay = new CustomerDisplay(); if (register.Opos_Customer_Display) { customerDisplay.OposText1 = st1; customerDisplay.OposText2 = st2; } else { if (register.Customer_Display_Code == 1) // Champion customer display { short tempEd = 40; ClearDisplayLcd(1, ref tempEd, ref customerDisplay); short tempPo = 1; SetCursor(ref tempPo, ref customerDisplay); //PComLCD.Output = Chr(&H4) & Chr(&H1) & "T" & Chr(&H17) & ST1 & ST2 customerDisplay.NonOposTexts.Add('\u0004' + "\u0001" + "T" + "\u0017" + st1 + st2); } // Logic Controls customer display else if (register.Customer_Display_Code == 2) { //PComLCD.Output = Chr(&H1F) customerDisplay.NonOposTexts.Add(System.Convert.ToString('\u001F')); customerDisplay.NonOposTexts.Add(st1 + "\r\n" + st2); customerDisplay.NonOposTexts.Add(System.Convert.ToString('\u0014')); } // IEE customer display else if (register.Customer_Display_Code == 3) { // Chr (27) + "@" ' reset command if (Strings.UCase(System.Convert.ToString(store.Language)) == "ENGLISH") { customerDisplay.NonOposTexts.Add(System.Convert.ToString('\f')); // clear display customerDisplay.NonOposTexts.Add(st1); customerDisplay.NonOposTexts.Add(st2); } else { customerDisplay.NonOposTexts.Add('\u001B' + "\u0074" + "\u0002"); customerDisplay.NonOposTexts.Add(System.Convert.ToString('\f')); // clear display customerDisplay.NonOposTexts.Add(IEE_P322_String(st1)); customerDisplay.NonOposTexts.Add(IEE_P322_String(st2)); } } else { customerDisplay.NonOposTexts.Add(System.Convert.ToString('\f')); // clear display customerDisplay.NonOposTexts.Add(st1); customerDisplay.NonOposTexts.Add(st2); } } return(customerDisplay); }