コード例 #1
0
ファイル: QTMController.cs プロジェクト: Srinu9088/TSREDDY
        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));
        }
コード例 #2
0
ファイル: QTMController.cs プロジェクト: Srinu9088/TSREDDY
        public JsonResult UpdateINU(EmployeeTaskModel employees)
        {
            using (TSREntities entities = new TSREntities())
            {
                TasksImpNurg updatedEmployee = (from c in entities.TasksImpNurgs
                                                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));
        }
コード例 #3
0
ファイル: QTMController.cs プロジェクト: Srinu9088/TSREDDY
        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));
        }