public ActionResult Register(Employee obj) { if (ModelState != null) { TSREntities data = new TSREntities(); data.Employees.Add(obj); data.SaveChanges(); } ViewBag.Message = obj.FirstName + " " + obj.LastName + " " + "Successfully Registerd"; ModelState.Clear(); return(View()); }
public ActionResult Register(RegMvc obj) { if (ModelState.IsValid) { TSREntities db = new TSREntities(); db.RegMvcs.Add(obj); db.SaveChanges(); } ViewBag.Message = obj.FirstName + " " + obj.LastName + " " + "Successfully registerd"; ModelState.Clear(); return(View()); }
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)); }
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)); }
public JsonResult UpdateNINU(EmployeeTaskModel employees) { using (TSREntities entities = new TSREntities()) { TasksNimpNurg updatedEmployee = (from c in entities.TasksNimpNurgs 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)); }
public JsonResult saveList(string ItemList, string TableName) { TSREntities db = new TSREntities(); var main = ItemList.Split(','); foreach (var itm in main) { RegMvc ob = db.RegMvcs.Single(x => x.Id.ToString() == itm); RegMvc1 ob1 = new RegMvc1(); ob1.Id = ob.Id; ob1.FirstName = ob.FirstName; ob1.LastName = ob.LastName; ob1.Email = ob.Email; ob1.Password = ob.Password; ob1.ConfirmPassword = ob.ConfirmPassword; db.RegMvc1.Add(ob1); db.SaveChanges(); } return(Json("yes", JsonRequestBehavior.AllowGet)); }
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)); }