示例#1
0
        // GET: Edit Requirement
        public ActionResult Edit(Guid id)
        {
            ViewBag.statuses = StatusData.ListAll();
            Requirement model = RequirementData.GetById(id);

            return(View(model));
        }
示例#2
0
        // GET: Requirement
        public ActionResult Index()
        {
            ViewBag.statuses = StatusData.ListAll();
            List <Requirement> model = RequirementData.ListAll();

            return(View(model));
        }
        /// <summary>
        /// 検索条件をセット.
        /// </summary>
        /// <param name="requirementData"></param>
        public void SetRequirementData(RequirementData requirementData)
        {
            if (null == requirementData)
            {
                Log.Write("検索条件コントロールの初期化に失敗しました(引数なし)");
                return;
            }

            var part = requirementData.Part;

            if (!RequirementDataDic.ContainsKey(part))
            {
                Log.Write("検索条件コントロール[{0}]の初期化に失敗しました(指定部位が不明)".Fmt(part));
                return;
            }

            // 部位毎の初期化を実施.
            this.Def             = RequirementDataDic[part];
            this.RequirementData = requirementData;

            // 検索条件コンボボックス更新.
            this.chkPart.Text = this.Def.Title;

            // コンボボックスの初期化を実施すると値が更新されてしまうので、
            // この時点で初期化値を確保しておく.
            var termType = this.RequirementData.TermsType;

            this.FixedIndex = this.RequirementData.FixedIndex;

            // 初期化.
            this.cmbRequirement.Init(this.Def.CmbItemList);

            // 要素選択.
            foreach (var item in this.cmbRequirement.Items)
            {
                var val = item as TermsTypeData;
                if (null != val && val.TermsType == termType)
                {
                    this.cmbRequirement.SelectValue(item);
                    break;
                }
            }

            // 固定装備コンボボックス更新.
            this.UpdateCmbFixedEquip();

            // 固定装備コンボ再選択.
            foreach (var item in this.cmbFixedEquip.Items)
            {
                var val = item as MasterDataBase;
                if (null != val && val.GetIndex() == this.FixedIndex)
                {
                    this.cmbFixedEquip.SelectValue(item);
                    break;
                }
            }

            this.chkPart.Checked = termType != TermsType.Unused;
        }
        // GET: Business Record
        public ActionResult Index()
        {
            ViewBag.GetNew   = RequirementData.GetNew();
            ViewBag.GetRenew = RequirementData.GetRenew();
            List <BusinessRecord> model = new List <BusinessRecord>();

            model = BusinessRecordData.ListAll();
            return(View(model));
        }
示例#5
0
        public ActionResult Edit(Requirement model)
        {
            bool result = RequirementData.Edit(model);

            if (result)
            {
                return(RedirectToAction("Index"));
            }

            return(View());
        }
示例#6
0
        public ActionResult Delete(Requirement model)
        {
            bool result = RequirementData.Delete(model.UniqueId.ToString());

            if (result)
            {
                return(RedirectToAction("Index"));
            }

            return(View());
        }
示例#7
0
        public ActionResult Add(Requirement model)
        {
            model.CreatedDate = DateTime.Now;
            bool result = RequirementData.Add(model);

            if (result)
            {
                return(RedirectToAction("Index"));
            }

            return(View());
        }
 // GET: Add Business Record
 public ActionResult Add()
 {
     ViewBag.businessowners  = BusinessOwnerData.ListAll();
     ViewBag.businessdetails = BusinessDetailData.ListAll();
     ViewBag.provinces       = ProvincesData.ListAll();
     ViewBag.cities          = CitiesData.ListAll();
     ViewBag.districts       = DistrictData.ListAll();
     ViewBag.barangays       = BarangayData.ListAll();
     ViewBag.streets         = StreetData.ListAll();
     ViewBag.businesstype    = BusinessTypeData.ListAll();
     ViewBag.Requirements    = RequirementData.GetNew();
     return(View());
 }
        // GET: Edit Business Record
        public ActionResult Edit(string id)
        {
            ViewBag.businessowners  = BusinessOwnerData.ListAll();
            ViewBag.businessdetails = BusinessDetailData.ListAll();
            ViewBag.provinces       = ProvincesData.ListAll();
            ViewBag.cities          = CitiesData.ListAll();
            ViewBag.districts       = DistrictData.ListAll();
            ViewBag.barangays       = BarangayData.ListAll();
            ViewBag.streets         = StreetData.ListAll();
            ViewBag.businesstype    = BusinessTypeData.ListAll();
            BusinessRecord model = BusinessRecordData.GetById(id);

            ViewBag.businessRecords = new HashSet <int>(model.Requirements.Select(i => i.Id));
            if (model.BusinessDetail.isNew)
            {
                ViewBag.Requirements = RequirementData.GetNew();
            }
            else
            {
                ViewBag.Requirements = RequirementData.GetRenew();
            }
            return(View(model));
        }
