Exemplo n.º 1
0
        // GET: Admin
        public ActionResult Statistics()
        {
            Boolean isAdmin = CheckIfAdmin();

            if (!isAdmin)
            {
                return(RedirectToAction("Index", "Home"));
            }

            List <ToolType>        ToolTypes        = db.ToolTypes.OrderBy(x => x.ToolCode).ToList();
            List <ComplexityLevel> ComplexityLevels = db.ComplexityLevels.OrderBy(x => x.ComplexityLevelNum).ToList();
            List <Statistic>       Statistics       = db.Statistics.Where(d => d.isCurrent == true).ToList();
            List <AppUser>         users            = db.AppUsers.ToList();
            AdjustmentFactor       AdjustFactor     = db.AdjustmentFactors.FirstOrDefault();

            AdminViewModel viewModel = new AdminViewModel();

            viewModel.ComplexityLevels = ComplexityLevels;
            viewModel.ToolTypes        = ToolTypes;
            viewModel.Statistics       = Statistics;
            viewModel.AdjustFactor     = AdjustFactor;
            viewModel.AppUsers         = users;


            //var tools = db.ToolTypes.OrderBy(x => x.ToolCode).ToArray();
            //var complexities = db.ComplexityLevels.OrderBy(x => x.ComplexityLevelNum).ToArray();
            //var statistics = db.Statistics.Where( d => d.isCurrent == true).ToArray();

            //return View(Tuple.Create(tools, complexities, statistics));
            return(View(viewModel));
        }
Exemplo n.º 2
0
        /// <summary>
        ///     Gets the hash code
        /// </summary>
        /// <returns>Hash code</returns>
        public override int GetHashCode()
        {
            // credit: http://stackoverflow.com/a/263416/677735
            unchecked // Overflow is fine, just wrap
            {
                var hash = 41;
                // Suitable nullity checks etc, of course :)

                if (SortPriority != null)
                {
                    hash = hash * 59 + SortPriority.GetHashCode();
                }

                if (RemovalDate != null)
                {
                    hash = hash * 59 + RemovalDate.GetHashCode();
                }

                if (Id != null)
                {
                    hash = hash * 59 + Id.GetHashCode();
                }

                if (Hc != null)
                {
                    hash = hash * 59 + Hc.GetHashCode();
                }

                if (AdjustmentFactor != null)
                {
                    hash = hash * 59 + AdjustmentFactor.GetHashCode();
                }

                if (Bsp != null)
                {
                    hash = hash * 59 + Bsp.GetHashCode();
                }

                if (Status != null)
                {
                    hash = hash * 59 + Status.GetHashCode();
                }

                return(hash);
            }
        }
Exemplo n.º 3
0
        public ActionResult SaveAdjustments([Bind(Include = "NSAR,NSRR,StressAnalysis,SurfacingRequired,EngineeringReleased,FirstToolInFamily,SecondToolInFamily,KBEDevelopment,KBEFollowOnTooling")] AdjustmentFactor AdjustFactor)
        {
            AdjustmentFactor adj = db.AdjustmentFactors.FirstOrDefault();

            // TODO: MIGHT WANT TO ADD EDITEDBYUSERID
            adj.EngineeringReleased = AdjustFactor.EngineeringReleased;
            adj.FirstToolInFamily   = AdjustFactor.FirstToolInFamily;
            adj.KBEDevelopment      = AdjustFactor.KBEDevelopment;
            adj.KBEFollowOnTooling  = AdjustFactor.KBEFollowOnTooling;
            adj.NSAR = AdjustFactor.NSAR;
            adj.NSRR = AdjustFactor.NSRR;
            adj.SecondToolInFamily = AdjustFactor.SecondToolInFamily;
            adj.StressAnalysis     = AdjustFactor.StressAnalysis;
            adj.SurfacingRequired  = AdjustFactor.SurfacingRequired;
            adj.UpdatedDate        = DateTime.Now;

            db.Entry(adj).State = EntityState.Modified;
            db.SaveChanges();

            return(Redirect(Url.Action("Statistics", "Admin")));
        }
Exemplo n.º 4
0
        /// <summary>
        ///     Returns true if RunnerDefinition instances are equal
        /// </summary>
        /// <param name="other">Instance of RunnerDefinition to be compared</param>
        /// <returns>Boolean</returns>
        public bool Equals(RunnerDefinition other)
        {
            // credit: http://stackoverflow.com/a/10454552/677735
            if (other == null)
            {
                return(false);
            }

            return((SortPriority == other.SortPriority || SortPriority != null && SortPriority.Equals(other.SortPriority)) &&
                   (RemovalDate == other.RemovalDate || RemovalDate != null && RemovalDate.Equals(other.RemovalDate)) &&
                   (Id == other.Id || Id != null && Id.Equals(other.Id)) &&
                   (Hc == other.Hc || Hc != null && Hc.Equals(other.Hc)) &&
                   (AdjustmentFactor == other.AdjustmentFactor || AdjustmentFactor != null && AdjustmentFactor.Equals(other.AdjustmentFactor)) &&
                   (Bsp == other.Bsp || Bsp != null && Bsp.Equals(other.Bsp)) &&
                   (Status == other.Status || Status != null && Status.Equals(other.Status)));
        }