/// <summary>
        /// This action retrieves the schedule edit page
        /// </summary>
        /// <param name="id">Schedule id</param>
        /// <returns>Edit view</returns>
        // GET: ProjectSchedule/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }

            ProjectSchedule projectSchedule = db.ProjectSchedules.Find(id);

            if (projectSchedule == null)
            {
                return(HttpNotFound());
            }

            var model = new ProjectScheduleViewModel
            {
                ScheduleId     = projectSchedule.ScheduleId,
                ScheduleDate   = projectSchedule.Date,
                StartTime      = projectSchedule.StartTime,
                EndTime        = projectSchedule.EndTime,
                EventProjectId = projectSchedule.EventProjectId
            };

            return(View(model));
        }
Ejemplo n.º 2
0
        public JsonModel SaveProjectScheduler(ProjectScheduleViewModel model)
        {
            Models.Clients clientData = new Models.Clients();
            clientData.ClientName   = model.ClientName;
            clientData.City         = model.City;
            clientData.State        = model.State;
            clientData.ZipCode      = model.ZipCode;
            clientData.AddressLine1 = model.Address1;
            clientData.AddressLine2 = model.Address2;
            context.Clients.Add(clientData);
            context.SaveChanges();

            Models.ProjectNumbers obj = new Models.ProjectNumbers();
            obj.ProjectManagerId   = model.ProjectManagerId;
            obj.ProjectDeveloperId = model.ProjectDeveloperId;
            obj.NickName           = model.NickName;
            obj.LocationId         = model.LocationId;
            obj.AddressLine1       = model.Address1;
            obj.AddressLine2       = model.Address2;
            obj.ClientId           = clientData.ClientId;
            obj.DateCreated        = DateTime.Now;
            obj.DateModified       = DateTime.Now;
            string TotalPNnumber = (context.ProjectNumbers.ToList().Count + 1).ToString();

            obj.ProjectNumber = "PN0000" + TotalPNnumber;
            context.ProjectNumbers.Add(obj);
            context.SaveChanges();
            foreach (var x in model.AddressDescriptors)
            {
                x.ProjectNumberId     = obj.ProjectNumberId;
                x.AddressDescriptorId = 0;
                x.AddressDescriptorId = 0;
            }
            context.AddressDescriptors.AddRange(model.AddressDescriptors);
            context.SaveChanges();

            Models.Projects objData = new Projects();

            objData.Status       = model.Status;
            objData.ProjectType  = model.ProjectType;
            objData.DateModified = DateTime.Now;
            objData.DateCreated  = DateTime.Now;
            //objData.EmployeeId = model.ResourceId;
            objData.ProjectNumberId = obj.ProjectNumberId;
            context.Projects.Add(objData);

            Models.ProjectRevisions objrevison = new Models.ProjectRevisions();
            objrevison.ProjectManagerId   = obj.ProjectManagerId;
            objrevison.ProjectDeveloperId = model.ProjectDeveloperId;
            objrevison.ProjectId          = objData.ProjectId;
            objrevison.Hours             = model.ProjectHours;
            objrevison.EmployeeId        = model.ResourceId;
            objrevison.ProjectRevisionId = 1;
            context.ProjectRevisions.Add(objrevison);

            return(new JsonModel(null, "Save Successfully", (int)HttpStatusCode.OK, ""));
        }
        public ActionResult DeleteConfirmed(int id, ProjectScheduleViewModel model)
        {
            //var projectSchedule = db.ProjectSchedules.Find(model.ScheduleId);

            ProjectSchedule projectSchedule = db.ProjectSchedules.Find(id);

            db.ProjectSchedules.Remove(projectSchedule);
            db.SaveChanges();
            return(RedirectToAction("DetailsMaster", "EventProject", new { id = model.EventProjectId }));
            //return RedirectToAction("DetailsMaster", "EventProject", new { projectId = model.EventProjectId });
        }
        public ActionResult Edit(ProjectScheduleViewModel model)
        {
            if (ModelState.IsValid)
            {
                ProjectSchedule projectSchedule = Mapper.Map <ProjectScheduleViewModel, ProjectSchedule>(model);
                db.Entry(projectSchedule).State = EntityState.Modified;
                db.SaveChanges();

                return(RedirectToAction("Index"));
            }

            return(View(model));
        }
        public ActionResult ProjectSchedulesPartial(ProjectScheduleViewModel model)
        {
            if (ModelState.IsValid)
            {
                var project = db.EventProjects.Find(model.EventProjectId);

                if (project == null)
                {
                    return(HttpNotFound());
                }

                var schedule = new ProjectSchedule
                {
                    Date           = model.ScheduleDate,
                    StartTime      = model.StartTime,
                    EndTime        = model.EndTime,
                    EventProjectId = model.EventProjectId
                };

                //// Validating the date of birth
                //if (model.EndTime < model.StartTime)
                //{
                //    ModelState.AddModelError("EndTime", "The ending time of an event cannot be before the starting time.");
                //    ModelState.AddModelError(String.Empty, "Issue with the ending time");

                //    return View(model);
                //}
                //else if (model.StartTime < DateTime.Now.TimeOfDay)
                //{
                //    ModelState.AddModelError("StartTime", "The starting time of an event cannot be before this time.");
                //    ModelState.AddModelError(String.Empty, "Issue with the starting time");

                //    return View(model);
                //}

                db.ProjectSchedules.Add(schedule);
                db.SaveChanges();
            }

            return(PartialView(model));
        }
Ejemplo n.º 6
0
 public JsonModel Put([FromBody] ProjectScheduleViewModel value)
 {
     return(projectReviewServices.UpdateProjectReviewScheduler(value));
 }
Ejemplo n.º 7
0
        public JsonModel UpdateOutOfDetail([FromBody] ProjectScheduleViewModel value)
        {
            var list = projectReviewServices.UpdateProjectSchedularOffDay(value);

            return(list);
        }
Ejemplo n.º 8
0
 public JsonModel SaveRevisionWithProjectNumber([FromBody] ProjectScheduleViewModel value)
 {
     return(projectReviewServices.SaveProjectSchedulerWithProjectNumber(value));
 }
Ejemplo n.º 9
0
 public JsonModel Post([FromBody] ProjectScheduleViewModel value)
 {
     return(services.SaveProjectScheduler(value));
 }