示例#10
0
        public void InitializeRequirementData(string skills, string experience, string education)
        {
            List <string> skillsListTemp = skills.ToUpper().Split(
                new[] { "," },
                StringSplitOptions.None).ToList();

            List <string> skillsList = new List <string>();

            foreach (var skill in skillsListTemp)
            {
                skillsList.Add(skill.Trim());
            }

            List <string> experienceListTemp = experience.ToUpper().Split(
                new[] { "\r\n", "\r", "\n", " ", "," },
                StringSplitOptions.None).ToList();

            List <string> experienceList = new List <string>();

            foreach (var exp in experienceListTemp)
            {
                experienceList.Add(exp.Trim());
            }

            List <string> educationListTemp = education.ToUpper().Split(
                new[] { "\r\n", "\r", "\n", " ", "," },
                StringSplitOptions.None).ToList();

            List <string> educationList = new List <string>();

            foreach (var edu in educationListTemp)
            {
                educationList.Add(edu.Trim());
            }
            requirementData = new RequirementData(skillsList, experienceList, educationList);
        }
示例#11
0
        public ExtraSongData(string levelID, string songPath)
        {
            //        Utilities.Logging.Log("SongData Ctor");
            try
            {
                if (!File.Exists(songPath + "/info.dat"))
                {
                    return;
                }
                var infoText = File.ReadAllText(songPath + "/info.dat");

                JObject            info = JObject.Parse(infoText);
                JObject            infoData;
                List <Contributor> levelContributors = new List <Contributor>();
                //Check if song uses legacy value for full song One Saber mode
                if (info.ContainsKey("_customData"))
                {
                    infoData = (JObject)info["_customData"];
                    if (infoData.ContainsKey("_contributors"))
                    {
                        levelContributors.AddRange(infoData["_contributors"].ToObject <Contributor[]>());
                    }
                    if (infoData.ContainsKey("_customEnvironment"))
                    {
                        _customEnvironmentName = (string)infoData["_customEnvironment"];
                    }
                    if (infoData.ContainsKey("_customEnvironmentHash"))
                    {
                        _customEnvironmentHash = (string)infoData["_customEnvironmentHash"];
                    }
                }
                contributors = levelContributors.ToArray();


                List <DifficultyData> diffData = new List <DifficultyData>();
                JArray diffSets = (JArray)info["_difficultyBeatmapSets"];
                foreach (JObject diffSet in diffSets)
                {
                    string SetCharacteristic = (string)diffSet["_beatmapCharacteristicName"];
                    JArray diffBeatmaps      = (JArray)diffSet["_difficultyBeatmaps"];
                    foreach (JObject diffBeatmap in diffBeatmaps)
                    {
                        List <string>     diffRequirements = new List <string>();
                        List <string>     diffSuggestions  = new List <string>();
                        List <string>     diffWarnings     = new List <string>();
                        List <string>     diffInfo         = new List <string>();
                        string            diffLabel        = "";
                        MapColor          diffLeft         = null;
                        MapColor          diffRight        = null;
                        BeatmapDifficulty diffDifficulty   = Utilities.Utils.ToEnum((string)diffBeatmap["_difficulty"], BeatmapDifficulty.Normal);
                        JObject           beatmapData;
                        if (diffBeatmap.ContainsKey("_customData"))
                        {
                            beatmapData = (JObject)diffBeatmap["_customData"];
                            if (beatmapData.ContainsKey("_difficultyLabel"))
                            {
                                diffLabel = (string)beatmapData["_difficultyLabel"];
                            }

                            //Get difficulty json fields
                            if (beatmapData.ContainsKey("_colorLeft"))
                            {
                                if (beatmapData["_colorLeft"].Children().Count() == 3)
                                {
                                    diffLeft   = new MapColor(0, 0, 0);
                                    diffLeft.r = (float)beatmapData["_colorLeft"]["r"];
                                    diffLeft.g = (float)beatmapData["_colorLeft"]["g"];
                                    diffLeft.b = (float)beatmapData["_colorLeft"]["b"];
                                }
                            }
                            if (beatmapData.ContainsKey("_colorRight"))
                            {
                                if (beatmapData["_colorRight"].Children().Count() == 3)
                                {
                                    diffRight   = new MapColor(0, 0, 0);
                                    diffRight.r = (float)beatmapData["_colorRight"]["r"];
                                    diffRight.g = (float)beatmapData["_colorRight"]["g"];
                                    diffRight.b = (float)beatmapData["_colorRight"]["b"];
                                }
                            }
                            if (beatmapData.ContainsKey("_warnings"))
                            {
                                diffWarnings.AddRange(((JArray)beatmapData["_warnings"]).Select(c => (string)c));
                            }
                            if (beatmapData.ContainsKey("_information"))
                            {
                                diffInfo.AddRange(((JArray)beatmapData["_information"]).Select(c => (string)c));
                            }
                            if (beatmapData.ContainsKey("_suggestions"))
                            {
                                diffSuggestions.AddRange(((JArray)beatmapData["_suggestions"]).Select(c => (string)c));
                            }
                            if (beatmapData.ContainsKey("_requirements"))
                            {
                                diffRequirements.AddRange(((JArray)beatmapData["_requirements"]).Select(c => (string)c));
                            }
                        }
                        RequirementData diffReqData = new RequirementData
                        {
                            _requirements = diffRequirements.ToArray(),
                            _suggestions  = diffSuggestions.ToArray(),
                            _information  = diffInfo.ToArray(),
                            _warnings     = diffWarnings.ToArray()
                        };

                        diffData.Add(new DifficultyData
                        {
                            _beatmapCharacteristicName = SetCharacteristic,
                            _difficulty              = diffDifficulty,
                            _difficultyLabel         = diffLabel,
                            additionalDifficultyData = diffReqData,
                            _colorLeft  = diffLeft,
                            _colorRight = diffRight
                        });
                    }
                }
                _difficulties = diffData.ToArray();
            }
            catch (Exception ex)
            {
                Utilities.Logging.Log($"Error in Level {songPath}: \n {ex}", IPA.Logging.Logger.Level.Error);
            }
        }
