public async Task GetCustomerTasks_ExistingTask_ReturnsNonEmptyCollection() { using (var context = _factory.GetKIOTContext()) { var(customer, caretaker) = context.AddCaretakerForCustomer("jcole", "mwilson"); var task = new CustomerTask(customer, caretaker, "TestDescription", "TestTitle", null); Assert.False(task.TaskFinished); context.CustomerTasks.Add(task); context.SaveChanges(); } (await _client.AuthenticateUserAsync("jcole", "password")).AddAuthorization(_httpClient); CustomerTasksForCaretakerDto response = null; Assert.Null(await Record.ExceptionAsync(async() => response = await _client.Caretaker_GetCustomerTasksAsync(Guid.Parse("d53a5412-efdd-4905-9f5d-5c2a624726a2")))); Assert.NotNull(response); Assert.Single(response.Tasks); var responseTask = response.Tasks.First(); Assert.Equal("TestTitle", responseTask.Title); Assert.Equal("TestDescription", responseTask.Description); Assert.False(responseTask.Finished); }
public async Task SetCustomerTaskState_InvalidTaskState_Fails() { Guid guid; using (var context = _factory.GetKIOTContext()) { var(customer, caretaker) = context.AddCaretakerForCustomer("jcole", "fbrown"); var task = new CustomerTask(customer, caretaker, "TestDescription", "TestTitle", null); guid = task.Guid; Assert.False(task.TaskFinished); context.CustomerTasks.Add(task); context.SaveChanges(); } Assert.NotEqual(Guid.Empty, guid); (await _client.AuthenticateUserAsync("jcole", "password")).AddAuthorization(_httpClient); SuccessfulRequestDto response = null; Assert.NotNull(await Record.ExceptionAsync(async() => response = await _client.Caretaker_SetCustomerTaskStateAsync(new SetCustomerTaskStateDto { CustomerTaskGuid = guid, State = (CustomerTaskState)12 }))); Assert.Null(response); using (var context = _factory.GetKIOTContext()) { Assert.Equal(1, context.CustomerTasks.Count(x => x.Caretaker.Username == "jcole")); } }
public ActionResult DeleteConfirmed(int id) { CustomerTask customerTask = db.CustomerTasks.Find(id); db.CustomerTasks.Remove(customerTask); db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult Create(CustomerTask customerTask) { _context.CustomerTasks.Add(customerTask); _context.SaveChanges(); return(RedirectToAction("TaskList")); }
public async Task Handle(string request) { //string sC = "data source=QHB-CRMDB001.centralservices.local;initial catalog=eInsightCRM_OceanProperties_QA;uid=eInsightCRM_eContact_OceanProperties;pwd=Tv3CxdZwA%9;MultipleActiveResultSets=True"; //string dC = "data source=localhost;initial catalog=eInsightCRM_AMResorts_QA;uid=sa;pwd=123456;MultipleActiveResultSets=True"; //string dT = "dbo.D_Customer"; //string sql = "SELECT TOP 20 CustomerID, FirstName, LastName, Email, PropertyCode, InsertDate, SourceID, AddressStatus, DedupeCheck, AllowEMail, Report_Flag, UNIFOCUS_SCORE FROM dbo.D_Customer with(Nolock);"; //string sql1 = "SELECT TOP 20 CustomerID, FirstName, LastName, Email, PropertyCode, InsertDate, SourceID, AddressStatus, DedupeCheck, AllowEMail, Report_Flag, UNIFOCUS_SCORE FROM dbo.D_Customer_03092017 with(Nolock);"; //List<Dictionary<string,string>> SQL_GetDataFromPMS_SpecialRequestsList = SQLHelper.GetDbValues(sC, "SQL_GetDataFromPMS_SpecialRequests", sql, null); //new DataFlowTask<D_Customer>().runTask(sC, dC, dT, sql, true, true, new List<string>() { "FirstName", "LastName" }, new List<string>() { "CustomerID", "FirstName", "LastName", "Email", "PropertyCode", "InsertDate", "SourceID", "AddressStatus", "DedupeCheck", "AllowEMail", "Report_Flag", "UNIFOCUS_SCORE" }); // new DataFlowTask<D_Customer>().runTask1<D_Customer, D_Customer, D_Customer>(sC, dC, dT, sql, sql1, true, true, new List<string>() { "FirstName"}, new List<string>() { "CustomerID", "FirstName", "LastName", "Email", "PropertyCode", "InsertDate", "SourceID", "AddressStatus", "DedupeCheck", "AllowEMail", "Report_Flag", "UNIFOCUS_SCORE" }); try { string eContactLogConnectionString = System.Configuration.ConfigurationManager.AppSettings["econtact-log-db-sql"]; ControlFlow.CurrentDbConnection = new SqlConnectionManager(new ConnectionString(eContactLogConnectionString)); CreateLogTablesTask.CreateLog(); StartLoadProcessTask.Start("Process 1", "Start Message 1", "ETL"); var settings = JsonConvert.DeserializeObject <Dictionary <string, object> >(request); ControlFlow.STAGE = "0"; eContactDBManager.GetCompanySetting(settings); ControlFlow.SetLoggingDatabase(new SqlConnectionManager(eContactLogConnectionString)); //Customer CustomerTask CT = new CustomerTask(); CT.Start(); } catch (Exception ex) { ControlFlow.STAGE = "0"; new LogTask() { Message = $"Exception({ex.Message}) Occurred. Task Stopped!", ActionType = "Stop" }.Info(); NLog.LogManager.GetCurrentClassLogger().Fatal(ex); } //Console.WriteLine("Starting ControlFlow example"); //ControlFlowTasks cft = new ControlFlowTasks(); //cft.Start(); //Console.WriteLine("ControlFlow finished..."); //Console.WriteLine("Start Logging example"); //Logging log = new Logging(); //log.Start(); //Console.WriteLine("Logging finished..."); //Console.WriteLine("Starting DataFlow example"); //DataFlowTasks dft = new DataFlowTasks(); //dft.Preparation(); //dft.Start(); //Console.WriteLine("Dafaflow finished..."); //Console.WriteLine("Press any key to continue..."); //Console.ReadLine(); }
public ActionResult Edit([Bind(Include = "Customer_id,Name,Note")] CustomerTask customerTask) { if (ModelState.IsValid) { db.Entry(customerTask).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(customerTask)); }
public OrderHistoryMenu(SavvyContext context, DBMapper mapper) { this.repo = new SavvyRepo(context, mapper); this.locationtask = new LocationTask(repo); this.inventorytask = new InventoryTask(repo); this.producttask = new ProductTask(repo); this.ordertask = new OrderTask(repo); this.orderitemtask = new OrderItemTask(repo); this.customertask = new CustomerTask(repo); }
public ActionResult Create([Bind(Include = "Customer_id,Name,Note")] CustomerTask customerTask) { if (ModelState.IsValid) { db.CustomerTasks.Add(customerTask); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(customerTask)); }
public IHttpActionResult CreateCustomerTask(CustomerTask customerTask) { if (!ModelState.IsValid) { throw new HttpRequestException(HttpStatusCode.BadRequest.ToString()); } _context.CustomerTasks.Add(customerTask); _context.SaveChanges(); return(Created(new Uri(Request.RequestUri + "/" + customerTask.Id), customerTask)); }
public void addTask(CustomerTask task) { var dataContext = new TaskModelDataContext(); dataContext.CustomerTasks.InsertOnSubmit(task); dataContext.SubmitChanges(); using (System.IO.StreamWriter file = new System.IO.StreamWriter(@"C:\Users\Public\homecarelog.txt", true)) { file.WriteLine(DateTime.Now + " new task with id " + task.Id + " created"); } }
static async Task TaskProducer(ConcurrentQueue <CustomerTask> queue) { for (int i = 1; i <= 20; i++) { await Task.Delay(50); var workItem = new CustomerTask { Id = i }; queue.Equals(workItem); Console.WriteLine($"Task {workItem.Id} has been posted"); } }
// GET: CustomerTasks/Delete/5 public ActionResult Delete(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } CustomerTask customerTask = db.CustomerTasks.Find(id); if (customerTask == null) { return(HttpNotFound()); } return(View(customerTask)); }
public void updateTask(CustomerTask task) { var dataContext = new TaskModelDataContext(); var query = (from m in dataContext.CustomerTasks where m.Id == task.Id select m); query.First().title = task.title; query.First().duration = task.duration; query.First().description = task.description; dataContext.SubmitChanges(); using (System.IO.StreamWriter file = new System.IO.StreamWriter(@"C:\Users\Public\homecarelog.txt", true)) { file.WriteLine(DateTime.Now + " task with id " + task.Id + " updated"); } }
public void start() { do { Console.WriteLine("What would you like to do?"); Console.WriteLine("[1] Buy a Product"); Console.WriteLine("[2] Check Order History"); Console.WriteLine("[3] View Cart/Check Out"); Console.WriteLine("[4] Check Location Inventory"); Console.WriteLine("[5] Go back"); userInput = Console.ReadLine(); locationtask = new LocationTask(repo); CustomerTask customerTask = new CustomerTask(repo); switch (userInput) { case "1": productMenu.start(); Log.Information("Cart Added!"); break; case "2": orderhistorymenu.start(); Log.Information("Cart History Viewed!"); break; case "3": cartMenu.start(); break; case "4": Console.WriteLine("Nothing yet!"); break; case "5": Console.WriteLine("Returning to main menu..."); break; default: //invalid input message; Console.WriteLine("Make a valid selection!"); break; } }while (!userInput.Equals("5")); }
public void UpdateCustomerTask(int id, CustomerTask customerTask) { if (!ModelState.IsValid) { throw new HttpRequestException(HttpStatusCode.BadRequest.ToString()); } var customerTaskInDb = _context.CustomerTasks.SingleOrDefault(c => c.Id == id); if (customerTaskInDb == null) { throw new HttpRequestException(HttpStatusCode.BadRequest.ToString()); } customerTaskInDb.Name = customerTask.Name; customerTaskInDb.Details = customerTaskInDb.Details; customerTaskInDb.IsCompleted = customerTaskInDb.IsCompleted; _context.SaveChanges(); }
public ActionResult New() { var customerTask = new CustomerTask(); return(View(customerTask)); }
public ActionResult CreateTask(CustomerTask task) { DBLink.addTask(task); return(RedirectToAction("TaskList")); }
public ActionResult EditTask(CustomerTask task) { DBLink.updateTask(task); return(RedirectToAction("TaskList")); }
public ActionResult DeleteTask(CustomerTask task) { DBLink.deleteTaskById(task.Id); return(RedirectToAction("TaskList")); }
public HttpResponseMessage updateTask(CustomerTask task) { dbWrapper.updateTask(task); return(this.Request.CreateResponse(HttpStatusCode.OK)); }
private static void GenerateRunningTask(string Subsidary) { int TaskRunType = Utility.ConvertToInt(ConfigurationManager.AppSettings["TaskRunType"]); if (TaskRunType == 1 || TaskRunType == 3) { #region Setting //NetSuiteBaseIntegration[] NetSuitetaskBase = new NetSuiteBaseIntegration[1]; //NetSuitetaskBase[0] = new SettingTask(); //foreach (NetSuiteBaseIntegration ts in NetSuitetaskBase) //{ // try // { // ts.Set(""); // ts.Get(); // } // catch (Exception ex) // { // LogDAO.Integration_Exception(LogIntegrationType.Error, "NetSuitetaskBase Main Program Error", "Error " + ex.Message); // } //} #endregion //foodics integeration Foodics_BaseIntegration[] FoodicstaskInital = new Foodics_BaseIntegration[8]; FoodicstaskInital[0] = new FoodicsBranche_Task(); FoodicstaskInital[1] = new FoodicsPaymentMethod_Task(); FoodicstaskInital[2] = new FoodicsProductCategories_task(); FoodicstaskInital[3] = new FoodicsInventoryCategories_task(); FoodicstaskInital[4] = new FoodicsModifiers_task(); FoodicstaskInital[5] = new FoodicsInventoryItem_Task(); FoodicstaskInital[6] = new FoodicsdDiscounts_Task(); FoodicstaskInital[7] = new FoodicsOtherChargetem_Task(); foreach (Foodics_BaseIntegration ts in FoodicstaskInital) { try { LogDAO.Integration_Exception(LogIntegrationType.Error, "FoodicstaskInital Main Program Task", ts.GetType().Name); ts.Get(Subsidary); } catch (Exception ex) { LogDAO.Integration_Exception(LogIntegrationType.Error, "FoodicstaskInital Main Program Error", "Error " + ex.Message); } } NetSuiteBaseIntegration[] NetSuitetaskInitial = new NetSuiteBaseIntegration[6]; NetSuitetaskInitial[0] = new ProductClassTask(); NetSuitetaskInitial[1] = new LocationTask(); NetSuitetaskInitial[2] = new UnitsTypeTask(); NetSuitetaskInitial[3] = new ItemTask(); NetSuitetaskInitial[4] = new DiscountTask(); NetSuitetaskInitial[5] = new ChargeItemTask(); foreach (NetSuiteBaseIntegration ts in NetSuitetaskInitial) { try { LogDAO.Integration_Exception(LogIntegrationType.Error, "NetSuitetaskInitial Main Program Task", ts.GetType().Name); ts.Set(""); ts.Get(); } catch (Exception ex) { LogDAO.Integration_Exception(LogIntegrationType.Error, "NetSuitetaskInitial Main Program Error", "Error " + ex.Message); } } Foodics_BaseIntegration[] Foodicstask2 = new Foodics_BaseIntegration[3]; Foodicstask2[0] = new Foodicsproducts_Task(); if (Utility.ConvertToInt(ConfigurationManager.AppSettings["ModifierOptionProduct"]) == 1) { Foodicstask2[1] = new FoodicsModifierOptionProduct_Task(); //for Delicious } else { Foodicstask2[1] = new FoodicsModifierOptionsService_Task();//for Overdooose } Foodicstask2[2] = new FoodicsPaymentMethod_Task(); foreach (Foodics_BaseIntegration ts in Foodicstask2) { try { LogDAO.Integration_Exception(LogIntegrationType.Error, "Foodicstask2 Main Program Task", ts.GetType().Name); ts.Get(Subsidary); } catch (Exception ex) { LogDAO.Integration_Exception(LogIntegrationType.Error, "Foodicstask2 Main Program Error", "Error " + ex.Message); } } NetSuiteBaseIntegration[] NetSuitetask02 = new NetSuiteBaseIntegration[3]; NetSuitetask02[0] = new PaymentMethodTask(); NetSuitetask02[1] = new ProductTask(); NetSuitetask02[2] = new ServiceItemTask(); foreach (NetSuiteBaseIntegration ts in NetSuitetask02) { try { LogDAO.Integration_Exception(LogIntegrationType.Error, "NetSuitetask02 Main Program Task", ts.GetType().Name); ts.Set(""); ts.Get(); } catch (Exception ex) { LogDAO.Integration_Exception(LogIntegrationType.Error, "NetSuitetask02 Main Program Error", "Error " + ex.Message); } } } if (TaskRunType == 2 || TaskRunType == 3) { Foodics_BaseIntegration[] FoodicstaskFinal = new Foodics_BaseIntegration[2]; FoodicstaskFinal[0] = new FoodicsCustomer_Task(); FoodicstaskFinal[1] = new FoodicsOrder_Task(); foreach (Foodics_BaseIntegration ts in FoodicstaskFinal) { try { ts.Get(Subsidary); } catch (Exception ex) { LogDAO.Integration_Exception(LogIntegrationType.Error, "NetSuitetaskInitial Main Program Error", "Error " + ex.Message); } } NetSuiteBaseIntegration[] NetSuitetaskFinal = new NetSuiteBaseIntegration[7]; NetSuitetaskFinal[0] = new CustomerTask(); NetSuitetaskFinal[1] = new AssemblyBuildTask(); NetSuitetaskFinal[2] = new InvoiceTask(); NetSuitetaskFinal[3] = new CustomerPaymentTask(); NetSuitetaskFinal[4] = new CreditMemoTask(); NetSuitetaskFinal[5] = new CustomerRefundTask(); NetSuitetaskFinal[6] = new AdjustmentBuildTask(); foreach (NetSuiteBaseIntegration ts in NetSuitetaskFinal) { try { ts.Set(""); ts.Get(); } catch (Exception ex) { LogDAO.Integration_Exception(LogIntegrationType.Error, "NetSuitetaskFinal Main Program Error", "Error " + ex.Message); } } } }
public void Setup() { It = new FakeChannel(); ExpectedNumberOfDrinkRequests = 100; var customerProcessor = new CustomerTask(It, ExpectedNumberOfDrinkRequests); customerProcessor.Process(); }