示例#1
0
        public ActionResult Edit(TaskAssignment TaskAssignment)
        {
            TaskAssignment oTaskAssignment = new TaskAssignment();

            oTaskAssignment.TaskAssignmentID = System.Convert.ToInt32(TaskAssignment.TaskAssignmentID);
            oTaskAssignment = TaskAssignmentData.Select_Record(TaskAssignment);

            if (ModelState.IsValid)
            {
                bool bSucess = false;
                bSucess = TaskAssignmentData.Update(oTaskAssignment, TaskAssignment);
                if (bSucess == true)
                {
                    return(RedirectToAction("Index"));
                }
                else
                {
                    ModelState.AddModelError("", "Can Not Update");
                }
            }
            // ComboBox
            ViewData["TaskID"]      = new SelectList(TaskAssignment_TaskData.List(), "TaskID", "TaskName", TaskAssignment.TaskID);
            ViewData["EmployeeID"]  = new SelectList(TaskAssignment_EmployeeData.List(), "EmployeeID", "FirstName", TaskAssignment.EmployeeID);
            ViewData["TaskStateID"] = new SelectList(TaskAssignment_TaskStateData.List(), "TaskStateID", "TaskStateName", TaskAssignment.TaskStateID);

            return(View(TaskAssignment));
        }
示例#2
0
        public ActionResult Create([Bind(Include =
                                             "AssignmentDate"
                                             + "," + "TaskID"
                                             + "," + "EmployeeID"
                                             + "," + "TaskStateID"
                                         )] TaskAssignment TaskAssignment)
        {
            if (ModelState.IsValid)
            {
                bool bSucess = false;
                bSucess = TaskAssignmentData.Add(TaskAssignment);
                if (bSucess == true)
                {
                    return(RedirectToAction("Index"));
                }
                else
                {
                    ModelState.AddModelError("", "Can Not Insert");
                }
            }
            // ComboBox
            ViewData["TaskID"]      = new SelectList(TaskAssignment_TaskData.List(), "TaskID", "TaskName", TaskAssignment.TaskID);
            ViewData["EmployeeID"]  = new SelectList(TaskAssignment_EmployeeData.List(), "EmployeeID", "FirstName", TaskAssignment.EmployeeID);
            ViewData["TaskStateID"] = new SelectList(TaskAssignment_TaskStateData.List(), "TaskStateID", "TaskStateName", TaskAssignment.TaskStateID);

            return(View(TaskAssignment));
        }
示例#3
0
        // GET: /TaskAssignment/Edit/<id>
        public ActionResult Edit(
            Int32?TaskAssignmentID
            )
        {
            if (
                TaskAssignmentID == null
                )
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }

            TaskAssignment TaskAssignment = new TaskAssignment();

            TaskAssignment.TaskAssignmentID = System.Convert.ToInt32(TaskAssignmentID);
            TaskAssignment = TaskAssignmentData.Select_Record(TaskAssignment);

            if (TaskAssignment == null)
            {
                return(HttpNotFound());
            }
            // ComboBox
            ViewData["TaskID"]      = new SelectList(TaskAssignment_TaskData.List(), "TaskID", "TaskName", TaskAssignment.TaskID);
            ViewData["EmployeeID"]  = new SelectList(TaskAssignment_EmployeeData.List(), "EmployeeID", "FirstName", TaskAssignment.EmployeeID);
            ViewData["TaskStateID"] = new SelectList(TaskAssignment_TaskStateData.List(), "TaskStateID", "TaskStateName", TaskAssignment.TaskStateID);

            return(View(TaskAssignment));
        }
示例#4
0
        // GET: /TaskAssignment/Create
        public ActionResult Create()
        {
            // ComboBox
            ViewData["TaskID"]      = new SelectList(TaskAssignment_TaskData.List(), "TaskID", "TaskName");
            ViewData["EmployeeID"]  = new SelectList(TaskAssignment_EmployeeData.List(), "EmployeeID", "FirstName");
            ViewData["TaskStateID"] = new SelectList(TaskAssignment_TaskStateData.List(), "TaskStateID", "TaskStateName");

            return(View());
        }