Esempio n. 1
0
        public async Task <IActionResult> Edit(int id, [Bind("EmployeeTaskListId,EmployeeId,TaskListId,ProjectId")] EmployeeTaskList employeeTaskList)
        {
            if (id != employeeTaskList.EmployeeTaskListId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(employeeTaskList);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!EmployeeTaskListExists(employeeTaskList.EmployeeTaskListId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["EmployeeId"] = new SelectList(_context.Employees, "EmployeeId", "FristName", employeeTaskList.EmployeeId);
            ViewData["ProjectId"]  = new SelectList(_context.Projects, "ProjectId", "Name", employeeTaskList.ProjectId);
            ViewData["TaskListId"] = new SelectList(_context.TaskLists, "TaskListId", "TaskName", employeeTaskList.TaskListId);
            return(View(employeeTaskList));
        }
Esempio n. 2
0
    static XtraReport CreateEmployeeTaskListReport(long employeeID)
    {
        var report   = new EmployeeTaskList();
        var employee = DataProvider.Employees.FirstOrDefault(e => e.Id == employeeID);

        if (employee != null)
        {
            report.DataSource = employee.AssignedTasks;
        }
        return(report);
    }
Esempio n. 3
0
        public async Task <IActionResult> Create([Bind("EmployeeTaskListId,EmployeeId,TaskListId,ProjectId")] EmployeeTaskList employeeTaskList)
        {
            if (ModelState.IsValid)
            {
                _context.Add(employeeTaskList);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["EmployeeId"] = new SelectList(_context.Employees, "EmployeeId", "Fullname", employeeTaskList.EmployeeId);
            ViewData["ProjectId"]  = new SelectList(_context.Projects, "ProjectId", "Name", employeeTaskList.ProjectId);
            ViewData["TaskListId"] = new SelectList(_context.TaskLists, "TaskListId", "TaskName", employeeTaskList.TaskListId);
            return(View(employeeTaskList));
        }
Esempio n. 4
0
        public JsonResult DeleteEmployee(int taskId)
        {
            TSREntities entities = new TSREntities();

            TasksImpUrg IU = (from c in entities.TasksImpUrgs
                              where c.TaskId == taskId
                              select c).FirstOrDefault();

            TasksImpNurg INU = (from c in entities.TasksImpNurgs
                                where c.TaskId == taskId
                                select c).FirstOrDefault();

            TasksNimpUrg NIU = (from c in entities.TasksNimpUrgs
                                where c.TaskId == taskId
                                select c).FirstOrDefault();

            TasksNimpNurg NINU = (from c in entities.TasksNimpNurgs
                                  where c.TaskId == taskId
                                  select c).FirstOrDefault();

            EmployeeTaskList deletedtedEmployee = (from c in entities.EmployeeTaskLists
                                                   where c.TaskId == taskId
                                                   select c).FirstOrDefault();

            entities.EmployeeTaskLists.Remove(deletedtedEmployee);

            if (IU != null)
            {
                entities.TasksImpUrgs.Remove(IU);
            }
            if (INU != null)
            {
                entities.TasksImpNurgs.Remove(INU);
            }

            if (NIU != null)
            {
                entities.TasksNimpUrgs.Remove(NIU);
            }
            if (NINU != null)
            {
                entities.TasksNimpNurgs.Remove(NINU);
            }
            entities.SaveChanges();


            return(Json("yes", JsonRequestBehavior.AllowGet));
        }
Esempio n. 5
0
        public JsonResult List(EmployeeTaskModel model)
        {
            TSREntities      db  = new TSREntities();
            EmployeeTaskList obj = new EmployeeTaskList();

            //DateTime dt = DateTime.Parse(TaskDate, CultureInfo.InvariantCulture);
            obj.EmpId        = Session["Empid"].ToString();
            obj.TaskDate     = model.TaskDate;
            obj.Task         = model.Task;
            obj.Type_Of_Task = model.Type_Of_Task;

            db.EmployeeTaskLists.Add(obj);
            db.SaveChanges();


            return(Json("yes", JsonRequestBehavior.AllowGet));
        }
Esempio n. 6
0
        public JsonResult UpdateEmployee(EmployeeTaskModel employees)
        {
            using (TSREntities entities = new TSREntities())
            {
                EmployeeTaskList updatedEmployee = (from c in entities.EmployeeTaskLists
                                                    where c.TaskId == employees.TaskId
                                                    select c).FirstOrDefault();
                updatedEmployee.Task         = employees.Task;
                updatedEmployee.Type_Of_Task = employees.Type_Of_Task;
                //updatedEmployee.Start_Time = employees.Start_Time;
                //updatedEmployee.End_Time = employees.End_Time;
                updatedEmployee.Status = employees.Status;

                entities.SaveChanges();
            }

            return(Json("yes", JsonRequestBehavior.AllowGet));
        }
Esempio n. 7
0
        public JsonResult saveList(string ItemList, string TableName)
        {
            TSREntities db   = new TSREntities();
            var         main = ItemList.Split(','); // Split the taskids

            switch (TableName)
            {
            case "IU":
                foreach (var itm in main)
                {
                    EmployeeTaskList ob  = db.EmployeeTaskLists.Single(x => x.TaskId.ToString() == itm);
                    TasksImpUrg      ob1 = new TasksImpUrg();
                    if (ob.Flag == 1)
                    {
                        return(Json("no", JsonRequestBehavior.AllowGet));
                    }
                    else
                    {
                        ob1.EmpId        = ob.EmpId;
                        ob1.TaskId       = ob.TaskId;
                        ob1.TaskDate     = ob.TaskDate;
                        ob1.Task         = ob.Task;
                        ob1.Type_Of_Task = ob.Type_Of_Task;
                        //ob1.Start_Time = ob.Start_Time;
                        //ob1.End_Time = ob.End_Time;
                        ob1.Status = ob.Status;
                        db.TasksImpUrgs.Add(ob1);
                        ob.Flag = 1;
                        db.SaveChanges();
                    }
                }
                break;

            case "INU":
                foreach (var itm in main)
                {
                    EmployeeTaskList ob  = db.EmployeeTaskLists.Single(x => x.TaskId.ToString() == itm);
                    TasksImpNurg     ob1 = new TasksImpNurg();
                    if (ob.Flag == 1)
                    {
                        return(Json("no", JsonRequestBehavior.AllowGet));
                    }
                    else
                    {
                        ob1.EmpId        = ob.EmpId;
                        ob1.TaskId       = ob.TaskId;
                        ob1.TaskDate     = ob.TaskDate;
                        ob1.Task         = ob.Task;
                        ob1.Type_Of_Task = ob.Type_Of_Task;
                        //ob1.Start_Time = ob.Start_Time;
                        //ob1.End_Time = ob.End_Time;
                        ob1.Status = ob.Status;
                        db.TasksImpNurgs.Add(ob1);
                        ob.Flag = 1;
                        db.SaveChanges();
                    }
                }
                break;

            case "NIU":
                foreach (var itm in main)
                {
                    EmployeeTaskList ob  = db.EmployeeTaskLists.Single(x => x.TaskId.ToString() == itm);
                    TasksNimpUrg     ob1 = new TasksNimpUrg();
                    if (ob.Flag == 1)
                    {
                        return(Json("no", JsonRequestBehavior.AllowGet));
                    }
                    else
                    {
                        ob1.EmpId        = ob.EmpId;
                        ob1.TaskId       = ob.TaskId;
                        ob1.TaskDate     = ob.TaskDate;
                        ob1.Task         = ob.Task;
                        ob1.Type_Of_Task = ob.Type_Of_Task;
                        //ob1.Start_Time = ob.Start_Time;
                        //ob1.End_Time = ob.End_Time;
                        ob1.Status = ob.Status;
                        db.TasksNimpUrgs.Add(ob1);
                        ob.Flag = 1;
                        db.SaveChanges();
                    }
                }
                break;

            case "NINU":
                foreach (var itm in main)
                {
                    EmployeeTaskList ob  = db.EmployeeTaskLists.Single(x => x.TaskId.ToString() == itm);
                    TasksNimpNurg    ob1 = new TasksNimpNurg();
                    if (ob.Flag == 1)
                    {
                        return(Json("no", JsonRequestBehavior.AllowGet));
                    }
                    else
                    {
                        ob1.EmpId        = ob.EmpId;
                        ob1.TaskId       = ob.TaskId;
                        ob1.TaskDate     = ob.TaskDate;
                        ob1.Task         = ob.Task;
                        ob1.Type_Of_Task = ob.Type_Of_Task;
                        //ob1.Start_Time = ob.Start_Time;
                        //ob1.End_Time = ob.End_Time;
                        ob1.Status = ob.Status;
                        db.TasksNimpNurgs.Add(ob1);
                        ob.Flag = 1;
                        db.SaveChanges();
                    }
                }
                break;

            default:
                break;
            }


            return(Json("yes", JsonRequestBehavior.AllowGet));
        }