private List <MTasks> GetTasksInfo() { TaskRepo taskRepo = new TaskRepo(tasksFilepath); List <MTasks> tasksList = new List <MTasks>(); tasksList = taskRepo.GetAll(); return(tasksList); }
public AdminLeaveController(TaskRepo taskRepo, IEmpRepository empRepository, IWebHostEnvironment webHostEnvironment, LeaveRepository leaveRepository, JobRepository jobRepository) { _empRepository = empRepository; _jobRepository = jobRepository; _webHostEnvironment = webHostEnvironment; _leaveRepository = leaveRepository; _taskRepository = taskRepo; }
public AccountController(UserManager <ApplicationUser> userManager, TimeTrackRepo timeTrackRepo, TaskRepo taskRepo, SignInManager <ApplicationUser> signInManager, Repo4 repo4) { _userManager = userManager; _signInManager = signInManager; _timeTrackRepo = timeTrackRepo; _taskRepository = taskRepo; _repo4 = repo4; }
public static TaskRepo getTaskInstance() { if (_taskInstance == null) { _taskInstance = new TaskRepo(); } return(_taskInstance); }
public TaskControllersTests() { var context = new TodoContext(dbContextOptions); DBInitializer db = new DBInitializer(); db.SeedDB(context); tRepository = new TaskRepo(context); taskService = new TaskService(tRepository); }
static void Main() { //Singleton pattern used for class RepoCompany // RepoCompany repoCompany = new RepoCompany(); TaskRepo taskRepo = new TaskRepo(); CompanyService companyService = new CompanyService(RepoCompany.Instance, taskRepo); Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); Application.Run(new LoginView(companyService)); }
public PartialViewResult Edit(int taskId) { TaskRepo taskRepo = new TaskRepo(context); Tasks tasks = taskRepo.Get(taskId); ViewBag.Users = context.Users.Select(r => new SelectListItem { Value = r.Id, Text = r.UserName, Selected = r.Id == tasks.AssignTo }).ToList(); return(PartialView(tasks)); }
private void SetTimeSources() { MTasks user = (MTasks)tasksBindingSource1.Current; TaskRepo gat = new TaskRepo(); timeBindingSource.DataSource = gat.GetTTime(user); dataGridView2.DataSource = timeBindingSource; //timeBindingSource.DataSource = this.GetTTime(); //dataGridView2.DataSource = timeBindingSource; }
public EmployeeHomeController(TaskRepo taskRepo, AttendenceRepo attendenceRepo, LeaveRepository leaveRepository, IEmpRepository empRepository, IWebHostEnvironment webHostEnvironment, TimeTrackRepo timeTrackRepo, EmpStoreContext context, Repo4 repo4) { _timeTrackRepo = timeTrackRepo; _empRepository = empRepository; _webHostEnvironment = webHostEnvironment; _context = context; _leaveRepository = leaveRepository; _attendenceRepository = attendenceRepo; _taskRepository = taskRepo; _repo4 = repo4; }
public ActionResult Details(int?id) { TaskDetailsVm model = new TaskDetailsVm(); model.PagerComment = model.PagerComment ?? new Pager(); model.PagerLogWork = model.PagerLogWork ?? new Pager(); model.FilterComment = model.FilterComment ?? new CommentsFilter(); model.FilterLoggedWorks = model.FilterLoggedWorks ?? new LoggedWorksFilter(); TryUpdateModel(model); TaskRepo repository = RepositoryFactory.GetTasksRepository(); Task task = repository.GetById(Convert.ToInt32(id)); model.Id = task.Id; model.UserId = task.UserId; model.Title = task.Title; model.Description = task.Description; model.ResponsibleUser = task.ResponsibleUser; model.Creator = task.Creator; model.Status = task.Status; model.LastChange = task.LastChange; model.CreateTime = task.CreateTime; CommentRepo comRepo = RepositoryFactory.GetCommentsRepository(); LoggedWorkRepo logWorkRepo = RepositoryFactory.GetLoggedWorksRepository(); string action = this.ControllerContext.RouteData.Values["action"].ToString(); string controller = this.ControllerContext.RouteData.Values["controller"].ToString(); //comments model.FilterComment.Prefix = "FilterComment."; string commentsPrefix = "PagerComment."; model.FilterComment.TaskId = task.Id; int commentsResultCount = comRepo.Count(model.FilterComment.BuildFilter()); model.PagerComment = new Pager(commentsResultCount, model.PagerComment.CurrentPage, model.PagerComment.PageSize, commentsPrefix, action, controller); model.FilterComment.ParentPager = model.PagerComment; model.CommentsList = comRepo.GetAll(model.FilterComment.BuildFilter(), model.PagerComment.CurrentPage, model.PagerComment.PageSize.Value).ToList(); //loggedwork model.FilterLoggedWorks.Prefix = "FilterLoggedWorks."; string loggedWorkPrefix = "PagerLogWork."; model.FilterLoggedWorks.TaskId = task.Id; int loggedWorkResultCount = logWorkRepo.Count(model.FilterLoggedWorks.BuildFilter()); model.PagerLogWork = new Pager(loggedWorkResultCount, model.PagerLogWork.CurrentPage, model.PagerLogWork.PageSize, loggedWorkPrefix, action, controller); model.FilterLoggedWorks.ParentPager = model.PagerLogWork; model.LoggedWorkList = logWorkRepo.GetAll(model.FilterLoggedWorks.BuildFilter(), model.PagerLogWork.CurrentPage, model.PagerLogWork.PageSize.Value).ToList(); return(View(model)); }
private void tsMainNew_Click(object sender, EventArgs e) { MTasks item = new MTasks(); NewTask newTask = new NewTask(item); if (newTask.ShowDialog() == DialogResult.OK) { TaskRepo edd = new TaskRepo(); edd.Save(item); SetDataSources(); } }
private void toolStripButton3_Click_1(object sender, EventArgs e) { Int32 selectedRowCount = dataGridView1.Rows.GetRowCount(DataGridViewElementStates.Selected); if (selectedRowCount > 0) { MTasks task = (MTasks)tasksBindingSource1.Current; TaskRepo edd = new TaskRepo(); task.Final = Convert.ToBoolean(true); edd.Save(task); SetDataSources(); } }
//private List<MTasks> GetAllTasks() //{ // using (var db = new Index.BloggingContext()) // { // var result = // (from m in db.MTasks // select m).ToList(); // return result; // } //} //public List<MTasks> GetAllNF() //{ // using (var db = new Index.BloggingContext()) // { // var result = // (from m in db.MTasks // where m.Final == false // select m).ToList(); // return result; // } //} //private List<TimeSpent> GetTTime() //{ // using (var db = new Index.BloggingContext()) // { // MTasks user = (MTasks)tasksBindingSource1.Current; // var result = // (from t in db.TimeSpent // where t.TheTask == user.TaskId // select t).ToList(); // return result; // } //} //private void NewTask(MTasks task) //{ // using (var db = new Index.BloggingContext()) // { // var now = DateTime.Now;//.ToString("MM/dd/yyyy HH:mm:ss"); // var item = new MTasks { Title=task.Title, Description=task.Description, Creator=task.Creator, EstTime=task.EstTime, Assigned=task.Assigned, CreTime=now, Final=false }; // db.MTasks.Add(item); // db.SaveChanges(); // } //} //private void EditTask(MTasks task) //{ // using (var db = new Index.BloggingContext()) // { // var item = // (from m in db.MTasks // where m.TaskId == task.TaskId // select m).First(); // db.Database.ExecuteSqlCommand("UPDATE MTasks" + // " SET Title={0},Description={1},EstTime={2},Assigned={3},Final={4}" + // " WHERE TaskId={5}", task.Title, task.Description, // task.EstTime, task.Assigned, task.Final, task.TaskId); // db.SaveChanges(); // } //} //private void DeleteTask(MTasks task) //{ // using (var db = new Index.BloggingContext()) // { // var item = // (from m in db.MTasks // where m.TaskId == task.TaskId // select m).First(); // db.MTasks.Remove(item); // db.SaveChanges(); // } //} //private void FinishTask(MTasks task) //{ // using (var db = new Index.BloggingContext()) // { // var item = // (from m in db.MTasks // where m.TaskId == task.TaskId // select m).First(); // db.Database.ExecuteSqlCommand("UPDATE MTasks" + // " SET Final={0}" + // " WHERE TaskId={1}", true, task.TaskId); // db.SaveChanges(); // } //} #endregion #region Old private void SetDataSources() { TaskRepo gat = new TaskRepo(); tasksBindingSource1.DataSource = gat.GetAll(); dataGridView1.DataSource = tasksBindingSource1; UserRepo frm = new UserRepo(); DataGridViewComboBoxColumn columnCreatedyBy = (DataGridViewComboBoxColumn)dataGridView1.Columns[4]; columnCreatedyBy.DataSource = frm.GetAll(); DataGridViewComboBoxColumn columnExecutive = (DataGridViewComboBoxColumn)dataGridView1.Columns[5]; columnExecutive.DataSource = frm.GetAll(); }
protected override void Delete() { Console.Clear(); All(); Console.WriteLine("*** CHOOSE BY ID WHO TO DELETE ***"); Console.Write(" ID: "); int id = int.Parse(Console.ReadLine()); TaskRepo repo = new TaskRepo("tasks.txt"); repo.Delete(repo.GetById(id)); Console.Clear(); Console.WriteLine("*******************************"); Console.WriteLine("********* COMPLETED!!! ********"); Console.WriteLine("*******************************"); Thread.Sleep(1500); }
private void tsMainDelete_Click(object sender, EventArgs e) { Int32 selectedRowCount = dataGridView1.Rows.GetRowCount(DataGridViewElementStates.Selected); if (selectedRowCount > 0) { DialogResult result = MessageBox.Show("Are you sure you want to delete this item", "Delete item", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (result == DialogResult.Yes) { TaskRepo edd = new TaskRepo(); MTasks user = (MTasks)tasksBindingSource1.Current; edd.Delete(user); SetDataSources(); } } }
private void tsMainEdit_Click(object sender, EventArgs e) { Int32 selectedRowCount = dataGridView1.Rows.GetRowCount(DataGridViewElementStates.Selected); if (selectedRowCount > 0) { MTasks task = (MTasks)tasksBindingSource1.Current; EditTask editTask = new EditTask(task); if (editTask.ShowDialog() == DialogResult.OK) { TaskRepo edd = new TaskRepo(); edd.Save(task); SetDataSources(); } } }
internal void View() { TaskManagerView taskView = new TaskManagerView(); taskView.All(); Console.WriteLine("*** CHOOSE BY ID TASK ADDITIONAL INFO ***"); Console.Write(" ID: "); int id = int.Parse(Console.ReadLine()); Console.Clear(); TaskRepo repo = new TaskRepo("tasks.txt"); PrintRepo(repo.GetById(id)); Console.WriteLine(); RenderMenu(repo.GetById(id)); Console.Clear(); }
public HttpResponseMessage GetTaskList(int project_id = 0)//p_id project_id { HttpResponseMessage response = null; try { List <TaskModel> tasklist = TaskRepo.GetTaskList(project_id); response = Request.CreateResponse(HttpStatusCode.OK, new EMSResponseMessage("EMS_001", "Success", tasklist)); } catch (Exception exception) { Debug.WriteLine(exception.Message); Debug.WriteLine(exception.GetBaseException()); response = Request.CreateResponse(HttpStatusCode.OK, new EMSResponseMessage("EMS_101", "Application Error", exception.Message)); } return(response); }
protected override void Edit() { Console.Clear(); All(); Console.WriteLine("*** CHOOSE BY ID WHO TO EDIT ***"); Console.Write(" ID: "); int id = int.Parse(Console.ReadLine()); TaskRepo repo = new TaskRepo("tasks.txt"); Task task = new Task(); Task u = new Task(); task = repo.GetById(id); u.Id = task.Id; u.ParentId = task.ParentId; Console.Write("******** OLD TITLE : "); Console.WriteLine(task.Title); Console.Write("******** NEW TITLE : "); u.Title = Console.ReadLine(); Console.Write("******** OLD DESCRIPTION : "); Console.WriteLine(task.Description); Console.Write("******** OLD DESCRIPTION : "); u.Description = Console.ReadLine(); Console.Write("******** OLD RESPONSIBLE USER ID : "); Console.WriteLine(task.ResponsibleUser); Console.Write("******** OLD RESPONSIBLE USER ID : "); u.ResponsibleUser = Convert.ToInt32(Console.ReadLine()); Console.Write("******** OLD CREATOR : "); Console.WriteLine(task.Creator); Console.Write("******** NEW CREATOR : "); u.Creator = Console.ReadLine(); Console.Write("******** OLD STATUS : "); Console.WriteLine(task.Status); Console.Write("******** NEW STATUS : "); u.Status = Convert.ToString(WhichStatus()); var time = DateTime.Now; u.LastChange = time; u.CreateTime = task.CreateTime; repo.Save(u); Console.Clear(); Console.WriteLine("*******************************"); Console.WriteLine("********* COMPLETED!!! ********"); Console.WriteLine("*******************************"); Thread.Sleep(1500); }
public ActionResult CreateComment(int id) { TaskRepo repo = new TaskRepo(); Task task = repo.GetById(id); CreateCommentVM create = new CreateCommentVM(); create.TaskId = task.Id; if (task.assignetId == AuthenticationManager.LoggedUser.Id || task.creatorId == AuthenticationManager.LoggedUser.Id) { return(View(create)); } else { return(RedirectToAction("Index", "TaskManagement")); } }
public JsonResult Edit(Tasks task) { TaskRepo taskRepo = new TaskRepo(context); Tasks data = taskRepo.Get(task.Id); Tasks tasks = new Tasks() { Id = data.Id, ActvityId = data.ActvityId, Name = data.Name, AssignTo = data.AssignTo, Status = data.Status, Priority = data.Priority }; return(Json(data, JsonRequestBehavior.AllowGet)); }
private void Add() { Console.Clear(); MTasks user = new MTasks(); bool Status = false; try { Console.WriteLine("Add new task"); Console.Write("+Title: "); user.Title = Console.ReadLine(); Console.Write("+Whats the task: "); user.Description = Console.ReadLine(); user.Creator = Login.LoggedUser.UserId; Console.Write("+Finish time: "); user.EstTime = int.Parse(Console.ReadLine()); Console.Write("+Assigne to: "); user.Assigned = int.Parse(Console.ReadLine()); DateTime saveNow = DateTime.Now; user.CreTime = saveNow; Console.WriteLine(); Status = true; } catch (Exception ex) { Console.Clear(); Console.WriteLine(ex.Message); Console.ReadKey(true); Status = false; } Users item = new Users(); UserRepo userRepo = new UserRepo(filepath); item = userRepo.GetById(user.Assigned); if (Status == true && item.UserId > 0) { TaskRepo taskRepository = new TaskRepo(tasksFilepath); taskRepository.Save(user); Console.WriteLine("Task added successfully"); Console.ReadKey(true); } }
public ActionResult SetHours(int id) { TaskRepo repo = new TaskRepo(); Task task = repo.GetById(id); SetHoursVM set = new SetHoursVM(); set.SetHours = 0; set.Id = task.Id; if (task.assignetId == AuthenticationManager.LoggedUser.Id || task.creatorId == AuthenticationManager.LoggedUser.Id) { return(View(set)); } else { return(RedirectToAction("Index", "TaskManagement")); } }
public ActionResult DeleteComment(int id) { if (AuthenticationManager.LoggedUser == null) { return(RedirectToAction("Login", "Home")); } CommentRepo repoComment = new CommentRepo(); Comment comment = repoComment.GetById(id); TaskRepo repo = new TaskRepo(); Task task = repo.GetById(comment.taskId); if (comment.commentCreatorId == AuthenticationManager.LoggedUser.Id || task.creatorId == AuthenticationManager.LoggedUser.Id) { UserRepo repoUser = new UserRepo(); List <User> users = repoUser.GetAll().ToList(); DeleteCommentVM delete = new DeleteCommentVM(); delete.users = new List <User>(); delete.Id = comment.Id; delete.Tittle = comment.commentTittle; delete.Content = comment.commentContent; delete.CreatorId = comment.commentCreatorId; delete.TaskId = comment.taskId; delete.Date = comment.Date; foreach (var item in users) { delete.users.Add(item); } return(View(delete)); } else { return(RedirectToAction("Details", "TaskManagement", new { id = comment.taskId })); } }
public HttpResponseMessage AssignProjectTask(List <Task> task) { HttpResponseMessage response = null; try { if (task != null) { foreach (Task items in task) { Project proj_details = ProjectRepo.GetProjectById(items.project_id); if (proj_details != null) { TaskRepo.AssignProjectTask(items); response = Request.CreateResponse(HttpStatusCode.OK, new EMSResponseMessage("EMS_001", "Tasks assigned successfully", "Tasks assigned successfully")); } else { response = Request.CreateResponse(HttpStatusCode.OK, new EMSResponseMessage("EMS_204", "Project ID doesnot Exists", "Project ID doesnot Exists")); } } } else { response = Request.CreateResponse(HttpStatusCode.OK, new EMSResponseMessage("EMS_102", "Invalid Input", "Please check input Json")); } } catch (DbEntityValidationException DBexception) { Debug.WriteLine(DBexception.Message); Debug.WriteLine(DBexception.GetBaseException()); response = Request.CreateResponse(HttpStatusCode.OK, new EMSResponseMessage("EMS_190", "Mandatory fields missing", DBexception.Message)); } catch (Exception exception) { Debug.WriteLine(exception.Message); Debug.WriteLine(exception.GetBaseException()); response = Request.CreateResponse(HttpStatusCode.OK, new EMSResponseMessage("EMS_101", "Application Error", exception.Message)); } return(response); }
private void ListAll() { Console.Clear(); TaskRepo taskRepo = new TaskRepo(tasksFilepath); List <MTasks> tasks = taskRepo.GetAll(); foreach (MTasks task in tasks) { Console.WriteLine(); Console.WriteLine("Task id: " + task.TaskId); Console.WriteLine("Title: " + task.Title); Console.WriteLine("Description: " + task.Description); Console.WriteLine("Creators id: " + task.Creator); Console.WriteLine("Time for the task: " + task.EstTime); Console.WriteLine("Task executive id: " + task.Assigned); Console.WriteLine("Creation time: " + task.CreTime); Console.WriteLine("------------------------------------------------------"); } Console.ReadKey(true); }
// GET: Tasks public ActionResult Index(int?ActivityId, string Name) { if (ActivityId.Equals(null)) { return(Redirect("/Activity/Index")); } TaskRepo taskRepo = new TaskRepo(context); TempData["Activity"] = Name; TempData["ActivityId"] = ActivityId.ToString(); ViewBag.Users = context.Users.Select(r => new SelectListItem { Value = r.Id, Text = r.UserName }).ToList(); TasksViewModel taskviewmodel = new TasksViewModel() { tasks = taskRepo.GetTaskForActvity(ActivityId) }; return(View(taskviewmodel)); }
protected override void DeleteFilter(int id) { TaskRepo taskRepository = RepositoryFactory.GetTasksRepository(); List <Task> tasks = taskRepository.GetAll().FindAll(task => task.UserId == id && task.ResponsibleUser == id); foreach (var task in tasks) { taskRepository.Delete(task); } List <Task> tasksRespU = taskRepository.GetAll(); foreach (var task in tasksRespU) { if (task.ResponsibleUser == AuthenticationManager.LoggedUser.Id) { task.UserId = AuthenticationManager.LoggedUser.Id; taskRepository.Save(task); } } CommentRepo comRepository = RepositoryFactory.GetCommentsRepository(); List <Comment> comments = comRepository.GetAll().FindAll(com => com.CreatedBy == id); foreach (var com in comments) { comRepository.Delete(com); } LoggedWorkRepo loggedWorkRepo = RepositoryFactory.GetLoggedWorksRepository(); List <LoggedWork> loggedWorks = loggedWorkRepo.GetAll().FindAll(lw => lw.UserId == id); foreach (var lw in loggedWorks) { loggedWorkRepo.Delete(lw); } }
private void loginButton_Click(object sender, EventArgs e) { string username = usernameField.Text; string password = passwordField.Text; if (employeeService == null) { TaskRepo taskRepo = new TaskRepo(); AttendanceRepo attendanceRepo = new AttendanceRepo(); //RepoCompany repoCompany = new RepoCompany(); employeeService = new EmployeeService(taskRepo, attendanceRepo, RepoCompany.Instance); } try { User user = companyService.ValidateCredentials(username, password); if (user.Position.Equals("employee")) { Employee employee = companyService.GetEmployeeByUser(username, password); EmployeeView employeeView = new EmployeeView(employeeService, user); companyService.addObserver(employeeView); employeeView.Show(); } if (user.Position.Equals("manager")) { managerView = new ManagerView(companyService); manager = new Manager(); employeeService.addObserver(managerView); managerView.Show(); } } catch (ServiceException ex) { MessageBox.Show(ex.Message); } }
private void ChangeStatus(Entities.Task task) { Console.Clear(); TaskRepo repo = new TaskRepo("tasks.txt"); Entities.Task u = new Entities.Task(); u.Id = task.Id; u.ParentId = task.ParentId; u.Title = task.Title; u.Description = task.Description; u.ResponsibleUser = task.ResponsibleUser; u.Creator = task.Creator; Console.WriteLine("********************************"); Console.Write("******** OLD STATUS : "); Console.WriteLine(task.Status); Console.Write("******** NEW STATUS : "); u.Status = Convert.ToString(WhichStatus()); Console.WriteLine("********************************"); var time = DateTime.Now; u.LastChange = time; u.CreateTime = task.CreateTime; repo.Save(u); CommentView comentView = new CommentView(); comentView.AddComment(task); Console.Clear(); Console.WriteLine("*******************************"); Console.WriteLine("********* COMPLETED!!! ********"); Console.WriteLine("*******************************"); Thread.Sleep(1500); Console.Clear(); PrintRepo(u); Console.WriteLine(); Console.WriteLine(); RenderMenu(u); }