예제 #1
0
 public ChangeOrAddItemViewModel(ItemModelBase?item = null)
 {
     this._definition    = (this.Item = item)?.Definition ?? Amalur.ItemDefinitions.Values.First();
     this._category      = item?.Category ?? ChangeOrAddItemViewModel._defaultCategory;
     this.ProcessCommand = new DelegateCommand(this.Process, () => this._definition != null);
     this.OnFilterChanged();
 }
예제 #2
0
파일: WeaponBase.cs 프로젝트: tgoyer/LORE
 public WeaponBase(string name, Money money, double weight, EquipmentCategory category, List<EquipmentType> types, int baseDamage, int hitModifier, int criticalModifier)
     : base(name, money, weight, category, types)
 {
     BaseDamage = baseDamage;
     CriticalModifier = criticalModifier;
     HitModifier = hitModifier;
 }
예제 #3
0
        public void MergeExpressionTest()
        {
            // arrange
            var options = new DbContextOptionsBuilder <Context>().UseInMemoryDatabase("test data base").Options;
            var context = new Context(options);
            var service = new EquipmentInfoService(context);

            var eq1 = new EquipmentCategory {
                Id = 1, Name = "test name"
            };

            context.EquipmentCategory.Add(eq1);
            context.EquipmentInfo.Add(new EquipmentInfo {
                EquipmentCategoryNav = eq1, Name = "asds", Id = 1
            });
            // act
            context.SaveChanges();
            var res1 = service.GetInfoExtCategoryNames().First();
            var res2 = service.GetInfoExtCategoryNamesMerge().First();

            // assert
            Assert.IsTrue(res1.CategoryName == eq1.Name);
            Assert.IsTrue(res2.CategoryName == eq1.Name);
            ;
        }
