Esempio n. 1
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,Name,DecimalSize,MetricSize")] Caliber caliber)
        {
            if (id != caliber.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(caliber);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!CaliberExists(caliber.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(caliber));
        }
        private static CaliberCategory DeterminetCaliberCategory(Caliber caliber)
        {
            if (small.Contains(caliber))
            {
                return(CaliberCategory.SMALL);
            }

            if (medium.Contains(caliber))
            {
                return(CaliberCategory.MEDIUM);
            }

            if (large.Contains(caliber))
            {
                return(CaliberCategory.LARGE);
            }

            if (antimat.Contains(caliber))
            {
                return(CaliberCategory.ANTIMAT);
            }

            // if unknown
            return(CaliberCategory.SMALL);
        }
Esempio n. 3
0
        public ActionResult Cartridge([Bind(Include = "Id,Name,CartridgeLoadId,BrassId,TimesLoaded,PrimerId,ManufacturerId,Notes")] Cartridge entity)
        {
            if (ModelState.IsValid)
            {
                this.cartridgeService.Add(entity);
                var cartridgeLoad = this.cartridgeLoadService.FindById(entity.CartridgeLoadId) as CartridgeLoad;
                return(RedirectToAction("CartridgeIndex", new { id = cartridgeLoad.CaliberId }));
            }

            var     cartLoad = this.cartridgeLoadService.FindById(entity.CartridgeLoadId) as CartridgeLoad;
            Caliber caliber  = this.calibers.OfType <Caliber>().Where(c => c.Id == cartLoad.CaliberId).First();

            var calibers       = this.calibers.OfType <Caliber>().Where(c => c.Id == cartLoad.CaliberId);
            var cartridgeLoads = this.cartridgeLoads.OfType <CartridgeLoad>().Where(c => c.CaliberId == caliber.Id);
            var bullets        = this.bulletViews.Where(b => b.CaliberViewId == caliber.Id);
            var brasses        = this.brassViews.Where(b => b.CaliberId == caliber.Id);
            var primers        = this.primerViews.Where(p => p.Id == caliber.PrimerTypeId);

            ViewBag.CaliberId       = new SelectList(calibers, "Id", "Name", caliber.Id);
            ViewBag.CartridgeLoadId = new SelectList(cartridgeLoads, "Id", "Name");
            ViewBag.BulletId        = new SelectList(bullets, "BulletId", "BulletName");
            ViewBag.BrassId         = new SelectList(brasses, "BrassId", "BrassName");
            ViewBag.PrimerId        = new SelectList(primers, "PrimerId", "PrimerName");
            ViewBag.ManufacturerId  = new SelectList(this.manufacturers, "Id", "Name");

            return(View());
        }
Esempio n. 4
0
        public async Task <IActionResult> PutCaliber(int id, Caliber caliber)
        {
            if (id != caliber.Id)
            {
                return(BadRequest());
            }

            _context.Entry(caliber).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!CaliberExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
 void AddLine(string name, string type)
 {
     Caliber = new Caliber(name, type);
     DB.Calibers.Add(Caliber);
     DB.SaveChanges();
     CountAdd++;
 }
Esempio n. 6
0
        public ActionResult Cartridge(int?id)
        {
            IEnumerable <CartridgeLoadView> finalCartridgeLoads;
            IEnumerable <BrassView>         finalBrasses;
            IEnumerable <PrimerView>        finalPrimers;

            if (id != null)
            {
                Caliber caliber = this.calibers.OfType <Caliber>().Where(c => c.Id == (int)id).First();
                finalCartridgeLoads = this.cartridgeLoadViews.OfType <CartridgeLoadView>().Where(c => c.CaliberId == (int)id);
                finalBrasses        = this.brassViews.Where(b => b.CaliberId == caliber.Id);
                finalPrimers        = this.primerViews.Where(p => p.PrimerTypeId == caliber.PrimerTypeId);
                ViewBag.CaliberName = caliber.Name;
            }
            else
            {
                finalCartridgeLoads = this.cartridgeLoadViews.OfType <CartridgeLoadView>();
                finalBrasses        = this.brassViews;
                finalPrimers        = this.primerViews;
                ViewBag.CaliberId   = new SelectList(this.calibers, "Id", "Name");
            }

            ViewBag.CartridgeLoadId = new SelectList(finalCartridgeLoads, "Id", "CartridgeLoadName");
            ViewBag.BrassId         = new SelectList(finalBrasses, "Id", "BrassName");
            ViewBag.PrimerId        = new SelectList(finalPrimers, "Id", "PrimerName");
            ViewBag.ManufacturerId  = new SelectList(this.manufacturers, "Id", "Name");

            return(View());
        }
Esempio n. 7
0
        public async Task <ActionResult <Caliber> > PostCaliber(Caliber caliber)
        {
            Caliber cal = new Caliber();
            await caliber.AddCaliber(cal, _context);

            return(CreatedAtAction("GetCaliber", new { id = caliber.Id }, caliber));
        }
Esempio n. 8
0
 public override bool Attach(Caliber input)
 {
     caliber = input;
     input.transform.position = transform.position;
     input.transform.parent   = transform;
     return(false);
 }
Esempio n. 9
0
        public ActionResult Load(int?id)
        {
            IEnumerable <BulletView> bullets;
            IEnumerable <PowderView> powders;

            if (id != null)
            {
                Caliber caliber = this.calibers.OfType <Caliber>().Where(c => c.Id == (int)id).First();
                bullets = this.bulletViews.Where(b => b.CaliberViewId == (int)id);

                ViewBag.CaliberName = caliber.Name;
                ViewBag.CaliberId   = caliber.Id;
            }
            else
            {
                bullets = this.bulletViews;
                var calibers = this.calibers.OfType <Caliber>().OrderBy(c => c.SortOrder);
                powders           = this.powderViews;
                ViewBag.CaliberId = new SelectList(calibers, "Id", "Name");
            }

            ViewBag.BulletId           = new SelectList(bullets, "Id", "BulletName");
            ViewBag.PowderId           = new SelectList(this.powderViews, "Id", "Name");
            ViewBag.PowderWeightUnitId = new SelectList(this.massUnits.OfType <Unit>().Where(u => u.Abbreviation == "gr."), "Id", "Abbreviation");
            ViewBag.COLUnitId          = new SelectList(this.lengthUnits, "Id", "Abbreviation");
            ViewBag.VelocityUnitId     = new SelectList(this.velocityUnits, "Id", "Abbreviation");
            ViewBag.PressureUnitId     = new SelectList(this.pressureUnits, "Id", "Abbreviation");

            return(View());
        }
Esempio n. 10
0
        public ActionResult EditLoad([Bind(Include = "Id,Name,CaliberId,BulletId,PowderId,PowderWeight,PowderWeightUnitId,COL,COLUnitId,Velocity,VelocityUnitId,Pressure,PressureUnitId,Notes")] CartridgeLoad entity)
        {
            if (ModelState.IsValid)
            {
                var weight = Convert.ToDecimal(Request.Form["Weight"]) * 1000m;

                entity.PowderWeight = (int)weight;
                this.cartridgeLoadService.Edit(entity);
                return(RedirectToAction("LoadIndex", new { id = entity.CaliberId }));
            }

            Caliber caliber = this.cartridgeLoadService.GetCalibers().Where(c => c.Id == (int)entity.CaliberId).First();

            ViewBag.CaliberId          = caliber;
            ViewBag.BulletId           = new SelectList(this.bulletViews, "BulletId", "BulletName", entity.BulletId);
            ViewBag.PowderId           = new SelectList(this.powderViews, "Id", "Name", entity.PowderId);
            ViewBag.PowderWeight       = (decimal)entity.PowderWeight / 1000m;
            ViewBag.PowderWeightUnitId = new SelectList(this.massUnits.OfType <Unit>().Where(u => u.Abbreviation == "gr."), "Id", "Abbreviation", entity.PowderWeightUnitId);
            ViewBag.COL            = entity.COL;
            ViewBag.COLUnitId      = new SelectList(this.lengthUnits, "Id", "Abbreviation", entity.COLUnitId);
            ViewBag.Velocity       = entity.Velocity;
            ViewBag.VelocityUnitId = new SelectList(this.velocityUnits, "Id", "Abbreviation", entity.VelocityUnitId);
            ViewBag.Pressure       = entity.Pressure;
            ViewBag.PressureUnitId = new SelectList(this.pressureUnits, "Id", "Abbreviation", entity.PressureUnitId);
            ViewBag.Notes          = entity.Notes;

            return(View(entity));
        }
Esempio n. 11
0
        }                             // Необходимое количество экипажа для корректной работоспособности.

        #endregion

        #region Contructors

        /// <summary>
        /// Создание оружия по значениям его полей
        /// </summary>
        public EquipmentMark(Caliber weTyp, Caliber arTyp, double speed, double rate, int crewCount, int count)
        {
            Weapon    = weTyp;
            Armor     = arTyp;
            MoveSpeed = speed;
            FireRate  = rate;
            Crew      = crewCount;
            Count     = count;
        }
Esempio n. 12
0
 /// <summary>
 /// Создание оружия по значениям его полей
 /// </summary>
 public EquipmentMark(Caliber weTyp, Caliber arTyp, double speed, double rate, int crewCount, int count)
 {
     Weapon = weTyp;
     Armor = arTyp;
     MoveSpeed = speed;
     FireRate = rate;
     Crew = crewCount;
     Count = count;
 }
Esempio n. 13
0
    public override Caliber DetachCaliber()
    {
        Caliber ToReturn = caliber;

        caliber.transform.parent = null;
        caliber     = null;
        readyForUse = false;
        return(ToReturn);
    }
Esempio n. 14
0
    /// <summary>
    /// Default Function --> Take a specified card, add it to the default pile and remove it from target collection.
    /// </summary>
    /// <param name="_Target"> The collection of cards to target </param>
    /// <param name="_index"> The index of the card to default </param>
    public bool DefaultCardsFrom(List <Cards> _Target, int _index)
    {
        if (_Target == null)
        {
            Debug.Log("ERROR");
            return(false);
        }
        else if (_Target == Caliber)
        {
            Debug.Log("You can't default cards that are already in this pile.");
            return(false);
        }
        else if (_Target == Set)
        {
            Debug.Log("You can't default cards that are in the set pile");
            return(false);
        }
        else if (States.isCardDefaulted == true)
        {
            Debug.Log("You can't default more than 1 card per turn");
            return(false);
        }
        else if (Status.caliberCapacity + _Target[_index].defaultAmount >= 15 || Status.caliberCapacity >= 15)
        {
            //let the player choose a card to discard so as to make the currentCaliber <= 15
            //i.e highlight cards that are acceptible as candidates to make the choice easier
            Debug.Log("FUNCTIONALITY NOT IMPLIMENTED YET");
        }
        else if (_Target != Caliber)
        {
            Caliber.Add(_Target.ElementAt(_index));

            Status.caliberCapacity += _Target[_index].defaultAmount;
            Status.NumCardsInHand--;
            Status.NumCardsDefaulted++;
            Status.NumOfType[(int)_Target[_index].defType]++;
            States.isCardDefaulted = true;

            GameObject.Find("Caliber Amount").GetComponent <Text>().text = string.Format(("{0}/{1}"), Status.currentCaliber, Status.caliberCapacity);

            _Target.Remove(_Target[_index]);

            //_Target.RemoveRange(_index, 1);
            //_Target.Remove(_Target[_index]);
        }
        return(true);

        //condition for default --> if caliber >= 15, replace a card in caliber with new card
        //condition for default --> if caliberCapacity + carddefault >= 15 ||

        //this debug call doesn't work;
        //Debug.Log(Status.NumOfType[(int)_Target[_index].defType]);
        //Debug.Log(Status.caliberCapacity);
    }
Esempio n. 15
0
        public PartialViewResult Menu(Caliber caliber = null)
        {
            ViewBag.SelectedCaliber = caliber;

            IEnumerable<string> categories = repository.Calibers
                                    .Select(x => x.Name)
                                    .Distinct()
                                    .OrderBy(x => x);

            return PartialView(categories);
        }
Esempio n. 16
0
        //============================================================================*
        // ResolveIdentities()
        //============================================================================*

        public bool ResolveIdentities(cDataFiles Datafiles)
        {
            bool fChanged = false;

            foreach (cCaliber Caliber in this)
            {
                fChanged = Caliber.ResolveIdentities(Datafiles) ? true : fChanged;
            }

            return(fChanged);
        }
Esempio n. 17
0
        public async Task <IActionResult> Create([Bind("Id,Name,DecimalSize,MetricSize")] Caliber caliber)
        {
            if (ModelState.IsValid)
            {
                _context.Add(caliber);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(caliber));
        }
        //============================================================================*
        // ProcessCalibers()
        //============================================================================*

        public void ProcessCalibers()
        {
            m_nNumBadCalibers = 0;

            foreach (cCaliber Caliber in m_DataFiles.CaliberList)
            {
                if (!Caliber.Validate())
                {
                    m_nNumBadCalibers++;
                }
            }
        }
Esempio n. 19
0
        //============================================================================*
        // Export()
        //============================================================================*

        public void Export(cRWXMLDocument XMLDocument, XmlElement XMLParentElement)
        {
            if (Count > 0)
            {
                XmlElement XMLElement = XMLDocument.CreateElement(ExportName);
                XMLParentElement.AppendChild(XMLElement);

                foreach (cCaliber Caliber in this)
                {
                    Caliber.Export(XMLDocument, XMLElement);
                }
            }
        }
    /**
     * @pre: None.
     * @post: Gun's parts should be rolled, ready for stats to be calculated.
     * @param: None.
     * @return: Stub for now, should return if build occurs with no issues function returns correctly.
     */

    public override bool BuildGun()
    {
        ammo           = Instantiate(RollAmmo(), this.transform);
        barrel         = Instantiate(RollBarrel(), this.transform);
        caliber        = Instantiate(RollCaliber(), this.transform);
        cyclicModifier = Instantiate(RollCyclicModifier(), this.transform);
        cyclicModifier.Attach(this);
        magazine    = Instantiate(RollMagazine(), this.transform);
        sight       = Instantiate(RollSight(), this.transform);
        stock       = Instantiate(RollStock(), this.transform);
        underBarrel = Instantiate(RollUnderBarrel(), this.transform);
        underBarrel.Attach(this);
        return(true);
    }
Esempio n. 21
0
        public override int GetHashCode()
        {
            int hashCode =
                (IdPrototype == null ? 0 : IdPrototype.GetHashCode()) +
                (PrototypeName == null ? 0 : PrototypeName.GetHashCode()) +
                (PrototypeDescription == null ? 0 : PrototypeName.GetHashCode()) +
                PrototypeStatus.GetHashCode() +
                (IdDefaultSupplier == null ? 0 : IdDefaultSupplier.GetHashCode()) +
                (Caliber.GetHashCode()) +
                (LaunchDate == null ? 0 : LaunchDate.GetHashCode()) +
                CreateDate.GetHashCode();

            return(hashCode);
        }
Esempio n. 22
0
 public Caliber TakeCaliberFromInventory(int index)
 {
     if (index <= calibers.Count - 1)
     {
         Caliber returnItem = calibers[index];
         calibers.RemoveAt(index);
         return(returnItem);
     }
     else
     {
         Caliber returnItem = calibers[calibers.Count - 1];
         calibers.RemoveAt(calibers.Count - 1);
         return(returnItem);
     }
 }
Esempio n. 23
0
    /// <param name="_name"> The name of the ammunition </param>
    /// <param name="explosive"> If the ammunition is explosive </param>
    /// <param name="kinetic"> If the ammunition is kinetic </param>
    /// <param name="timed"> if the ammunition's explosive is timed </param>
    /// <param name="_mass"> the mass in kg </param>
    /// <param name="caliber"> the caliber </param>
    /// <param name="source"> The source gameobject </param>
    /// <param name="p_explosion_force"> The explosion caused by the ammo </param>
    /// <param name="_default_damage"> the default dammage of the bullet (without anny explosions- or kinetik-effects) </param>
    public Ammunition(string _name, bool explosive, bool kinetic, bool timed, float _mass, Caliber caliber, UnityEngine.GameObject source, float p_explosion_force, float _default_damage = 0)
    {
        IsExplosive     = explosive;
        IsKinetic       = kinetic;
        IsTimed         = timed;
        mass            = _mass / 1000;
        Source          = source;
        explosion_force = p_explosion_force;
        Caliber         = caliber;
        default_damage  = _default_damage;
        name            = _name;
        IsNone          = false;
        if (kinetic)
        {
            dammage_texture = Globals.impact_textures.GetTexture(ImpactTextures.TextureTemplate.ap_hole);
        }
        else if (explosive)
        {
            int diameter = 0;             // In milimeter
            switch (caliber)
            {
            case Caliber.c8mm_gettling:
                diameter = 8;
                break;

            case Caliber.c12_high_velocity:
                diameter = 12;
                break;

            case Caliber.c40mmm_autocannon:
                diameter = 40;
                break;

            case Caliber.c500mm_artillery:
                diameter = 500;
                break;

            default:
                break;
            }
            // One pixel represents a milimeter
            dammage_texture = Globals.impact_textures.GetTexture(ImpactTextures.TextureTemplate.he_hole, diameter, diameter);
        }
        else
        {
            dammage_texture = new UnityEngine.Texture2D(10, 10, UnityEngine.TextureFormat.Alpha8, false);
        }
    }
Esempio n. 24
0
    /**
     * @pre: None.
     * @post: Gun's parts should be rolled, ready for stats to be calculated.
     * @param: None.
     * @return: Stub for now, should return if build occurs with no issues function returns correctly.
     */

    public override bool BuildGun()
    {
        parts          = new GunPart[NUM_PARTS];
        ammo           = Instantiate(RollAmmo(), this.transform);
        barrel         = Instantiate(RollBarrel(), this.transform);
        caliber        = Instantiate(RollCaliber(), this.transform);
        cyclicModifier = Instantiate(RollCyclicModifier(), this.transform);
        cyclicModifier.Attach(this);
        magazine    = Instantiate(RollMagazine(), this.transform);
        sight       = Instantiate(RollSight(), this.transform);
        stock       = Instantiate(RollStock(), this.transform);
        underBarrel = Instantiate(RollUnderBarrel(), this.transform);
        underBarrel.Attach(this);
        readyForUse = true;
        CalculateStats();
        return(true);
    }
Esempio n. 25
0
        public static void AddCalibers()
        {
            var db = new WeaponSystemContext();

               var caliberCollection = XmlReader.ReadXmlCollectionFromFile("../../../../Weapons Source Data/calibers.xml");

               foreach (var caliberItem in caliberCollection)
               {
               var caliber = new Caliber();
               caliber.Name = caliberItem[0];

               if (!db.Calibers.Any(x => x.Name == caliber.Name))
               {
                   db.Calibers.Add(caliber);
               }
               }

               db.SaveChanges();
        }
Esempio n. 26
0
 public bool Equals(Cartridge other)
 {
     if (ReferenceEquals(null, other))
     {
         return(false);
     }
     if (ReferenceEquals(this, other))
     {
         return(true);
     }
     return(DragFunction == other.DragFunction &&
            BC.Equals(other.BC) &&
            string.Equals(Name, other.Name,
                          StringComparison.InvariantCultureIgnoreCase) &&
            MuzzleVelocity.Equals(other.MuzzleVelocity) &&
            Caliber.Equals(other.Caliber) &&
            Length.Equals(other.Length) &&
            WeightGrains.Equals(other.WeightGrains));
 }
Esempio n. 27
0
        public ActionResult Edit([Bind(Include = "Id,Name,Diameter,DiameterUnitId,BrassLength,BrassLengthUnitId,SortOrder,PrimerTypeId,Notes")] Caliber modEntity)
        {
            if (ModelState.IsValid)
            {
                this.service.Edit(modEntity);

                //var maxSortCaliber = this.service.GetAll().OfType<Caliber>().OrderBy(c => c.SortOrder).Last();
                //if (modEntity.SortOrder < maxSortCaliber.SortOrder)
                //    this.updateSortOrder(modEntity.Id, modEntity.SortOrder);

                return(RedirectToAction("Index"));
            }

            ViewBag.DiameterUnitId    = new SelectList(this.lengthUnits, "Id", "Abbreviation", modEntity.DiameterUnitId);
            ViewBag.BrassLengthUnitId = new SelectList(this.lengthUnits, "Id", "Abbreviation", modEntity.BrassLengthUnitId);
            ViewBag.PrimerTypeId      = new SelectList(this.primerTypes, "Id", "Abbreviation", modEntity.PrimerTypeId);

            return(View(modEntity));
        }
        public async Task <ActionResult <Weapon> > Post([FromBody] Weapon weapon)
        {
            if (weapon == null)
            {
                return(BadRequest());
            }

            Caliber caliberPresence = db.Calibers.FirstOrDefault(item => item.Title == weapon.Caliber);

            if (caliberPresence == null)
            {
                db.Calibers.Add(new Caliber(weapon.Caliber));
            }

            db.Weapons.Add(weapon);
            await db.SaveChangesAsync();

            return(Ok(weapon));
        }
Esempio n. 29
0
        //============================================================================*
        // ResolveIdentities()
        //============================================================================*

        public bool ResolveIdentities(cDataFiles Datafiles)
        {
            bool fChanged = false;

            if (m_Caliber.Identity)
            {
                foreach (cCaliber Caliber in Datafiles.CaliberList)
                {
                    if (!Caliber.Identity && Caliber.CompareTo(m_Caliber) == 0)
                    {
                        m_Caliber = Caliber;

                        fChanged = true;

                        break;
                    }
                }
            }

            return(fChanged);
        }
Esempio n. 30
0
        public override int GetHashCode()
        {
            int hashCode =
                IdVer.GetHashCode() +
                IdSubVer.GetHashCode() +
                Timestamp.GetHashCode() +
                (IdPrototype == null ? 0 : IdPrototype.GetHashCode()) +
                (IdItemBcn == null ? 0 : IdItemBcn.GetHashCode()) +
                (IdMaterialL1 == null ? 0 : IdMaterialL1.GetHashCode()) +
                (IdMaterialL2 == null ? 0 : IdMaterialL2.GetHashCode()) +
                (IdMaterialL3 == null ? 0 : IdMaterialL3.GetHashCode()) +
                (IdDefaultSupplier == null ? 0 : IdDefaultSupplier.GetHashCode()) +
                (IdModel == null ? 0 : IdModel.GetHashCode()) +
                (IdFamilyHK == null ? 0 : IdFamilyHK.GetHashCode()) +
                Caliber.GetHashCode() +
                (IdColor1 == null ? 0 : IdColor1.GetHashCode()) +
                (IdColor2 == null ? 0 : IdColor2.GetHashCode()) +
                (IdItemHK == null ? 0 : IdItemHK.GetHashCode()) +
                (ItemDescription == null ? 0 : ItemDescription.GetHashCode()) +
                (Comments == null ? 0 : Comments.GetHashCode()) +
                (Segment == null ? 0 : Segment.GetHashCode()) +
                (Category == null ? 0 : Category.GetHashCode()) +
                (Age == null ? 0 : Age.GetHashCode()) +
                (LaunchDate == null ? 0 : LaunchDate.GetHashCode()) +
                (RemovalDate == null ? 0 : RemovalDate.GetHashCode()) +
                IdStatusCial.GetHashCode() +
                IdStatusProd.GetHashCode() +
                (IdUserAttri1 == null ? 0 : IdUserAttri1.GetHashCode()) +
                (IdUserAttri2 == null ? 0 : IdUserAttri2.GetHashCode()) +
                (IdUserAttri3 == null ? 0 : IdUserAttri3.GetHashCode()) +
                (Unit == null ? 0 : Unit.GetHashCode()) +
                (DocsLink == null ? 0 : DocsLink.GetHashCode()) +
                CreateDate.GetHashCode() +
                User.GetHashCode() +
                (PhotoUrl == null ? 0 : PhotoUrl.GetHashCode());

            return(hashCode);
        }
Esempio n. 31
0
        public ActionResult FactoryCartridge(int?id)
        {
            if (id != null)
            {
                Caliber caliber = this.calibers.OfType <Caliber>().Where(c => c.Id == (int)id).First();
                ViewBag.CaliberName = caliber.Name;
            }
            else
            {
                ViewBag.CaliberId = new SelectList(this.calibers, "Id", "Name");
            }

            ViewBag.MassUnitId       = new SelectList(this.massUnits, "Id", "Abbreviation");
            ViewBag.BulletTypeId     = new SelectList(this.bulletTypes, "Id", "Abbreviation");
            ViewBag.ManufacturerId   = new SelectList(this.manufacturers, "Id", "Name");
            ViewBag.COLUnitId        = new SelectList(this.lengthUnits, "Id", "Abbreviation");
            ViewBag.PressureUnitId   = new SelectList(this.pressureUnits, "Id", "Abbreviation");
            ViewBag.VelocityUnitId   = new SelectList(this.velocityUnits, "Id", "Abbreviation");
            ViewBag.BrassMaterialId  = new SelectList(this.materials, "Id", "Name");
            ViewBag.BulletMaterialId = new SelectList(this.materials, "Id", "Name");

            return(View());
        }
Esempio n. 32
0
        //============================================================================*
        // ResolveIdentities()
        //============================================================================*

        public override bool ResolveIdentities(cDataFiles DataFiles)
        {
            bool fChanged = base.ResolveIdentities(DataFiles);

            if (m_Caliber.Identity)
            {
                foreach (cCaliber Caliber in DataFiles.CaliberList)
                {
                    if (!Caliber.Identity && Caliber.CompareTo(m_Caliber) == 0)
                    {
                        m_Caliber = Caliber;

                        fChanged = true;

                        break;
                    }
                }
            }

            fChanged = m_TestList.ResolveIdentities(DataFiles) ? true : fChanged;

            return(fChanged);
        }