private void button3_Click(object sender, EventArgs e) { //[CONNECTION STRINGS] var connectionString = ConfigurationManager.ConnectionStrings["EmployeeManagement"].ConnectionString; SqlConnection con = new SqlConnection(connectionString); //filling a dataset with relevant information and then displaying it con.Open(); SqlCommand cmd = con.CreateCommand(); cmd.CommandType = CommandType.Text; cmd.CommandText = "select * from TaskSchedule"; cmd.ExecuteNonQuery(); DataTable dt = new DataTable(); SqlDataAdapter da = new SqlDataAdapter(cmd); da.Fill(dt); EmployeeTasks.DataSource = dt; EmployeeTasks.Refresh(); con.Close(); panel3.Visible = true; panel2.Visible = false; Dashboard.Visible = false; panel4.Visible = false; holidayPanel.Visible = false; }
public async Task <IActionResult> DeleteTask(int id) { EmployeeTasks Tasks = await _repo.Get(id); _repo.RemoveTasks(Tasks); await _unitofwork.CompleteAsync(); return(Ok(id)); }
public TestingSpecialistForm1() { InitializeComponent(); _projectBusiness = new ProjectBusiness(); _tasksBusiness = new TasksBusiness(); _stateBusiness = new StateBusiness(); _tasks = new Tasks(); _employeeTaskBusiness = new EmployeeTasksBusiness(); _employeeTask = new EmployeeTasks(); _employeeBusiness = new EmployeeBusiness(); }
public bool Add(EmployeeTasks item) { if (item.EmployeeId != 0 && item.TaskId != 0) { _uof.EmployeeTasksRepository.Add(item); return(_uof.ApplyChange()); } return(false); }
public BusinessAnalystForm1() { _taskBusiness = new TasksBusiness(); _projectBusiness = new ProjectBusiness(); _tasks = new Tasks(); _employeeBusiness = new EmployeeBusiness(); _employeeTasks = new EmployeeTasks(); _employeeTaskBusiness = new EmployeeTasksBusiness(); _stateBusiness = new StateBusiness(); InitializeComponent(); }
public static void DeleteTask(long id) { var task = EmployeeTasks.FirstOrDefault(e => e.Id == id); if (task == null) { return; } DataContext.Tasks.Remove(task); DataContext.SaveChanges(); }
public async void AddTask(int UserId, EmployeeTasks.Priority priority, DateTime startTime, DateTime endTime, EmployeeTasks.Status status, string details) { var employeeTask = new EmployeeTasks() { EmployeeId = UserId, Priority_ = priority, Status_ = status, Details = details, StartingPoint = startTime, EndPoint = endTime, }; _context.Tasks.Add(employeeTask); await _context.SaveChangesAsync(); }
public void TestRestock() { OrderTasks ot = new OrderTasks(); List <Product> emptyItems = new List <Product>(); Order emptyOrder = new Order(emptyItems); ot.AddProduct(emptyOrder, testCheese); ot.AddProduct(emptyOrder, testCheese); ot.AddProduct(emptyOrder, testCheese); int postOrder = testCheese.Stock; EmployeeTasks et = new EmployeeTasks(); et.RestockProductGlobal(testCheese); int postRestock = testCheese.Stock; Assert.Equal(postOrder + 3, postRestock); }
public async Task <IActionResult> UpdateTasks(int id, [FromBody] EmployeeTasksResources TaskResource) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } EmployeeTasks Tasks = await _repo.Get(id); if (Tasks == null) { return(NotFound()); } _mapper.Map(TaskResource, Tasks); await _unitofwork.CompleteAsync(); return(StatusCode(202)); }
public void RestockUi(DbRepo repo, Product p) { // ask for product and restock ProductTasks pt = new ProductTasks(repo); EmployeeTasks et = new EmployeeTasks(repo); Product realProduct = new Product(); if (pt.GetProductById(p.Id).Equals(p.Id)) { } else { pt.AddProduct(p); } string id; string proceed = "0"; do { Console.WriteLine("Please enter a valid Product id"); id = Console.ReadLine(); while (ValidInput(id, "\\D")) { Console.WriteLine("Sorry, please enter a whole number!"); id = Console.ReadLine(); } realProduct = repo.GetProductById(Convert.ToInt32(id)); if (realProduct == null) { Console.WriteLine("Sorry, That id number was not valid!"); Console.WriteLine("Please select an option: \n[0] try again \n[any other key] quit"); } } while (ValidInput(proceed, "0")); et.RestockProductGlobal(realProduct); }
public void Start() { // first step: get info to create a customer object & check if that // customer is in the db string proceed = ""; Customer c; do { c = LogIn(); proceed = "4"; if (c.Id == -1) { Console.WriteLine("Quitting now."); return; } if (c.Id == -2) { Console.WriteLine("Sorry, that account is already claimed. Select an option to proceed"); Console.WriteLine("[0] Try Again"); Console.WriteLine("[1] Quit"); proceed = Console.ReadLine(); } } while (ValidInput(proceed, "0")); if (ValidInput(proceed, "1")) { Console.WriteLine("Quitting now."); return; } // Next Step: let customer make order and persist to db Console.WriteLine($"Hello {c.Name}! Here are Today's Products: "); Console.Write("Milk \nCheese \nIce Cream\n"); Console.WriteLine("Would you like to place an order? \n[0] Yes \n[1] No"); proceed = Console.ReadLine(); while (!ValidInput(proceed, "0|1")) { Console.WriteLine("Sorry, please enter 0 to proceed or 1 to quit"); proceed = Console.ReadLine(); } StoreContext context = new StoreContext(); DbRepo repo = new DbRepo(context); OrderTasks ot = new OrderTasks(repo); CustomerTasks ct = new CustomerTasks(repo); EmployeeTasks et = new EmployeeTasks(repo); LocationTasks lt = new LocationTasks(repo); ProductTasks pt = new ProductTasks(repo); List <Order> previousOH = new List <Order>(); if (c.Equals(repo.GetCustomerById(c.Id))) { previousOH = repo.GetCustomerById(c.Id).OrderHistory; repo.AddCustomer(c); } else { previousOH = repo.GetCustomerById(c.Id).OrderHistory; repo.RemoveCustomer((repo.GetCustomerById(c.Id))); repo.AddCustomer(c); } previousOH = c.OrderHistory; if (ValidInput(proceed, "0")) { Console.WriteLine("Time to place an order!"); Order newOrder = MakeOrder(); newOrder.Id = c.Id; Order emptyOrder = new Order(); if (newOrder.Equals(emptyOrder)) { Console.WriteLine("GoodBye"); return; } string confirm; double price = newOrder.OrderPrice(); Console.WriteLine($"That will be ${price}"); do { Console.WriteLine("Please Select [0] to pay now or [1] to cancel your order"); confirm = Console.ReadLine(); }while (!ValidInput(confirm, "0|1")); if (ValidInput(confirm, "0")) { c.AddOrderToHistory(newOrder); repo.UpdateCustomer(c); Console.WriteLine("Your order has been processed!"); } if (ValidInput(confirm, "1")) { Console.WriteLine("Your order has been cancelled. GoodBye."); } } //next step: Console.WriteLine("What would you like to do now?"); Console.WriteLine("[0] Check Order History \n[1]Check location inventory \n[3]Check product stock"); Console.WriteLine("[4] Quit"); string next = Console.ReadLine(); while (!ValidInput(next, "0|1|2|3")) { Console.WriteLine("Please select a valid option to continue"); Console.WriteLine("[0] Check Order History \n[1]Check location inventory"); Console.WriteLine("[2] Quit"); } if (ValidInput(next, "0")) { ShowOrderHistory(c, repo, previousOH); } if (ValidInput(next, "1")) { CheckInventory(repo); } if (ValidInput(next, "2")) { Console.WriteLine("Have a nice day! Goodbye!"); return; } }
public TaskDetails(EmployeeTasks task, TasksViewModel vm) { _vm = vm; this.task = task; InitializeComponent(); }
public static IQueryable <EmployeeTask> GetEmployeeTasks(string filterExpression) { return((IQueryable <EmployeeTask>)EmployeeTasks.AppendWhere(ExpressionConverter, CriteriaOperator.Parse(filterExpression))); }