Exemple #1
0
        public ActionResult Create(SLAViewModel ViewSLA)
        {
            CS_SLA sla = new CS_SLA();

            int count = 0;
            // All priority from priority table
            var priority = _objPriority.GetAll();

            foreach (var item in priority)
            {
                sla.CreatedOn           = DateTime.Now;
                sla.LastModified        = DateTime.Now;
                sla.MaximumResponseTime = 0;
                sla.MaximumResolveTime  = 0;
                sla.PriorityName        = item.Name;
                sla.ProjectId           = ViewSLA.ProjId;
                sla.PriorityLevel       = item.PriorityLevel;
                sla.Description         = item.Description;
                sla.EscalationTime      = 0;
                sla.IsActive            = true;
                if (count == 0)
                {
                    sla.IsDefault = true;
                    count++;
                }
                else
                {
                    sla.IsDefault = false;
                }
                _objSla.Insert(sla);
            }
            return(RedirectToAction(ActionName.FMSSLAEdit, ControllerName.FMSSLA, new { id = ViewSLA.ProjId }));
        }
Exemple #2
0
        /// <summary>
        /// Update sla data
        /// </summary>
        /// <param name="id">SLA Id</param>
        /// <returns>Redirect to EDIT SLA page</returns>
        public ActionResult Edit(int id)
        {
            if (Session["user"] == null)
            {
                return(RedirectToAction(ActionName.AuthenticationLogin, ControllerName.Authentication));
            }
            SLAViewModel slaViewModel = new SLAViewModel();

            slaViewModel.ProjId = id;
            //Find project name from ProjectId
            slaViewModel.ProjName = _dbContext.Projects.Where(project => project.Id == slaViewModel.ProjId).Select(projectName => projectName.ProjectName).SingleOrDefault();
            //Find customer id from project table
            slaViewModel.CustId = _dbContext.Projects.Where(project => project.Id == slaViewModel.ProjId).Select(customerId => customerId.CustomerId).SingleOrDefault();
            //Find customer Name from customer table
            slaViewModel.CustName = _dbContext.Customer.Where(customer => customer.Id == slaViewModel.CustId).Select(customerName => customerName.Name).SingleOrDefault();

            return(View(slaViewModel));
        }