public static dynamic AddNewCustomer(Customer oCustomer) { var oNewCustomer = new CustomerAdd(oCustomer); var sJsonResponse = JsonHelper.Post($"https://{_apiUrlBase}/api/v1/users?activate=true", JsonHelper.JsonContent(oNewCustomer), _oktaToken); return(JsonConvert.DeserializeObject(sJsonResponse)); }
public void Add() { CustomerAdd customerAdd = new CustomerAdd(); customerAdd._refreshDataGridView += new CustomerAdd.DoEvent(LoadDataGrid); customerAdd.ShowDialog(); }
static void Main(string[] args) { var c = new CustomerAdd(); c.SaveToDisk(); Console.ReadLine(); }
public async Task <data.Customer> Add(data.InvoiceContext db, CustomerAdd add) { try { var newCustomer = new data.Customer(); newCustomer.Active = add.Active; newCustomer.Address = add.Address; newCustomer.CustomerExteranlRef = add.CustomerExteranlRef; newCustomer.EmailAddress = add.EmailAddress; newCustomer.IsCompany = add.IsCompany; newCustomer.Name = add.Name; newCustomer.PhoneNumber = add.PhoneNumber; newCustomer.TaxNo = add.TaxNo; var entityLookup = await db.Entitys.FirstOrDefaultAsync(w => w.EntityId == add.EntityEntityId); if (entityLookup != null) { newCustomer.Entity = entityLookup; } db.Customers.Add(newCustomer); return(newCustomer); } catch (Exception e) { LogFactory.GetLogger().Log(LogLevel.Error, e); return(null); } }
public static dynamic AddNewUser(LoginViewModel model) { var oProfile = new Profile { Email = model.UserName, Login = model.UserName, FirstName = "No", LastName = "Name" //First & Last name is currently required, either pass them in or set fake name //Okta is removing this requirement soon and it won't required }; var oAddCustomer = new CustomerAdd(); oAddCustomer.Profile = oProfile; //Enhancement: //could look up a group and add group to the CustomerAdd object to organize users for this app //Please Note: //User will be in 'Pending user action', which is good for security //can still add MFA to 'Pending' users and they can't log into Okta //If you want them to be Activated then set the Password return(JsonHelper.Post($"https://{_apiUrlBase}/api/v1/users?activate=true", JsonHelper.JsonContent(oAddCustomer), _oktaToken)); }
// Post: Admin/Customer/Add/id public virtual ActionResult Add(CustomerAdd model) { if (!ModelState.IsValid) { return(View(model)); } _customerService.Add(model); _uow.SaveAllChanges(); return(RedirectToAction("Index")); }
public void Add(CustomerAdd customer) { _categories.Add(new Customer { Title = customer.Title, Description = customer.Description, Name = customer.Name, Family = customer.Family, Email = customer.Email, Mobile = customer.Mobile, Telephone = customer.Telephone, }); }
public CustomerAdd GetCustomerAdd() { var result = new CustomerAdd(); result.Active = CustomerView.Active; result.CustomerExteranlRef = CustomerView.CustomerExteranlRef; result.CustomerId = CustomerView.CustomerId; result.EmailAddress = CustomerView.EmailAddress; result.IsCompany = CustomerView.IsCompany; result.Name = CustomerView.Name; result.PhoneNumber = CustomerView.PhoneNumber; result.TaxNo = CustomerView.TaxNo; result.EntityEntityId = CustomerView.EntityEntityId; return(result); }
// Add Transaction Code public async Task <CustomerView> Add(CustomerAdd add) { try { using (var db = new data.InvoiceContext()) { var result = await Add(db, add); await db.SaveChangesAsync(); return((CustomerView)result); } } catch (Exception e) { LogFactory.GetLogger().Log(LogLevel.Error, e); return(null); } }
public async Task <CustomerView> CustomerAdd(CustomerAdd add) { try { string json = ""; var client = new HttpClient(); using (var ms = new MemoryStream()) { var serializer = new DataContractJsonSerializer(typeof(CustomerAdd)); serializer.WriteObject(ms, add); ms.Position = 0; StreamReader sr = new StreamReader(ms); json = sr.ReadToEnd(); } var stream = await client.PostAsync("http://localhost:44443/api/customer", new StringContent(json, Encoding.UTF8, "application/json")); using (var ms = new MemoryStream()) { var serializer = new DataContractJsonSerializer(typeof(CustomerView), new DataContractJsonSerializerSettings() { DateTimeFormat = new DateTimeFormat("yyyy-MM-dd'T'HH:mm:ss") }); await stream.Content.CopyToAsync(ms); ms.Position = 0; var view = serializer.ReadObject(ms) as CustomerView; return(view); } } catch (Exception e) { LogFactory.GetLogger().Log(LogLevel.Error, e); return(null); } }
public CustomerWithData CustomerAdd(CustomerAdd newItem) { // Ensure that a "newItem" is in the entity body if (newItem == null) { return(null); } // Ensure that we can use the incoming data // Attention 11 - We do not have access to ModelState in this kind of class // However, we can add it in... var vc = new ValidationContext(newItem, null, null); var modelStateIsValid = Validator.TryValidateObject(newItem, vc, null, true); if (modelStateIsValid) { // Attempt to add the new object var addedItem = m.CustomerAdd(newItem); // Notice the ApiController convenience methods if (addedItem == null) { return(null); } else { return(addedItem); } } else { return(null); } }
private XDocument buildInfomediaRequest(string ticket) { var rep = new Repository(); var docMaker = new CustomerAdd(); var user = rep.GetUser(WebSecurity.CurrentUserId); bool requiresInventoryUpdate = user.Client.RequiresInventoryUpdate ?? false; bool requiresTaxCodeUpdate = user.Client.RequiresTaxCodeUpdate ?? false; var customer = rep.GetUnprocessedCustomersByTransaction(ticket).FirstOrDefault(); var order = rep.GetUnprocessedOrdersByTransaction(ticket).FirstOrDefault(); var transaction = rep.GetTransaction(ticket); if (requiresTaxCodeUpdate && transaction.ProcessedItemSalesTaxQueryRs != true) { var doc = SalesTax.ItemSalesTaxQueryRq; transaction.ProcessedItemSalesTaxQueryRs = true; rep.Save(); return(doc); } else if (requiresTaxCodeUpdate) { var doc = SalesTax.ItemSalesTaxGroupQueryRq; user.Client.RequiresTaxCodeUpdate = false; rep.Save(); return(doc); } else if (requiresInventoryUpdate && transaction.ProcessedItemInventoryQuery != true) { var doc = Inventory.ItemInventoryFullQueryRq(); transaction.ProcessedItemInventoryQuery = true; rep.Save(); return(doc); } else if (requiresInventoryUpdate) { if (user.Client.IsContentEditsShop ?? false) { UpdateShopInventory(); } var doc = Inventory.ItemNonInventoryFullQueryRq(); user.Client.RequiresInventoryUpdate = false; rep.Save(); return(doc); } else if (customer != null) { var doc = docMaker.GetCustomer(customer.CustomerID, customer.Orders.FirstOrDefault().OrderNumber); customer.CurrentRequest = true; customer.Reported = true; rep.Save(); return(doc); } if (order.AmountDiscount != null && order.AmountDiscount > 0) { Error.ProcessFailedOrder(order); order.Reported = true; rep.Save(); order = rep.GetUnprocessedOrdersByTransaction(ticket).FirstOrDefault(); } else if (order != null) { var fullinvoice = new FullInvoice(); //var invoice = new Invoice(); var doc = fullinvoice.GetInvoice(order.Customer.CustomerID, order.OrderID); order.Reported = true; rep.Save(); return(doc); } return(null); }
public static dynamic AddNewCustomer(Customer oCustomer) { var oNewCustomer = new CustomerAdd(oCustomer); return(JsonHelper.Post($"https://{_apiUrlBase}/api/v1/users?activate=true", JsonHelper.JsonContent(oNewCustomer), _oktaToken));; }
// GET: Admin/Customer/Add public virtual ActionResult Add() { CustomerAdd Customer = new CustomerAdd(); return(View(Customer)); }