示例#12
0
        public ExtraSongData(string levelID, string songPath)
        {
            try
            {
                if (!File.Exists(Path.Combine(songPath, "info.dat")))
                {
                    return;
                }

                var infoText = File.ReadAllText(songPath + "/info.dat");

                JObject            info = JObject.Parse(infoText);
                JObject            infoData;
                List <Contributor> levelContributors = new List <Contributor>();
                //Check if song uses legacy value for full song One Saber mode
                if (info.TryGetValue("_customData", out var data))
                {
                    infoData = (JObject)data;
                    if (infoData.TryGetValue("_contributors", out var contributors))
                    {
                        levelContributors.AddRange(contributors.ToObject <Contributor[]>());
                    }

                    if (infoData.TryGetValue("_customEnvironment", out var customEnvironment))
                    {
                        _customEnvironmentName = (string)customEnvironment;
                    }

                    if (infoData.TryGetValue("_customEnvironmentHash", out var envHash))
                    {
                        _customEnvironmentHash = (string)envHash;
                    }

                    if (infoData.TryGetValue("_defaultCharacteristic", out var defaultChar))
                    {
                        _defaultCharacteristic = (string)defaultChar;
                    }
                }

                contributors = levelContributors.ToArray();


                var diffData = new List <DifficultyData>();
                var diffSets = (JArray)info["_difficultyBeatmapSets"];
                foreach (var diffSet in diffSets)
                {
                    var    setCharacteristic = (string)diffSet["_beatmapCharacteristicName"];
                    JArray diffBeatmaps      = (JArray)diffSet["_difficultyBeatmaps"];
                    foreach (JObject diffBeatmap in diffBeatmaps)
                    {
                        var      diffRequirements  = new List <string>();
                        var      diffSuggestions   = new List <string>();
                        var      diffWarnings      = new List <string>();
                        var      diffInfo          = new List <string>();
                        var      diffLabel         = "";
                        MapColor?diffLeft          = null;
                        MapColor?diffRight         = null;
                        MapColor?diffEnvLeft       = null;
                        MapColor?diffEnvRight      = null;
                        MapColor?diffEnvLeftBoost  = null;
                        MapColor?diffEnvRightBoost = null;
                        MapColor?diffObstacle      = null;

                        var diffDifficulty = Utils.ToEnum((string)diffBeatmap["_difficulty"], BeatmapDifficulty.Normal);
                        if (diffBeatmap.TryGetValue("_customData", out var customData))
                        {
                            JObject beatmapData = (JObject)customData;
                            if (beatmapData.TryGetValue("_difficultyLabel", out var difficultyLabel))
                            {
                                diffLabel = (string)difficultyLabel;
                            }

                            //Get difficulty json fields
                            if (beatmapData.TryGetValue("_colorLeft", out var colorLeft))
                            {
                                if (colorLeft.Children().Count() == 3)
                                {
                                    diffLeft = new MapColor(
                                        (float)(colorLeft["r"] ?? 0),
                                        (float)(colorLeft["g"] ?? 0),
                                        (float)(colorLeft["b"] ?? 0));
                                }
                            }

                            if (beatmapData.TryGetValue("_colorRight", out var colorRight))
                            {
                                if (colorRight.Children().Count() == 3)
                                {
                                    diffRight = new MapColor(
                                        (float)(colorRight["r"] ?? 0),
                                        (float)(colorRight["g"] ?? 0),
                                        (float)(colorRight["b"] ?? 0));
                                }
                            }

                            if (beatmapData.TryGetValue("_envColorLeft", out var envColorLeft))
                            {
                                if (envColorLeft.Children().Count() == 3)
                                {
                                    diffEnvLeft = new MapColor(
                                        (float)(envColorLeft["r"] ?? 0),
                                        (float)(envColorLeft["g"] ?? 0),
                                        (float)(envColorLeft["b"] ?? 0));
                                }
                            }

                            if (beatmapData.TryGetValue("_envColorRight", out var envColorRight))
                            {
                                if (envColorRight.Children().Count() == 3)
                                {
                                    diffEnvRight = new MapColor(
                                        (float)(envColorRight["r"] ?? 0),
                                        (float)(envColorRight["g"] ?? 0),
                                        (float)(envColorRight["b"] ?? 0));
                                }
                            }

                            if (beatmapData.TryGetValue("_envColorLeftBoost", out var envColorLeftBoost))
                            {
                                if (envColorLeftBoost.Children().Count() == 3)
                                {
                                    diffEnvLeftBoost = new MapColor(
                                        (float)(envColorLeftBoost["r"] ?? 0),
                                        (float)(envColorLeftBoost["g"] ?? 0),
                                        (float)(envColorLeftBoost["b"] ?? 0));
                                }
                            }

                            if (beatmapData.TryGetValue("_envColorRightBoost", out var envColorRightBoost))
                            {
                                if (envColorRightBoost.Children().Count() == 3)
                                {
                                    diffEnvRightBoost = new MapColor(
                                        (float)(envColorRightBoost["r"] ?? 0),
                                        (float)(envColorRightBoost["g"] ?? 0),
                                        (float)(envColorRightBoost["b"] ?? 0));
                                }
                            }

                            if (beatmapData.TryGetValue("_obstacleColor", out var obColor))
                            {
                                if (obColor.Children().Count() == 3)
                                {
                                    diffObstacle = new MapColor(
                                        (float)(obColor["r"] ?? 0),
                                        (float)(obColor["g"] ?? 0),
                                        (float)(obColor["b"] ?? 0));
                                }
                            }

                            if (beatmapData.TryGetValue("_warnings", out var warnings))
                            {
                                diffWarnings.AddRange(((JArray)warnings).Select(c => (string)c));
                            }

                            if (beatmapData.TryGetValue("_information", out var information))
                            {
                                diffInfo.AddRange(((JArray)information).Select(c => (string)c));
                            }

                            if (beatmapData.TryGetValue("_suggestions", out var suggestions))
                            {
                                diffSuggestions.AddRange(((JArray)suggestions).Select(c => (string)c));
                            }

                            if (beatmapData.TryGetValue("_requirements", out var requirements))
                            {
                                diffRequirements.AddRange(((JArray)requirements).Select(c => (string)c));
                            }
                        }

                        RequirementData diffReqData = new RequirementData
                        {
                            _requirements = diffRequirements.ToArray(),
                            _suggestions  = diffSuggestions.ToArray(),
                            _information  = diffInfo.ToArray(),
                            _warnings     = diffWarnings.ToArray()
                        };

                        diffData.Add(new DifficultyData
                        {
                            _beatmapCharacteristicName = setCharacteristic,
                            _difficulty              = diffDifficulty,
                            _difficultyLabel         = diffLabel,
                            additionalDifficultyData = diffReqData,
                            _colorLeft          = diffLeft,
                            _colorRight         = diffRight,
                            _envColorLeft       = diffEnvLeft,
                            _envColorRight      = diffEnvRight,
                            _envColorLeftBoost  = diffEnvLeftBoost,
                            _envColorRightBoost = diffEnvRightBoost,
                            _obstacleColor      = diffObstacle
                        });
                    }
                }

                _difficulties = diffData.ToArray();
            }
            catch (Exception ex)
            {
                Logging.Logger.Error($"Error in Level {songPath}:");
                Logging.Logger.Error(ex);
            }
        }