private static void PrepareGuestUser() { if (!GConfig.POS_Setup.Customers.Any(n => n.vCustContactNme == "Guest Customer")) { //create guest user POS_Customer custo = new POS_Customer() { vCustContactNme = "Guest Customer" }; GConfig.POS_Setup.Customers.Add(custo); GConfig.DAL.SaveChanges(); } }
public CustomerVM(POS_Customer Customer = null) { if (Customer == null) { _customer = new POS_Customer(); // _customer.vOrderType = OrderTypes.Catering; //this is how ordertype is give a initial value .....SAA } else { _customer = Customer; // Subtotal = _customer.Sum(n => n.fLineSubTotal); //this is carry over from OrderVM class } // _salexTaxRate = GConfig.POS_Setup.vSalesTax.Value; //this is sample code to retrieve global values for calculation }
private void AddCustomer(string customerPhone, string customerName, string customerAddr1, string customerAddr2, string customerCity, string customerState, string customerZipcode) { Int32 _iCustID = GConfig.POS_Setup.Customers.Max(n => n.iCustid); Int32 _custRecordid = GConfig.POS_Setup.Customers.Max(n => n.Id); var customerExist = GConfig.POS_Setup.Customers.FirstOrDefault(n => n.vCustPrimaryPh == customerPhone); if (customerExist == null) { DateTime date = DateTime.Now; _iCustID++; _custRecordid++; var customer = new POS_Customer() { iCustid = _iCustID, vCustPrimaryPh = customerPhone, vCustName = customerName, vCustAddress1 = customerAddr1, vCustAddress2 = customerAddr2, vCustCity = customerCity, vCustState = customerState, vCustZipCode = customerZipcode, vCustStatus = "Publish" }; //added var to give editable custom item name SAA. GConfig.POS_Setup.Customers.Add(customer); GConfig.DAL.SaveChanges(); Order._orderHeader.CustomerId = _custRecordid; } else { customerExist.vCustName = customerName; customerExist.vCustAddress1 = customerAddr1; customerExist.vCustAddress2 = customerAddr2; customerExist.vCustCity = customerCity; customerExist.vCustState = customerState; customerExist.vCustZipCode = customerZipcode; customerExist.vCustStatus = "Publish"; GConfig.DAL.SaveChanges(); Order._orderHeader.CustomerId = customerExist.Id; } }