예제 #4
0
        public ActionResult DeleteConfirmed(int id)
        {
            EquipmentCategory equipmentCategory = db.EquipmentCategories.Find(id);

            db.EquipmentCategories.Remove(equipmentCategory);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
예제 #5
0
 public ChangeOrAddItemViewModel(GameSave gameSave, ItemModelBase?item = null)
 {
     this._category      = item?.Category ?? ChangeOrAddItemViewModel._defaultCategory;
     this._definition    = (this.Item = item)?.Definition ?? gameSave.ItemDefinitions.First();
     this.GameSave       = gameSave;
     this.ProcessCommand = new(this.Process, () => this._definition != null);
     this.OnFilterChanged();
 }
예제 #6
0
        public async Task <JsonResult> Delete([FromBody] EquipmentCategory equipmentCategory)
        {
            await CheckPermission();

            var cer = new CategoryEquipmentRepository(_logger);
            await cer.Delete(equipmentCategory.Id);

            return(Json(new { message = "Delete OK" }));
        }
        public List <Package> Read()
        {
            DataHandler dh = new DataHandler();

            List <Package> packageList = new List <Package>();
            //                     0           1         2              3             4                   5               6                            7                  8                        9
            string query = "SELECT P.PackageID, P.pName, P.pDescription, S.ServiceID, S.expectedDuration, S.sDescription, SLA.ServiceLevelAgreementID, SLA.slaDescription, P.EquipmentCategoryID , EC.CategoryName FROM Package P " +
                           "LEFT JOIN Service S ON S.ServiceID = P.ServiceID " +
                           "LEFT JOIN ServiceLevelAgreement SLA ON SLA.ServiceLevelAgreementID = P.ServiceLevelAgreementID " +
                           "LEFT JOIN EquipmentCategory EC ON EC.EquipmentCategoryID = P.EquipmentCategoryID ";

            SqlDataReader         read = dh.Select(query);
            EquipmentCategory     category;
            Service               service;
            ServiceLevelAgreement serviceLevelAgreement;
            Package               package;

            if (read.HasRows)
            {
                while (read.Read())
                {
                    service = new Service(
                        read.GetString(5),
                        read.GetInt32(4)
                        );
                    service.Id = read.GetInt32(3);

                    serviceLevelAgreement = new ServiceLevelAgreement(
                        read.GetString(7)
                        );
                    serviceLevelAgreement.Id = read.GetInt32(6);


                    category = new EquipmentCategory(
                        read.GetString(9)
                        );
                    category.Id = read.GetInt32(8);


                    package = new Package(
                        read.GetString(1),
                        read.GetString(2),
                        service,
                        serviceLevelAgreement,
                        category
                        );

                    package.Id = read.GetInt32(0);

                    packageList.Add(package);
                }
            }

            dh.Dispose();

            return(packageList);
        }
예제 #8
0
        public void CreateEquipmentCategory(CreateCategoryDto createCategory)
        {
            EquipmentCategory category = _mapper.Map <EquipmentCategory>(createCategory);
            ImageFile         image    = JsonConvert.DeserializeObject <ImageFile>(createCategory.image.ToString());

            category.image = Convert.FromBase64String(image.value);
            _repositoryFactory.EquipmentRepository.CreateEquipmentCategory(category);
            _logger.LogInformation("Equipment category created successfully");
        }
예제 #9
0
 public ActionResult Edit([Bind(Include = "EquipmentCategoryId,EquipmentCategoryName,EquipmentCategoryIsReusable,EquipmentCategoryInUseCount,EquipmentCategoryThreshold")] EquipmentCategory equipmentCategory)
 {
     if (ModelState.IsValid)
     {
         db.Entry(equipmentCategory).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(equipmentCategory));
 }
 public ActionResult Edit([Bind(Include = "Id,Code,Description")] EquipmentCategory equipmentCategory)
 {
     if (ModelState.IsValid)
     {
         db.Entry(equipmentCategory).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(equipmentCategory));
 }
        public ActionResult Create(EquipmentCategory category)
        {
            if (ModelState.IsValid)
            {
                _equipmentCategoryDao.Create(category);
                return(RedirectToAction("Index", "EquipmentCategory"));
            }

            ViewBag.categories = _categories;
            return(View("Index"));
        }
        public static ContainerIdentification From(this ContainerIdentification containerIdentification,
                                                   OwnerCode ownerCode,
                                                   EquipmentCategory equipmentCategory,
                                                   SerialNumber serialNumber)
        {
            containerIdentification.OwnerCode         = ownerCode;
            containerIdentification.EquipmentCategory = equipmentCategory;
            containerIdentification.SerialNumber      = serialNumber;

            return(containerIdentification);
        }
        public ActionResult Create([Bind(Include = "Id,Code,Description")] EquipmentCategory equipmentCategory)
        {
            if (ModelState.IsValid)
            {
                db.EquipmentCategories.Add(equipmentCategory);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(equipmentCategory));
        }
예제 #14
0
        public ActionResult Create([Bind(Include = "EquipmentCategoryId,EquipmentCategoryName,EquipmentCategoryIsReusable,EquipmentCategoryQuantity,EquipmentCategoryThreshold")] EquipmentCategory equipmentCategory)
        {
            if (ModelState.IsValid)
            {
                db.EquipmentCategories.Add(equipmentCategory);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(equipmentCategory));
        }
        private void btnAddPackage1_Click(object sender, EventArgs e)
        {
            //Here we call from the Service Contract logic
            if (txtPDiscript.Text.Equals(""))
            {
                MessageBox.Show("Please enter Package description details", "EMPTY FIELDS!!",
                                MessageBoxButtons.OK, MessageBoxIcon.Error);
            }//Data validation
            if (txtPName.Text.Equals(""))
            {
                MessageBox.Show("Please enter package name details", "EMPTY FIELDS!!",
                                MessageBoxButtons.OK, MessageBoxIcon.Error);
            }//Data Validation
            if (cmbPService.SelectedIndex < 0)
            {
                MessageBox.Show("Please Select a Service", "EMPTY VALUE!!",
                                MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            if (cmbPSLA.SelectedIndex < 0)
            {
                MessageBox.Show("Please Select a Service Level Agreemnt", "EMPTY VALUE!!",
                                MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            else
            {
                Description = txtPDiscript.Text;
                Name        = txtPName.Text;

                service = Placeholder_Service_List[cmbPService.SelectedIndex];
                sla     = Placeholder_SLA_List[cmbPSLA.SelectedIndex];
                EQC     = Placeholder_EQC_List[cbxEquitptmentCatagory.SelectedIndex];


                /*
                 * ! You were here last
                 *
                 */



                newPackage = new Package(Name, Description, service, sla, EQC);

                P_L.Addpackage(newPackage);

                MessageBox.Show("Service successfully Added", " ADD",
                                MessageBoxButtons.OK, MessageBoxIcon.Information);

                //Perform Fom transition
                Hide();
                frmServiceContract form = new frmServiceContract();
                form.ShowDialog();
            }
        }//Add a Package
 public IHttpActionResult UpdateEquipment([FromBody] EquipmentCategory eqiupment)
 {
     try
     {
         _equipementCategoryService.UpdateEquipmentCategory(eqiupment);
         return(Ok());
     }
     catch (System.Exception e)
     {
         return(InternalServerError(e));
     }
 }
예제 #17
0
        public ucEquipmentEntry()
        {
            InitializeComponent();

            luColEquipNum.DataSource = Equipment.ListForCompany().Select(e => new
            {
                EqpNum      = e.EqpNum,
                AssetCode   = e.AssetCode,
                DisplayName = e.DisplayName,
                Class       = EquipmentClass.GetEquipmentClass(e.ClassCode)?.Desc,
                Category    = EquipmentCategory.GetEquipmentCategory(e.CategoryCode)?.Desc
            }).ToList();

            luColAssertNum.DataSource = Equipment.ListForCompany().Select(e => new
            {
                EqpNum      = e.EqpNum,
                AssetCode   = e.AssetCode,
                DisplayName = e.DisplayName,
                Class       = EquipmentClass.GetEquipmentClass(e.ClassCode)?.Desc,
                Category    = EquipmentCategory.GetEquipmentCategory(e.CategoryCode)?.Desc
            }).ToList();

            var level1CodeList = LevelOneCode.ListForCompany().Select(code => new { MatchId = code.MatchId, Code = code.Code, Desc = code.Desc, DisplayName = code.DisplayName }).Distinct().ToList();

            luColLevel1All.DataSource = level1CodeList.OrderBy(x => x.MatchId);

            var level2CodeList = LevelTwoCode.ListForCompany().Select(code => new { MatchId = code.MatchId, Code = code.Code, Desc = code.Desc, DisplayName = code.DisplayName }).Distinct().ToList();

            luColLevel2All.DataSource = level2CodeList.OrderBy(x => x.MatchId);

            var level3CodeList = LevelThreeCode.ListForCompany().Select(code => new { MatchId = code.MatchId, Code = code.Code, Desc = code.Desc, DisplayName = code.DisplayName }).Distinct().ToList();

            luColLevel3All.DataSource = level3CodeList.OrderBy(x => x.MatchId);

            var level4CodeList = LevelFourCode.ListForCompany().Select(code => new { MatchId = code.MatchId, Code = code.Code, Desc = code.Desc, DisplayName = code.DisplayName }).Distinct().ToList();

            luColLevel4All.DataSource = level4CodeList.OrderBy(x => x.MatchId);

            luColBillCycleAll.DataSource = Enum.GetValues(typeof(EnumBillCycle)).Cast <EnumBillCycle>().Select(x => new { Enum = (char)x, Desc = Enum.GetName(typeof(EnumBillCycle), x) });

            int maxLevel  = Company.GetCurrCompany().MaxLevelCode;
            var SetColumn = new Action <GridColumn, int, string>((col, level, caption) =>
            {
                col.Visible = maxLevel >= level;
                col.OptionsColumn.ShowInCustomizationForm = maxLevel >= level;
                col.Caption = caption;
            });

            SetColumn(colLevel4Code, 4, Company.GetCurrCompany().Level4CodeDesc);
            SetColumn(colLevel3Code, 3, Company.GetCurrCompany().Level3CodeDesc);
            SetColumn(colLevel2Code, 2, Company.GetCurrCompany().Level2CodeDesc);
            SetColumn(colLevel1Code, 1, Company.GetCurrCompany().Level1CodeDesc);
        }
예제 #18
0
파일: ArmorBase.cs 프로젝트: tgoyer/LORE
 public ArmorBase(
     string name, Money money, EquipmentCategory category, List<EquipmentType> type, double weight,
     int armorValue, int staminaBoost, int strengthBoost, int agilityBoost, int intelligenceBoost, int wisdomBoost
 )
     : base(name, money, weight, category, type)
 {
     ArmorValue = armorValue;
     StaminaBoost = staminaBoost;
     StrengthBoost = strengthBoost;
     AgilityBoost = agilityBoost;
     IntelligenceBoost = intelligenceBoost;
     WisdomBoost = wisdomBoost;
 }
        public static CheckedContainerIdentification From(this CheckedContainerIdentification containerIdentification,
                                                          OwnerCode ownerCode,
                                                          EquipmentCategory equipmentCategory,
                                                          SerialNumber serialNumber,
                                                          CheckDigit checkDigit)
        {
            containerIdentification.OwnerCode         = ownerCode;
            containerIdentification.EquipmentCategory = equipmentCategory;
            containerIdentification.SerialNumber      = serialNumber;
            containerIdentification.CheckDigit        = checkDigit;

            return(containerIdentification);
        }
예제 #20
0
        // GET: EquipmentCategories/Delete/5
        public ActionResult Delete(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            EquipmentCategory equipmentCategory = db.EquipmentCategories.Find(id);

            if (equipmentCategory == null)
            {
                return(HttpNotFound());
            }
            return(View(equipmentCategory));
        }
예제 #21
0
        private void DeleteChildrenCategories(EquipmentCategory category)
        {
            var categories = GetCategoriesByParentId(category.Id);

            foreach (var equipmentCategory in categories)
            {
                var info = _repository.Query <EquipmentInfo>().Where(x => x.EquipmentCategory == category).ToList();
                foreach (var i in info)
                {
                    _repository.Execute("Delete from EquipmentInfoColumnValue Where EquipmentInfoId = " + i.Id);
                    _repository.Execute("Delete from EquipmentInfo Where Id = " + i.Id);
                }
                _repository.Execute("Delete from EquipmentCategoryColumn Where EquipmentCategoryId = " + equipmentCategory.Id);
                _repository.Execute("Delete from EquipmentCategory Where Id = " + equipmentCategory.Id);
            }
        }
예제 #22
0
        public static string GetEquipmentCategoryStandardString(EquipmentCategory equipmentCategory)
        {
            switch (equipmentCategory)
            {
            case EquipmentCategory.J:
                return(Constants.EquipmentCategoryJStandardString);

            case EquipmentCategory.U:
                return(Constants.EquipmentCategoryUStandardString);

            case EquipmentCategory.Z:
                return(Constants.EquipmentCategoryZStandardString);

            default:
                throw new ArgumentException(EnumHelper.UnexpectedEnumerationValueMessage(equipmentCategory), nameof(equipmentCategory));
            }
        }
예제 #23
0
    static EquipmentCategoryExtensions()
    {
        // Build all parents
        foreach (EquipmentCategory root in immediateParents.Keys)
        {
            List <EquipmentCategory> parents = new List <EquipmentCategory>()
            {
                default(EquipmentCategory)
            };
            for (EquipmentCategory parent = immediateParents.GetValueOrDefault(root); parent != default(EquipmentCategory) && !parents.Contains(parent); parent = immediateParents.GetValueOrDefault(parent))
            {
                parents.Add(parent);
            }

            allParents[root] = parents;
        }
    }
        public ActionResult Edit(EquipmentCategory category)
        {
            if (ModelState.IsValid)
            {
                EquipmentCategory cat = _equipmentCategoryDao.GetById(category.Id);

                cat.Title       = category.Title;
                cat.Description = category.Description;

                _equipmentCategoryDao.Update(cat);
                return(RedirectToAction("Index", "EquipmentCategory"));
            }

            ViewBag.categories = _categories;
            EquipmentCategory ec = _equipmentCategoryDao.GetById(category.Id);

            return(View("Detail", ec));
        }
        public void SaveCategory([FromBody] EquipmentCategory model)
        {
            var set    = _db.Set <EquipmentCategory>();
            var domain = set.Find(model.Id);

            if (domain == null)
            {
                domain = model;
                set.Add(domain);
            }
            else
            {
                domain.Name     = model.Name;
                domain.ParentId = model.ParentId;
                set.Update(domain);
            }
            _db.SaveChanges();
        }
예제 #26
0
            public List <Equipment> ReadChildren(Client parent)
            {
                DataHandler dh = new DataHandler();

                List <Equipment> equipmentList = new List <Equipment>();

                string query = String.Format(
                    "SELECT EquipmentID, SerialNumber, Manufacturer, E.EquipmentCategoryID, EC.CategoryName " +
                    "FROM Equipment E INNER JOIN EquipmentCategory EC ON EC.EquipmentCategoryID = E.EquipmentCategoryID " +
                    "WHERE ClientID = {0}",
                    parent.Id
                    );

                SqlDataReader     read = dh.Select(query);
                Equipment         equipment;
                EquipmentCategory category;

                if (read.HasRows)
                {
                    while (read.Read())
                    {
                        equipment = new Equipment(
                            read.GetString(1),
                            read.GetString(2)
                            );

                        equipment.Id = read.GetInt32(0);

                        category = new EquipmentCategory(
                            read.GetString(4)
                            );

                        category.Id = read.GetInt32(3);

                        equipment.Category = category;

                        equipmentList.Add(equipment);
                    }
                }

                dh.Dispose();

                return(equipmentList);
            }
예제 #27
0
 internal ItemDefinition(EquipmentCategory category, uint typeId, byte level, string name, string internalName, float maxDurability, Rarity rarity,
                         string socketTypes, Element element, ArmorType armorType, Buff?prefix, Buff?suffix, Buff[] itemBuffs, Buff[] playerBuffs, bool hasVariants)
 {
     Category      = category;
     TypeId        = typeId;
     Level         = level;
     Name          = name;
     InternalName  = internalName;
     MaxDurability = maxDurability;
     Rarity        = rarity;
     SocketTypes   = socketTypes;
     ArmorType     = armorType;
     Element       = element;
     PlayerBuffs   = playerBuffs;
     HasVariants   = hasVariants;
     ItemBuffs     = itemBuffs.Length == 0 && prefix is null && suffix is null
         ? ItemDefinitionBuffMemory.Empty
         : new ItemDefinitionBuffMemory(itemBuffs, prefix, suffix);
     // merchant search is case sensitive to avoid affixing the Merchant's hat.
     IsMerchant    = InternalName.Contains("merchant");
     AffixableName = IsMerchant || internalName.IndexOf("common", StringComparison.OrdinalIgnoreCase) != -1;
 }
예제 #28
0
        public async Task <JsonResult> Add([FromBody] EquipmentCategory input)
        {
            await CheckPermission();

            var sqlr = new CategoryEquipmentRepository(_logger);

            try
            {
                if (input.Id != 0)
                {
                    await sqlr.Update(input);
                }
                else
                {
                    await sqlr.Add(input);
                }
                return(Json(new { message = "addOrUpdate OK" }));
            }
            catch (Exception e)
            {
                throw new Exception($"Can't add or update {this.GetType().ToString()} ex = {e}");
            }
        }
예제 #29
0
        public static List <EquipmentType> SeperateToEquipmentTypes(this EquipmentCategory equipmentCategory)
        {
            List <EquipmentType> ret = new List <EquipmentType>();

            switch (equipmentCategory)
            {
            case EquipmentCategory.Weapon:
                ret.Add(EquipmentType.Weapon);
                break;

            case EquipmentCategory.Armor:
                ret.Add(EquipmentType.Helm);
                ret.Add(EquipmentType.Chest);
                ret.Add(EquipmentType.Pant);
                break;

            case EquipmentCategory.Accessory:
                ret.Add(EquipmentType.Amulet);
                ret.Add(EquipmentType.Ring);
                break;
            }

            return(ret);
        }
예제 #30
0
 private ItemDefinition(EquipmentCategory category, uint typeId, byte level, string name, string internalName, float maxDurability, Rarity rarity,
                        string socketTypes, Element element, ArmorType armorType, Buff?prefix, Buff?suffix,
                        Buff[] itemBuffs, Buff[] playerBuffs, bool isMerchant, bool affixableName, bool hasVariants, string chaosTier)
 {
     Category      = category;
     TypeId        = typeId;
     Level         = level;
     Name          = name;
     InternalName  = internalName;
     MaxDurability = maxDurability;
     Rarity        = rarity;
     SocketTypes   = socketTypes;
     ArmorType     = armorType;
     Element       = element;
     PlayerBuffs   = playerBuffs;
     ItemBuffs     = itemBuffs.Length == 0 && prefix is null && suffix is null
         ? ItemDefinitionBuffMemory.Empty
         : new(itemBuffs, prefix, suffix);
     IsMerchant        = isMerchant;
     AffixableName     = affixableName;
     HasVariants       = hasVariants;
     ChaosTier         = chaosTier;
     RequiresFatesworn = internalName.StartsWith("mit_");
 }
        public async Task <EquipmentPaging> GetByCategory(EquipmentCategory cat, int skip = 0,
                                                          int limit = Int32.MaxValue, string filter = null)
        {
            using (var conn = new SqlConnection(AppSettings.ConnectionString))
            {
                var sql    = Sql.SqlQueryCach["Equipment.ByCategoryId"];
                var result = await conn.QueryAsync <EquipmentWitcAct, EquipmentCategory, EquipmentWitcAct>(
                    sql,
                    (equipment, category) =>
                {
                    equipment.Category = category;
                    return(equipment);
                }, new { category_id = cat.Id, skip = skip, limit = limit });

                var sqlc  = Sql.SqlQueryCach["Equipment.CountByCategoryId"];
                var count = conn.ExecuteScalar <int>(sqlc, new
                {
                    category_id = cat.Id
                });

                TaskCommon.FilterBody[] filters;
                var filterOutput = new List <EquipmentWitcAct>();
                if (filter != null)
                {
                    filters = JsonConvert.DeserializeObject <TaskCommon.FilterBody[]>(filter);
                    if (filters.Length > 0)
                    {
                        foreach (var value in result)
                        {
                            foreach (var item in filters)
                            {
                                switch (item.Filter)
                                {
                                case "Name":
                                    if (value.Name.ToLower().Contains(item.Value.ToLower()))
                                    {
                                        filterOutput.Add(value);
                                    }
                                    break;
                                }
                            }
                        }
                    }
                }

                if (filter != null)
                {
                    result = filterOutput;
                    count  = filterOutput.Count;
                }

                //var newFuckingResult = new List<EquipmentWitcAct>();
                var sqlRAct = new ActCategoriesRepository();
                foreach (var item in result.ToArray())
                {
                    var actCategory = await sqlRAct.GetByEquipmentId(item.Id);

                    if (actCategory.ToArray().Length > 0)
                    {
                        item.EquipmentActCategoryDescription = actCategory.FirstOrDefault().Description;
                        item.EquipmentActCategoryName        = actCategory.FirstOrDefault().Name;
                        item.EquipmentActCategoryId          = actCategory.FirstOrDefault().Id;
                    }
                }

                var output = new EquipmentPaging
                {
                    Data  = result.ToArray(),
                    Total = count
                };

                return(output);
            }
        }
 public bool UpdateEquipmentCategory(EquipmentCategory equipmentCategory)
 {
     this._unitOfWork.EquipmentCategoryRepository <EquipmentCategory>().Update(equipmentCategory);
     return(false);
 }
예제 #33
0
파일: ClassRules.cs 프로젝트: tgoyer/LORE
 private static void AddEquipmentProficiency(CharacterBase character, EquipmentCategory type)
 {
     if (character.Proficiencies.Contains(type))
         return;
     character.Proficiencies.Add(type);
 }