/// <summary> /// Add the bLoyal customer to dinerware system with Create ticket /// </summary> /// <param name="userId">userId</param> /// <param name="customer">customer</param> /// <returns>Response</returns> public int AddCustomerToDinerware(int userId, wsPerson customer) { int addCustomerResponse = 0; try { DinerwareProvider objDinerwareProvider = new DinerwareProvider(); string searchTerm = customer.LNAME + Constants.BLANK_SPACE + customer.FNAME; bool flag = FindDinerwareCustomer(userId, searchTerm); //Create customer in the dinerware if (flag) { addCustomerResponse = objDinerwareProvider.AddCustomer(userId, customer); // Create ticket CreateTickets(userId, customer); return(addCustomerResponse); } else { // Create ticket CreateTickets(userId, customer); } } catch (Exception exception) { throw exception; } return(addCustomerResponse); }
/// <summary> /// Add bLoyal customer to dinerware system /// </summary> /// <param name="userId">UserId</param> /// <param name="customer">Customer Details</param> /// <returns>Customer ID</returns> public int AddCustomer(int userId, wsPerson customer) { try { return(virtualDinerwareClient.AddCustomer(userId, customer)); } catch (Exception ex) { logger.WriteLogError("**** Dinerware VirtualClient FAILURE: AddCustomer Exception Error= " + ex.Message); if (ex.InnerException != null) { logger.WriteLogError("**** InnerException = " + ex.InnerException.Message); } throw ex; } }
private void btnOpenTab_Click(object sender, EventArgs e) { wsTrialTicket trialticker = new wsTrialTicket(); trialticker.TicketName = txtCustomerName.Text + "-" + txtPIN.Text; trialticker.SchemaNumber = dwvc.GetSchema(); Int32 pendingID = dwvc.TrialCommit(0, trialticker ).PendingID; Int32 ticketId = dwvc.CommitPendingTicketWithNoTransaction(pendingID); wsPerson p = new wsPerson(); p.MEMBERSHIP_ID = "123"; p.FNAME = "Owais Aized"; Int32[] arr = new Int32[1]; arr[0] = ticketId; Int32 customerId = dwvc.AddCustomer(0, p); dwvc.AssociateCustomerTickets(0, arr, customerId); }
/// <summary> /// Create Ticket of Dinerware customer in the Dinerware system /// </summary> /// <param name="userId">UserId</param> /// <param name="customer">Customer</param> public void CreateTickets(int userId, wsPerson customer) { try { DinerwareProvider objDinerwareProvider = new DinerwareProvider(); wsTrialTicket objwsTrialTicket = new wsTrialTicket(); objwsTrialTicket.CreateTime = DateTime.UtcNow; if (!string.IsNullOrEmpty(customer.ID)) { objwsTrialTicket.CustomerID = int.Parse(customer.ID); } objwsTrialTicket.TicketName = customer.LNAME + Constants.COMMA_BLANK_SPACE + customer.FNAME; objDinerwareProvider.CreateTickets(userId, objwsTrialTicket); } catch (Exception exception) { throw exception; } }
/// <summary> /// Create Ticket of Dinerware customer in Dinerware system /// </summary> /// <param name="userId">UserId</param> /// <param name="customer">Customer</param> private int CreateTickets(int userId, wsPerson customer, string cartExternalId) { DinerwareProvider objDinerwareProvider = new DinerwareProvider(); try { wsTrialTicket objwsTrialTicket = new wsTrialTicket(); objwsTrialTicket.CreateTime = DateTime.UtcNow; if (!string.IsNullOrWhiteSpace(customer.ID)) { objwsTrialTicket.CustomerID = int.Parse(customer.ID); } objwsTrialTicket.TicketName = $"{customer.LNAME}, {customer.FNAME}"; return(objDinerwareProvider.CreateTickets(userId, objwsTrialTicket, cartExternalId)); } catch (Exception ex) { _logger.WriteLogError(ex, "CreateTickets"); throw ex; } }
/// <summary> /// Add the bLoyal customer to dinerware system /// </summary> /// <param name="userId">UserId</param> /// <param name="customer">Customer Details</param> /// <returns>Customer ID</returns> public int AddCustomer(int userId, wsPerson customer) { return(virtualDinerwareClient.AddCustomer(userId, customer)); }
/// <summary> /// Add bLoyal customer to dinerware system /// </summary> /// <param name="userId">UserId</param> /// <param name="customer">Customer Details</param> /// <returns>Customer ID</returns> public int UpdateCustomer(int userId, wsPerson customer) { return(_virtualDinerwareClient.UpdateCustomer(userId, customer)); }
/// <summary> /// Update Ticket of new customer /// </summary> /// <param name="transactionCustomer"></param> /// <param name="transactionTokenStr"></param> public int UpdateTicketWithCustomer(int userId, bLoyal.Connectors.LoyaltyEngine.Customer transactionCustomer, string cartExternalId, int openTicketId) { wsPerson[] arryWsPerson = null; wsPerson wsPerson = null; int customerId = 0; try { wsPerson dwWSPerson = new wsPerson { FNAME = transactionCustomer.FirstName, LNAME = transactionCustomer.LastName, PHONE = transactionCustomer.Phone1, ADDRESS1 = transactionCustomer.Address.Address1, ADDRESS2 = transactionCustomer.Address.Address2, CITY = transactionCustomer.Address.City, STATE = transactionCustomer.Address.StateCode, POSTAL = transactionCustomer.Address.PostalCode, ID = transactionCustomer.Id.ToString(), EMAIL = transactionCustomer.EmailAddress }; if (transactionCustomer.BirthDate.HasValue) { dwWSPerson.DOB = transactionCustomer.BirthDate.Value; } if (!string.IsNullOrWhiteSpace(transactionCustomer.ExternalId)) { int.TryParse(transactionCustomer.ExternalId, out customerId); if (customerId != 0) { wsPerson = _dinerwareProvider.GetCustomerById(userId, customerId); if (wsPerson == null) { customerId = 0; } } } if (customerId == 0 && !string.IsNullOrWhiteSpace(dwWSPerson.EMAIL)) { arryWsPerson = _dinerwareProvider.IsDinerwareCustomerAvailable(userId, dwWSPerson.EMAIL); if (arryWsPerson != null && arryWsPerson.Length > 0) { if (!string.IsNullOrWhiteSpace(arryWsPerson[0].ID)) { int.TryParse(arryWsPerson[0].ID, out customerId); wsPerson = arryWsPerson[0]; } } } if (customerId != 0 && wsPerson != null) // update the exiting customer { wsPerson.FNAME = dwWSPerson.FNAME; wsPerson.LNAME = dwWSPerson.LNAME; wsPerson.EMAIL = dwWSPerson.EMAIL; wsPerson.PHONE = dwWSPerson.PHONE; wsPerson.ADDRESS1 = dwWSPerson.ADDRESS1; wsPerson.ADDRESS2 = dwWSPerson.ADDRESS2; wsPerson.CITY = dwWSPerson.FNAME; wsPerson.STATE = dwWSPerson.STATE; wsPerson.POSTAL = dwWSPerson.POSTAL; wsPerson.DOB = dwWSPerson.DOB; } string ticketName = $"{dwWSPerson.LNAME}, {dwWSPerson.FNAME}"; customerId = customerId == 0 ? _dinerwareProvider.AddCustomer(userId, dwWSPerson) : _dinerwareProvider.UpdateCustomer(userId, wsPerson); int[] ticketArr = { openTicketId }; if (customerId != 0) { _dinerwareProvider.AssociateCustomerTickets(userId, ticketArr, customerId); } } catch (Exception ex) { _logger.WriteLogError(ex, "UpdateTicketWithCustomer"); } return(customerId); }
/// <summary> /// Add bLoyal customer to dinerware system with Create new ticket /// </summary> /// <param name="userId">userId</param> /// <param name="customer">customer</param> /// <returns>Response</returns> public TicketResponse AddCustomerToDinerware(int userId, bLoyal.Connectors.LoyaltyEngine.Customer transactionCustomer, string cartExternalId = "") { try { wsPerson[] arryWsPerson = null; int customerId = 0; wsPerson dwWSPerson = new wsPerson { FNAME = transactionCustomer.FirstName, LNAME = transactionCustomer.LastName, PHONE = transactionCustomer.Phone1, ADDRESS1 = transactionCustomer.Address.Address1, ADDRESS2 = transactionCustomer.Address.Address2, CITY = transactionCustomer.Address.City, STATE = transactionCustomer.Address.StateCode, POSTAL = transactionCustomer.Address.PostalCode, ID = transactionCustomer.Id.ToString(), EMAIL = transactionCustomer.EmailAddress }; if (transactionCustomer.BirthDate.HasValue) { dwWSPerson.DOB = transactionCustomer.BirthDate.Value; } if (!string.IsNullOrWhiteSpace(transactionCustomer.ExternalId)) { int.TryParse(transactionCustomer.ExternalId, out customerId); if (customerId != 0) { var wsPerson = _dinerwareProvider.GetCustomerById(userId, customerId); if (wsPerson == null) { customerId = 0; } } } if (customerId == 0 && !string.IsNullOrWhiteSpace(dwWSPerson.EMAIL)) { arryWsPerson = _dinerwareProvider.IsDinerwareCustomerAvailable(userId, dwWSPerson.EMAIL); if (arryWsPerson != null && arryWsPerson.Length > 0) { int.TryParse(arryWsPerson[0].ID, out customerId); } } if (customerId == 0) { customerId = _dinerwareProvider.AddCustomer(userId, dwWSPerson); } else { dwWSPerson.ID = customerId.ToString(); int customerID = _dinerwareProvider.UpdateCustomer(userId, dwWSPerson); } int ticketId = 0; if (customerId != 0) { dwWSPerson.ID = customerId.ToString(); // Create ticket ticketId = CreateTickets(userId, dwWSPerson, cartExternalId); } return(new TicketResponse { CustomerId = customerId, TicketId = ticketId }); } catch (Exception ex) { _logger.WriteLogError(ex, "AddCustomerToDinerware"); } return(null); }
private int CreateTicketsinDinnerware(Dictionary<string, object> dictinory) { // Get Title object title = null; dictinory.TryGetValue("name", out title); //Get PinCode object PicCode = null; dictinory.TryGetValue("pin_code", out PicCode); //Get PinCode object Ticket_ID = null; dictinory.TryGetValue("ticket_id", out Ticket_ID); //Get PinCode object email = null; dictinory.TryGetValue("email", out email); //Get PinCode object fname = null; dictinory.TryGetValue("first_name", out fname); //Get PinCode object lname = null; dictinory.TryGetValue("last_name", out lname); string TicketTitle = "PreGame-" + PicCode.ToString(); wsTrialTicket trialticker = new wsTrialTicket(); trialticker.TicketName = TicketTitle; trialticker.SchemaNumber = dwvc.GetSchema(); Int32 pendingID = dwvc.TrialCommit(0, trialticker).PendingID; Int32 POS_Ticket_ID = dwvc.CommitPendingTicketWithNoTransaction(pendingID); Int32 customerid = 0; Person[] customers = dwvc.GetCustomersByEmail(email.ToString()); if (customers.Length == 0) { wsPerson p = new wsPerson(); p.FNAME = fname.ToString(); p.LNAME = lname.ToString(); p.EMAIL = email.ToString(); customerid = dwvc.AddCustomer(0, p); } else { customerid = Convert.ToInt32(customers[0].ID); } Int32[] arr = new Int32[1]; arr[0] = POS_Ticket_ID; dwvc.AssociateCustomerTickets(0, arr, customerid); return POS_Ticket_ID; //List<Dictionary<string, object>> jsonUsersResults = new List<Dictionary<string, object>>(); //jsonUsersResults = PreGameAPICaller.GetPreGameTickersUsers(Ticket_ID.ToString()); }