Ejemplo n.º 1
0
        /// <summary>
        /// 上方互換候補の除外処理.
        /// </summary>
        /// <param name="done">条件を満たすセットが見つかった装備</param>
        /// <param name="searchReport">現状の検索状況</param>
        public override void RemoveUpwardCompatibility(PartDataBase done, SearchReport searchReport)
        {
            // この処理が呼ばれている時点で、引数に渡された護石で実現可能セットが見つかっている為
            // 同じ護石のより上位の護石で対象スキルがオーバーする場合、その護石をリストから除く.
            // 例)
            // 引数が攻撃の護石Ⅰで、現状のセットで攻撃スキルが1だけ不足している場合
            // 攻撃の護石Ⅱ以上の検索は不要.

            // 上記が前提だが、実際には検索順序で護石は最下位にしてあるので、
            // ※ GetUnsettledPartListの順序で最も後方になっているはず.
            // 護石を検索する時点で護石以外の候補は残っておらず、
            // 引数の護石で条件を満たすセットが見つかったのであれば、
            // 同じIDのより上位の護石は無条件で無効にしても問題ないはず.

            var doneAmulet = done as PartDataAmulet;

            for (var i = 0; i < this.GetCount(); i++)
            {
                var candidate       = this.GetAt(i);
                var candidateAmulet = candidate.PartData as PartDataAmulet;

                // 同じシリーズでよりLvが高い護石があれば.
                if (null != doneAmulet &&
                    null != candidateAmulet &&
                    null != doneAmulet.Master &&
                    null != candidateAmulet.Master &&
                    doneAmulet.Master.AmulteId == candidateAmulet.Master.AmulteId &&
                    doneAmulet.Master.AmulteLv < candidateAmulet.Master.AmulteLv)
                {
                    candidate.Enable = false;
                }
            }
        }
Ejemplo n.º 2
0
 public virtual void report(SearchReport report, string context)
 {
     yarpPINVOKE.SearchMonitor_report(swigCPtr, SearchReport.getCPtr(report), context);
     if (yarpPINVOKE.SWIGPendingException.Pending)
     {
         throw yarpPINVOKE.SWIGPendingException.Retrieve();
     }
 }
Ejemplo n.º 3
0
 public virtual void reportToMonitor(SearchReport report)
 {
     yarpPINVOKE.Searchable_reportToMonitor(swigCPtr, SearchReport.getCPtr(report));
     if (yarpPINVOKE.SWIGPendingException.Pending)
     {
         throw yarpPINVOKE.SWIGPendingException.Retrieve();
     }
 }
        /// <summary>
        /// 検索中の状態レポートを生成する.
        /// </summary>
        /// <param name="searchSet"></param>
        /// <returns></returns>
        private SearchReport CreateSearchReport(SearchSet searchSet)
        {
            var searchReport = new SearchReport();

            // 要求されているシリーズスキルリスト.
            var needSeriesList = this.Requirements.RequirementSkillList.SeriesList;

            // 必要シリーズスキルを一つずつチェックする.
            foreach (var needSeries in needSeriesList)
            {
                // 発動しているかどうかをチェック.
                var count = searchSet.GetSeriesCount(needSeries.Index);
                if (needSeries.Skill.Need <= count)
                {
                    // 満たしているスキルに登録.
                    searchReport.SatisfyList.Add(needSeries.Index);
                }
                else
                {
                    // 満たしていないスキルに登録.
                    searchReport.UnsatisfyList.Add(needSeries.Index);
                    searchReport.UnsatisfyBaseList.Add(new SkillBase(
                                                           needSeries.Index,
                                                           needSeries.Skill.Need - count));
                }
            }

            // 要求されているスキルリスト.
            var needSkillList = this.Requirements.RequirementSkillList.SkillList;

            // 必要スキルを一つずつチェックする.
            foreach (var needSkill in needSkillList)
            {
                // 検索セットが必要スキルLvを満たしている場合.
                var sumLv = searchSet.GetSkillLvSum(needSkill.Index);
                if (needSkill.Lv <= sumLv)
                {
                    // 満たしているスキルに登録.
                    searchReport.SatisfyList.Add(needSkill.Index);
                }
                else
                {
                    // 満たしていないスキルに登録.
                    searchReport.UnsatisfyList.Add(needSkill.Index);
                    searchReport.UnsatisfyBaseList.Add(new SkillBase(
                                                           needSkill.Index,
                                                           needSkill.Lv - sumLv));
                }
            }

            // 空き、不足スロット状況を格納.
            searchSet.GetBlankSlot(searchReport.BlankSlotList, searchReport.LackSlotList);

            // 生成したリポートを返す.
            return(searchReport);
        }
Ejemplo n.º 5
0
        /// <summary>
        /// 抽象化防具データを取得.
        /// </summary>
        /// <param name="part">部位</param>
        /// <param name="searchReport">検索中の状態レポート</param>
        /// <returns>検索候補データ</returns>
        public CandidatePartBase GetArmorAbstract(Part part, SearchReport searchReport)
        {
            if (!this.OrgAbstractListDic.ContainsKey(part))
            {
                throw new ArgumentOutOfRangeException("part", part, null);
            }

            // 抽象化防具リストからさらに検索中の状態に合わせて絞り込んだリストを格納して返す.
            return(this.OrgAbstractListDic[part].Create(searchReport));
        }
        /// <summary>
        /// Log search report
        /// </summary>
        /// <param name="clientNumber"></param>
        /// <param name="totalInvoiceAmount"></param>
        /// <param name="serviceTax"></param>
        /// <param name="educationCess"></param>
        /// <param name="foreignRemittance"></param>
        /// <param name="wireTransferCharge"></param>
        /// <returns></returns>
        public SearchReport LogSearchReport(string clientNumber, double totalInvoiceAmount, double serviceTax, double educationCess, double foreignRemittance, double wireTransferCharge)
        {
            var validReport = new SearchReport()
            {
                ClientNumber = clientNumber,
                TotalInvoiceAmount = totalInvoiceAmount,
                ServiceTax = serviceTax,
                EducationCess = educationCess,
                ForeignRemittance = foreignRemittance,
                WireTransferCharge = wireTransferCharge
            };

            return validReport;
        }
        /// <summary>
        /// Get search fight report
        /// </summary>
        /// <param name="args"></param>
        /// <returns><see cref="SearchReport"/></returns>
        public async Task <SearchReport> ExecuteSearchFightAsync(List <string> args)
        {
            if (args is null || args.Count == 0)
            {
                throw new ArgumentException($"No args provided.");
            }
            var report = new SearchReport
            {
                SearchResults = await _searchService.GetResultsAsync(args)
            };

            report.SearchWinners     = _winnerService.GetWinnerBySearchEngine(report.SearchResults);
            report.SearchTotalWinner = _winnerService.GetTotalWinner(report.SearchWinners);
            return(report);
        }
Ejemplo n.º 8
0
        void WriteDocument(iTextSharp.text.Document doc, List <KeyValuePair <ISearchAlgorithm <string>, SearchReport <string> > > results, System.Drawing.Image initialGraph)
        {
            doc.AddCreationDate();
            doc.AddAuthor("GraphSEA");
            doc.AddCreator("GraphSEA");
            doc.AddHeader("Header", "GraphSEA - Graph search algorithms benchmark report");
            WriteHeader(doc);
            doc.NewPage();
            WriteGraph(doc, initialGraph, results[0].Value.Result.Start, results[0].Value.Result.End);
            doc.NewPage();
            WriteResultSummary(doc, results);
            doc.NewPage();
            // algorithms benchmarks
            foreach (var res in results)
            {
                CurrentReport = res.Value;
                WriteAlgorithmBenchmark(doc, res.Key, res.Value);
            }

            WriteTableOfContent(doc);
        }
Ejemplo n.º 9
0
    protected void DefaultSearch()
    {
        // reset the incident filters
        SearchReport.WhatHappened = "0";
        SearchReport.Location     = "0";
        SearchReport.MemberNo     = "0";
        SearchReport.ActionTaken  = "0";
        SearchReport.ReportId     = "";

        // counts the number of times ReadFiles method is called in Incident Report. It should only run one time (Run like an initial Post Back)
        Report.PopulateFields = true;
        // tells whether or not to run the editButton() in Default.aspx
        Report.RunEditMode = false;

        // set navigation tab to default list
        Report.CurrentNavigationTab = "1";

        // reset any filters selected
        SearchReport.ResetNavigation();

        // send the parameters to Default.aspx to populate the Gridview
        Response.Redirect("~/Default.aspx?ReportType=1&DateGroup=1&ReportStatus=1&Keyword=&Staff=", false);
    }
 public async Task WhenIEnterMySearchWordsAs(string querySearch)
 {
     results = await _reportService.ExecuteSearchFightAsync(ArgsHelper.ExtractArgs(querySearch));
 }
Ejemplo n.º 11
0
 /// <summary>
 /// 候補リストを生成.
 /// </summary>
 /// <returns></returns>
 public CandidatePartBase Create(SearchReport searchReport)
 {
     return(this.Creator.CreateCandidate(this.OrgList, searchReport));
 }
Ejemplo n.º 12
0
    protected void btnSubmit_Click(object sender, EventArgs e)
    {
        SearchReport.CreateReportReset(); // takes off the selected report in ddlCreateReport

        // get the last Report ID
        string   query = "SELECT MAX(ReportId) AS ReportId FROM dbo.Report_MerrylandsRSLCaretaker";
        int      lastRId, result, returnFlag = 2;
        DateTime temp, date = DateTime.Parse(DateTime.Now.ToShortDateString());

        Report.ErrorMessage = "";

        con.Open();
        SqlCommand getRId = new SqlCommand(query, con);

        try
        {
            lastRId = (int)getRId.ExecuteScalar();
            // add plus one to the current report id to be used in this report
            lastRId += 1;
        }
        catch
        {
            lastRId = 13000001;
        }
        con.Close();

        Report.LastReportId = lastRId.ToString();

        if (txtDatePicker.Text == "")
        {
            Report.ErrorMessage = Report.ErrorMessage + "\\n* Shift Date shouldn't be empty.";
            txtDatePicker.Focus();
            returnFlag = 1;
        }
        else if (!DateTime.TryParse(txtDatePicker.Text, out temp))
        {
            Report.ErrorMessage = Report.ErrorMessage + "\\n* Shifts Date entry is not in date format please select an appropriate date.";
            txtDatePicker.Focus();
            returnFlag = 1;
        }
        else if (DateTime.TryParse(txtDatePicker.Text, out temp))
        {
            // compare selected date to current date
            result = DateTime.Compare(DateTime.Parse(DateTime.Parse(txtDatePicker.Text).ToShortDateString()), date);
            if (result > 0)
            {
                Report.ErrorMessage = Report.ErrorMessage + "\\n* DATE MUST BE BEFORE CURRENT DATE.";
                txtDatePicker.Focus();
                returnFlag = 1;
            }
        }

        if (returnFlag == 1)
        {
            ScriptManager.RegisterStartupScript(this, GetType(), "ServerControlScript", "alert(\"" + Report.ErrorMessage + "\");", true);
            return;
        }

        // change the format of the shift date to timestamp format
        DateTime shift_date  = DateTime.Parse(txtDatePicker.Text);
        string   shift_tDate = shift_date.ToString("yyyyMMdd");

        // separate the shift date day of week value
        string shift_DOW = shift_date.DayOfWeek.ToString();

        // change the format of the entry date to timestamp format
        DateTime entry_date = DateTime.Now;

        // pop a message if shift is unchanged
        //if (ddlShift.SelectedItem.Value == "-1")
        //{
        //    showAlert("Please select Shift.");
        //    ddlShift.Focus();
        //    return;
        //}

        // get staff's id
        string cmdText  = "SELECT StaffId FROM Staff WHERE Username = '******'",
               variable = "getStaff";

        readFiles(cmdText, variable);

        // store in a string all the selected item in the checkboxlist
        // Create the list to store.
        List <String> YrStrList1 = new List <string>();

        // Loop through each item.
        foreach (ListItem item in List_Location.Items)
        {
            if (item.Selected)
            {
                // If the item is selected, add the value to the list.
                YrStrList1.Add(item.Value);
            }
        }
        // Join the string together using the ; delimiter.
        string Location = String.Join(",", YrStrList1.ToArray());

        if (!Location.Equals(""))
        {
            Location += ",";
        }


        // insert data to table
        using (DataClassesDataContext dc = new DataClassesDataContext())
        {
            Report_MerrylandsRSLCaretaker dm = new Report_MerrylandsRSLCaretaker();
            dm.ReportId = Int32.Parse(Report.LastReportId);
            dm.RCatId   = 13; // Customer Relations Officer Category
            dm.StaffId  = Int32.Parse(Session["currentStaffId"].ToString());
            //dm.ShiftId = Int32.Parse(ddlShift.SelectedItem.Value);
            dm.StaffName       = UserCredentials.DisplayName;
            dm.ShiftDate       = shift_date.Date;
            dm.ShiftDOW        = shift_DOW;
            dm.EntryDate       = entry_date;
            dm.Report_Table    = "Report_MerrylandsRSLCaretaker";
            dm.AuditVersion    = 1;
            dm.ReportStat      = "Awaiting Completion";
            dm.Report_Version  = 1; // current version
            dm.ReadByList      = "," + UserCredentials.StaffId + ",";
            dm.Spare1          = Location;
            dm.Occupancy       = txtOccupancy.Text.Replace("\n", "<br />").Replace("'", "^");
            dm.Maintenance     = txtMaintenance.Text.Replace("\n", "<br />").Replace("'", "^");
            dm.GeneralComments = txtGeneralComments.Text.Replace("\n", "<br />").Replace("'", "^");
            dc.Report_MerrylandsRSLCaretakers.InsertOnSubmit(dm);
            dc.SubmitChanges();
        }

        //log the create activity
        RunStoredProcedure rsp = new RunStoredProcedure();

        try
        {
            rsp.Log(4, Int32.Parse(Report.LastReportId));
        }
        catch { }

        //showAlert("Report Submitted.");
        //Response.Redirect("Default.aspx", false);
        ScriptManager.RegisterStartupScript(this, this.GetType(), "redirect",
                                            "alert('Report Submitted.'); window.location='" +
                                            Request.ApplicationPath + "Default.aspx';", true);
        SearchReport.SetAccordion     = "1";
        SearchReport.RunOnStart       = true;
        SearchReport.FromCreateReport = true;
    }
Ejemplo n.º 13
0
        public void BenchmarkSimulation()
        {
            try
            {
                benchmarking = true;
                this.Invoke(new Action(delegate
                {
                    _gArea.ResetNodesColor();
                    tracetxt.Text = "";
                }));
                benchmarks.Clear();
                Node <string> initial = (start_node.SelectedItem as ComboBoxItem).Tag as Node <string>;
                Node <string> final   = (goal_node.SelectedItem as ComboBoxItem).Tag as Node <string>;
                initialGraph = ScreenshotGraphView();
                this.Invoke(new Action(delegate
                {
                    _gArea.ResetInitialGoal();
                    _gArea.SetInitialGoal(initial, final);
                }));
                // set event handlers
                simulation_thread = new Thread(new ThreadStart(delegate
                {
                    try
                    {
                        this.Invoke(new Action(delegate
                        {
                            buttonX2.Enabled = false;
                            buttonX1.Enabled = false;
                        }));

                        foreach (var selected_algorithm in salgos)
                        {
                            this.Invoke(new Action(delegate
                            {
                                selected_algorithm.Logged = false;
                            }));
                            selected_algorithm.OnResultFound   += Selected_algorithm_OnResultFound;
                            selected_algorithm.OnResetRequired += Selected_algorithm_OnResetRequired;

                            selected_algorithm.Initialize();
                            current_report           = new SearchReport <string>();
                            SearchResult <string> sr = null;


                            sr = selected_algorithm.Search(initial, final.Key);
                            benchmarks.Add(
                                new KeyValuePair <ISearchAlgorithm <string>, SearchReport <string> >(
                                    selected_algorithm,
                                    current_report));
                            current_report.Result = sr;
                            current_report.Timer.Start();
                            selected_algorithm.SearchClean(initial, final.Key);
                            current_report.Timer.Stop();



                            current_report.Steps.Add(new SearchStep <string>
                            {
                                StepInformation =
                                    new KeyValuePair <INode <string>, NodeVisitAction>(null, NodeVisitAction.Reset)
                            });
                            current_report.ElapsedTime          = current_report.Timer.Elapsed;
                            selected_algorithm.OnResultFound   -= Selected_algorithm_OnResultFound;
                            selected_algorithm.OnResetRequired -= Selected_algorithm_OnResetRequired;
                        }
                        this.Invoke(new Action(delegate
                        {
                            simulation_thread = null;
                            DumpToReport();
                        }));
                    }
                    catch (Exception ex)
                    {
                        this.Invoke(new Action(delegate
                        {
                            MessageBoxEx.Show(this, ex.Message, "Benchmark Simulation Process",
                                              System.Windows.Forms.MessageBoxButtons.OK,
                                              System.Windows.Forms.MessageBoxIcon.Error);
                        }));
                    }
                    this.Invoke(new Action(delegate
                    {
                        buttonX2.Enabled = true;
                        buttonX1.Enabled = true;
                        benchmarking     = false;
                        MessageBoxEx.Show(this, "Benchmark successfully completed", "Benchmark simulation",
                                          MessageBoxButtons.OK, MessageBoxIcon.Information);
                    }));
                }));
                simulation_thread.Start();
                //simulation_thread.Join();
            }
            catch (Exception ex)
            {
                MessageBoxEx.Show(this, ex.Message, "Benchmark Simulation Execution", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error);
            }
        }
        /// <summary>
        /// 検索中の状態レポートを生成する.
        /// </summary>
        /// <param name="searchSet"></param>
        /// <returns></returns>
        private SearchReport CreateSearchReport(SearchSet searchSet)
        {
            var searchReport = new SearchReport();

            // スキルの評価.
            {
                // 要求されているシリーズスキルリスト.
                var needSeriesList = this.Requirements.RequirementSkillList.SeriesList;

                // 必要シリーズスキルを一つずつチェックする.
                foreach (var needSeries in needSeriesList)
                {
                    // 発動しているかどうかをチェック.
                    var count = searchSet.GetSeriesCount(needSeries.Index);
                    if (needSeries.Skill.Need <= count)
                    {
                        // 満たしているスキルに登録.
                        searchReport.SatisfyList.Add(needSeries.Index);
                    }
                    else
                    {
                        // 満たしていないスキルに登録.
                        searchReport.UnsatisfyList.Add(needSeries.Index);
                        searchReport.UnsatisfyBaseList.Add(new SkillBase(
                                                               needSeries.Index,
                                                               needSeries.Skill.Need - count));
                    }
                }

                // 要求されているスキルリスト.
                var needSkillList = this.Requirements.RequirementSkillList.SkillList;

                // 必要スキルを一つずつチェックする.
                foreach (var needSkill in needSkillList)
                {
                    // 検索セットが必要スキルLvを満たしている場合.
                    var sumLv = searchSet.GetSkillLvSum(needSkill.Index);
                    if (needSkill.Lv <= sumLv)
                    {
                        // 満たしているスキルに登録.
                        searchReport.SatisfyList.Add(needSkill.Index);
                    }
                    else
                    {
                        // 満たしていないスキルに登録.
                        searchReport.UnsatisfyList.Add(needSkill.Index);
                        searchReport.UnsatisfyBaseList.Add(new SkillBase(
                                                               needSkill.Index,
                                                               needSkill.Lv - sumLv));
                    }
                }
            }

            // スロットの評価.
            {
                // 現在のセットが装備している全てのスロットのLvリスト
                var equippedSlotLvList = searchSet.GetEquippedSlotLvList();

                // 必要スロットリスト
                var needBlankSlotList = this.CandidateSet.GetNeedBlankSlotLvList();
                var needSlotLvList    = searchSet.Accessory.GetNeedSlotLvListWithNeedBlank(needBlankSlotList);

                // 装備スロットを下位Lvから走査.
                // 必要スロットLvと装備スロットLvを低いほうから順番に比較して、
                // 必要スロットLv <= 装備スロットLvであれば格納可能と判定する.
                var needIndex = 0;
                foreach (var equippedLv in equippedSlotLvList)
                {
                    // 必要スロットがまだ残っていてかつ装備Lvが必要Lvを超えていれば装備可能.
                    if (needIndex < needSlotLvList.Count &&
                        needSlotLvList[needIndex] <= equippedLv)
                    {
                        // 装備可能なので必要Indexを進める.
                        needIndex++;
                    }
                }

                // 残っている必要スロットを不足リストに追加.
                for (; needIndex < needSlotLvList.Count; needIndex++)
                {
                    searchReport.LackSlotList.Add(needSlotLvList[needIndex]);
                }
            }

            // 生成したリポートを返す.
            return(searchReport);
        }
        /// <summary>
        /// 再帰検索処理.
        /// </summary>
        /// <param name="resultData">結果を格納</param>
        /// <param name="uppserSet">上位検索セット</param>
        /// <param name="remainingPartList">残未確定部位リスト</param>
        /// <param name="abstractArmorMode">仮想防具モードかどうか</param>
        /// <param name="upperReport">上位検索状況情報</param>
        /// <param name="nest">再帰階層</param>
        /// <param name="pBegin">この処理の開始時点の進捗</param>
        /// <param name="pEnd">この処理の終了時点の進捗</param>
        /// <returns>この処理で確定したセットの数(マイナスの場合は処理中断)</returns>
        private int RecursionSearch(ResultData resultData, SearchSet uppserSet, SearchReport upperReport, List <PartDataBase> remainingPartList, bool abstractArmorMode, int nest, int pBegin, int pEnd)
        {
            // 呼び出され回数をインクリメント
            this.TotalCalled++;

            // 階層をインクリメント.
            var curNest = nest + 1;

            // キャンセルされたか調べる
            if (this.IsCancel())
            {
                // キャンセルされたとき
                return(-1);
            }

            // ネストで見つかった確定セット数を格納する.
            var determined = 0;

            // この処理での進捗幅.
            var partUnit = pEnd - pBegin;

            // このネストで検索する部位.
            var part = remainingPartList.ElementAt(0);

            // 残りの部位.
            var unsettledPartList = remainingPartList.ToList();

            unsettledPartList.RemoveAt(0);

            // 候補装備リスト管理データを作成.
            var candidateListCtrl = abstractArmorMode
                ? this.CandidateSet.GetArmorAbstract(part.Part, upperReport)
                : this.CandidateSet.GetCandidate(part.Part, upperReport);

            // 候補装備数.
            var allCount = candidateListCtrl.GetCount();

            // 検索セットを複製.
            var searchSet = new SearchSet(uppserSet);

            // 装備毎に走査.
            // 進捗管理の為に i が必要.
            for (var i = 0; i < allCount; i++)
            {
                var candidateData = candidateListCtrl.GetAt(i);

                // 無効装備は無視.
                if (null == candidateData || !candidateData.Enable)
                {
                    continue;
                }

                // 候補装備.
                var candidate = candidateData.PartData;

                // 進捗の最小単位を計算.
                var begin = pBegin;
                var end   = pBegin;
                if (0 < partUnit)
                {
                    // 候補装備毎の進捗単位を計算.
                    // 要素数を取得.
                    var candidateUnit = partUnit / allCount;
                    if (0 < candidateUnit)
                    {
                        begin = pBegin + (i * candidateUnit);
                        end   = begin + candidateUnit;
                    }
                }

                // 新たな候補をセットして.
                searchSet.SetPart(part.Part, candidate);

                // 検索数上限に到達しているかどうかをチェック.
                if (0 < Ssm.Config.SerchLimitCount &&
                    Ssm.Config.SerchLimitCount <= resultData.GetSatisfiedCount())
                {
                    Log.Write("検索結果上限[{0}件]に到達したので処理中断".Fmt(Ssm.Config.SerchLimitCount));
                    break;
                }

                // 検索状況リポートを生成.
                var searchReport = this.CreateSearchReport(searchSet);

                // 現状のセットが検索条件を満たすかどうかチェック.
                // スキルが要求を満たしている場合.
                if (!searchReport.UnsatisfyList.Any())
                {
                    ////////////////
                    // スキル満足 //
                    ////////////////

                    // スロットが必要数を満たしている場合.
                    if (!searchReport.LackSlotList.Any())
                    {
                        //////////
                        // 完成 //
                        //////////
                        resultData.AddSatisfiedSet(new ResultSet(searchSet));
                        determined += 1;

                        // 上位互換装備を候補リストから除く.
                        candidateListCtrl.RemoveUpwardCompatibility(candidate, searchReport);
                        continue;
                    }

                    // スロットが不足している場合、下記条件のいずれかにヒットしたら検索終了
                    // ・未確定防具が残っていない場合.
                    // ・抽象化防具を使用しない場合.
                    var abstractPartList = searchSet.GetUnsettledArmorList();
                    if (!abstractPartList.Any() || !Ssm.Config.UseArmorAbstract)
                    {
                        //////////////////////////
                        // スロット不足 → 終了 //
                        //////////////////////////

                        // 解析を実施する場合は解析結果に追加.
                        if (this.AnalyzeFactors)
                        {
                            // スロット不足で不十分な組み合わせ.
                            resultData.AddShortageSlot(searchReport.GetLackSlotKey(), new ResultSet(searchSet));
                        }

                        // これ以上の検索は不要.
                        continue;
                    }

                    //////////////////////////////////////////
                    // スロット不足 → 抽象化防具検索モード //
                    //////////////////////////////////////////
                    // >>>>再帰呼び出し<<<< //
                    // 検索処理を再帰呼び出し.
                    var result = this.RecursionSearch(resultData, searchSet, searchReport, abstractPartList, true, curNest, begin, end);
                    // >>>>再帰呼び出し<<<<

                    // 条件を満たす組み合わせが見つかった場合.
                    if (0 < result)
                    {
                        // 結果に登録.
                        determined += result;
                    }
                    else if (result < 0)
                    {
                        // 処理中断の場合.
                        return(result);
                    }
                }
                else
                {
                    ////////////////
                    // スキル不足 //
                    ////////////////

                    // 残りの部位が残っていない場合はスキル不足で不十分な組み合わせ.
                    if (!unsettledPartList.Any())
                    {
                        // 下記の条件を全て満たしている場合は解析結果に登録.
                        // ・不足しているスキルが一つ
                        // ・スロットは満たしている
                        // ・解析を実施する場合.
                        if (this.AnalyzeFactors &&
                            !searchReport.LackSlotList.Any() &&
                            1 == searchReport.UnsatisfyList.Count)
                        {
                            // スキル不足で不十分な組み合わせ.
                            resultData.AddShortageSkill(searchReport.GetUnsatisfyKey(), new ResultSet(searchSet));
                        }

                        // これ以上の検索は不要.
                        continue;
                    }

                    //////////////////////////////////
                    // スキル不足 → 通常検索モード //
                    //////////////////////////////////
                    // >>>>再帰呼び出し<<<<
                    // 検索処理を再帰呼び出し.
                    var result = this.RecursionSearch(resultData, searchSet, searchReport, unsettledPartList, false, curNest, begin, end);
                    // >>>>再帰呼び出し<<<<

                    // 条件を満たす組み合わせが見つかった場合.
                    if (0 < result)
                    {
                        // 結果に登録.
                        determined += result;
                    }
                    else if (result < 0)
                    {
                        // 処理中断の場合.
                        return(result);
                    }
                }
            }

            // 進捗を更新.
            if (0 < partUnit)
            {
                this.SetProgress((int)pEnd);
            }

            return(determined);
        }
Ejemplo n.º 16
0
        /// <summary>
        /// 候補装備データのファクトリ.
        /// </summary>
        /// <param name="orgList">オリジナル検索候補リスト</param>
        /// <param name="searchReport">検索中の状態レポート</param>
        /// <returns></returns>
        public override CandidatePartBase CreateCandidate(List <PartDataBase> orgList, SearchReport searchReport)
        {
            // 既に条件を満たしたスキルを持った装飾品が含まれた組み合わせはリストから除外する.
            var filteredList = orgList
                               .Where(candidate =>
            {
                return(!candidate.GetSkillList()
                       .Select(skill => skill.Index)
                       .Any(searchReport.SatisfyList.Contains));
            })
                               .Select(candidate => new CandidateData(true, candidate))
                               .ToList();

            // 検索に使用するリストを格納して返す.
            return(new CandidateAccessory(filteredList));
        }
Ejemplo n.º 17
0
 internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SearchReport obj)
 {
     return((obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr);
 }
Ejemplo n.º 18
0
    protected void btnSubmit_Click(object sender, EventArgs e)
    {
        SearchReport.CreateReportReset(); // takes off the selected report in ddlCreateReport

        // get the last Report ID
        string   query = "SELECT MAX(ReportId) AS ReportId FROM dbo.Report_MerrylandsRSLReception";
        int      lastRId, result, returnFlag = 2;
        DateTime temp, date = DateTime.Parse(DateTime.Now.ToShortDateString());

        Report.ErrorMessage = "";

        con.Open();
        SqlCommand getRId = new SqlCommand(query, con);

        try
        {
            lastRId = (int)getRId.ExecuteScalar();
            // add plus one to the current report id to be used in this report
            lastRId += 1;
        }
        catch
        {
            lastRId = 6000001;
        }
        con.Close();

        Report.LastReportId = lastRId.ToString();

        if (txtDatePicker.Text == "")
        {
            Report.ErrorMessage = Report.ErrorMessage + "\\n* Shift Date shouldn't be empty.";
            txtDatePicker.Focus();
            returnFlag = 1;
        }
        else if (!DateTime.TryParse(txtDatePicker.Text, out temp))
        {
            Report.ErrorMessage = Report.ErrorMessage + "\\n* Shifts Date entry is not in date format please select an appropriate date.";
            txtDatePicker.Focus();
            returnFlag = 1;
        }
        else if (DateTime.TryParse(txtDatePicker.Text, out temp))
        {
            // compare selected date to current date
            result = DateTime.Compare(DateTime.Parse(DateTime.Parse(txtDatePicker.Text).ToShortDateString()), date);
            if (result > 0)
            {
                Report.ErrorMessage = Report.ErrorMessage + "\\n* DATE MUST BE BEFORE CURRENT DATE.";
                txtDatePicker.Focus();
                returnFlag = 1;
            }
        }

        //if (txtSpecialComments.Text == "")
        //{
        //    Report.ErrorMessage = Report.ErrorMessage + "\\n* COVID-19 section shouldn't be empty.";
        //    txtSpecialComments.Focus();
        //    returnFlag = 1;
        //}

        if (returnFlag == 1)
        {
            ScriptManager.RegisterStartupScript(this, GetType(), "ServerControlScript", "alert(\"" + Report.ErrorMessage + "\");", true);
            return;
        }

        // change the format of the shift date to timestamp format
        DateTime shift_date  = DateTime.Parse(txtDatePicker.Text);
        string   shift_tDate = shift_date.ToString("yyyyMMdd");

        // separate the shift date day of week value
        string shift_DOW = shift_date.DayOfWeek.ToString();

        // change the format of the entry date to timestamp format
        DateTime entry_date = DateTime.Now;

        // pop a message if shift is unchanged
        if (ddlShift.SelectedItem.Value == "-1")
        {
            showAlert("Please select Shift.");
            ddlShift.Focus();
            return;
        }

        // get staff's id
        string cmdText  = "SELECT StaffId FROM Staff WHERE Username = '******'",
               variable = "getStaff";

        readFiles(cmdText, variable);

        // insert data to table
        using (DataClassesDataContext dc = new DataClassesDataContext())
        {
            Report_MerrylandsRSLReception dm = new Report_MerrylandsRSLReception();
            dm.ReportId        = Int32.Parse(Report.LastReportId);
            dm.RCatId          = 6; // MR Reception Category
            dm.StaffId         = Int32.Parse(Session["currentStaffId"].ToString());
            dm.StaffName       = UserCredentials.DisplayName;
            dm.ShiftId         = Int32.Parse(ddlShift.SelectedItem.Value);
            dm.ShiftDate       = shift_date.Date;
            dm.ShiftDOW        = shift_DOW;
            dm.EntryDate       = entry_date;
            dm.Report_Table    = "Report_MerrylandsRSLReception";
            dm.AuditVersion    = 1;
            dm.ReportStat      = "Awaiting Completion";
            dm.Report_Version  = 2; // current version
            dm.ReadByList      = "," + UserCredentials.StaffId + ",";
            dm.SignInSlip      = txtSignInSlip.Text.Replace("\n", "<br />").Replace("'", "^");
            dm.Refusals        = txtRefusals.Text.Replace("\n", "<br />").Replace("'", "^");
            dm.EventsField     = txtEventsField.Text.Replace("\n", "<br />").Replace("'", "^");
            dm.GeneralComments = txtGeneralComms.Text.Replace("\n", "<br />").Replace("'", "^");
            dm.SpecialComments = txtSpecialComments.Text.Replace("\n", "<br />").Replace("'", "^");
            dc.Report_MerrylandsRSLReceptions.InsertOnSubmit(dm);
            dc.SubmitChanges();
        }

        //log the create activity
        RunStoredProcedure rsp = new RunStoredProcedure();

        try
        {
            rsp.Log(4, Int32.Parse(Report.LastReportId));
        }
        catch { }

        //showAlert("Report Submitted.");
        //Response.Redirect("Default.aspx", false);
        ScriptManager.RegisterStartupScript(this, this.GetType(), "redirect",
                                            "alert('Report Submitted.'); window.location='" +
                                            Request.ApplicationPath + "Default.aspx';", true);
        SearchReport.SetAccordion     = "1";
        SearchReport.RunOnStart       = true;
        SearchReport.FromCreateReport = true;
    }
Ejemplo n.º 19
0
        /// <summary>
        /// 候補装備データのファクトリ.
        /// </summary>
        /// <param name="orgList">オリジナル検索候補リスト</param>
        /// <param name="searchReport">検索中の状態レポート</param>
        /// <returns></returns>
        public override CandidatePartBase CreateCandidate(List <PartDataBase> orgList, SearchReport searchReport)
        {
            // フィルタリング処理不要.
            var filteredList = orgList
                               .Select(candidate => new CandidateData(true, candidate))
                               .ToList();

            // フィルタリング処理不要(複製だけしておく).
            return(new CandidateWepon(filteredList));
        }
Ejemplo n.º 20
0
 public virtual void report(SearchReport report, string context)
 {
     yarpPINVOKE.SearchMonitor_report(swigCPtr, SearchReport.getCPtr(report), context);
     if (yarpPINVOKE.SWIGPendingException.Pending) throw yarpPINVOKE.SWIGPendingException.Retrieve();
 }
Ejemplo n.º 21
0
 public virtual void reportToMonitor(SearchReport report)
 {
     yarpPINVOKE.Searchable_reportToMonitor(swigCPtr, SearchReport.getCPtr(report));
     if (yarpPINVOKE.SWIGPendingException.Pending) throw yarpPINVOKE.SWIGPendingException.Retrieve();
 }
        /// <summary>
        /// 候補装備データのファクトリ.
        /// </summary>
        /// <param name="orgList">オリジナル検索候補リスト</param>
        /// <param name="searchReport">検索中の状態レポート</param>
        /// <returns></returns>
        public override CandidatePartBase CreateCandidate(List <PartDataBase> orgList, SearchReport searchReport)
        {
            // オリジナル候補リストをさらに絞り込んでリスト化.
            var filteredList = orgList
                               .Where(candidate =>
            {
                // 不足スロットを越えるスロットを持つ防具は除外する.
                var equippedSlot = new List <int>();
                candidate.GetEquippedSlot(equippedSlot);

                // スロット数が超える場合は助長.
                if (searchReport.LackSlotList.Count < equippedSlot.Count)
                {
                    return(false);
                }

                // 不足スロットよりLvの高いスロットを持つ防具も助長
                for (var i = 0; i < equippedSlot.Count; i++)
                {
                    if (searchReport.LackSlotList[i] < equippedSlot[i])
                    {
                        return(false);
                    }
                }

                return(true);
            })
                               .Select(candidate => new CandidateData(true, candidate))
                               .ToList();

            // 1件目に候補なしを挿入しておく.
            filteredList.Insert(0, new CandidateData(true, new PartDataArmor(this.Part, PartState.NotExist)));

            // 検索に使用するリストを格納して返す.
            return(new CandidateArmorAbstract(this.Part, filteredList));
        }
Ejemplo n.º 23
0
 internal static HandleRef getCPtr(SearchReport obj)
 {
     return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
 }
Ejemplo n.º 24
0
        void WriteAlgorithmBenchmark(iTextSharp.text.Document doc, ISearchAlgorithm <string> algorithm, SearchReport <string> report)
        {
            iTextSharp.text.pdf.draw.LineSeparator line = new iTextSharp.text.pdf.draw.LineSeparator(1f, 100f, iTextSharp.text.BaseColor.BLACK, iTextSharp.text.Element.ALIGN_CENTER, -1);
            iTextSharp.text.Chunk linebreak             = new iTextSharp.text.Chunk(line);
            Chunk c = new Chunk(algorithm.Name, new iTextSharp.text.Font(iTextSharp.text.Font.FontFamily.TIMES_ROMAN, 24, iTextSharp.text.Font.BOLD, iTextSharp.text.BaseColor.BLUE));

            c.SetGenericTag(algorithm.Name);
            doc.Add(new Paragraph(c));
            // algorithm description
            Chunk desc = new Chunk(algorithm.Description, new iTextSharp.text.Font(iTextSharp.text.Font.FontFamily.TIMES_ROMAN, 12, iTextSharp.text.Font.ITALIC, iTextSharp.text.BaseColor.BLACK));

            doc.Add(new Paragraph(desc));
            // algorithm benchmark
            Chunk time = new Chunk("The algorithm took " + report.ElapsedTime + " to find the goal.", new iTextSharp.text.Font(iTextSharp.text.Font.FontFamily.TIMES_ROMAN, 12, iTextSharp.text.Font.BOLDITALIC, iTextSharp.text.BaseColor.BLACK));

            doc.Add(new Paragraph(time));

            // path
            time = new Chunk("The result path costs " + algorithm.CalculateCost(report.Result), new iTextSharp.text.Font(iTextSharp.text.Font.FontFamily.TIMES_ROMAN, 12, iTextSharp.text.Font.BOLDITALIC, iTextSharp.text.BaseColor.BLACK));
            doc.Add(new Paragraph(time));
            // write steps
            foreach (var step in report.Steps)
            {
                WriteAlgorithmStep(doc, step.StepInformation, step.GraphCapture);
            }

            doc.NewPage();
        }
Ejemplo n.º 25
0
        /// <summary>
        /// 候補装備データのファクトリ.
        /// </summary>
        /// <param name="orgList">オリジナル検索候補リスト</param>
        /// <param name="searchReport">検索中の状態レポート</param>
        /// <returns></returns>
        public override CandidatePartBase CreateCandidate(List <PartDataBase> orgList, SearchReport searchReport)
        {
            // 条件を満たしていないスキルを持つ防具に絞る.
            var filteredList = orgList
                               .Where(candidate =>
            {
                return(candidate.GetSkillList()
                       .Any(skill => searchReport.UnsatisfyList.Contains(skill.Index)));
            })
                               .Select(candidate => new CandidateData(true, candidate))
                               .ToList();

            // 1件目に未確定を挿入.
            filteredList.Insert(0, new CandidateData(true, new PartDataAmulet()));

            // 検索に使用するリストを格納して返す.
            return(new CandidateAmulet(filteredList));
        }
Ejemplo n.º 26
0
 public void DisplayReport(SearchReport report)
 {
     PrintSearchResults(report.SearchResults);
     PrintWinnersBySearchengine(report.SearchWinners);
     PrintToltalWinner(report.SearchTotalWinner);
 }
 /// <summary>
 /// Print serch fight results
 /// </summary>
 /// <param name="report"></param>
 private void PrintResult(SearchReport report)
 {
     PrintSearchResults(report.SearchResults);
     PrintWinnersBySearchengine(report.SearchWinners);
     PrintToltalWinner(report.SearchTotalWinner);
 }
Ejemplo n.º 28
0
        /// <summary>
        /// 候補装備データのファクトリ.
        /// </summary>
        /// <param name="orgList">オリジナル検索候補リスト</param>
        /// <param name="searchReport">検索中の状態レポート</param>
        /// <returns></returns>
        public override CandidatePartBase CreateCandidate(List <PartDataBase> orgList, SearchReport searchReport)
        {
            // オリジナル候補リストをさらに絞り込んでリスト化.
            var filteredList = orgList
                               .Where(candidate =>
            {
                var armor = candidate as PartDataArmor;
                if (null == armor)
                {
                    return(false);
                }

                // シリーズスキルのリストも取得して加える
                var allSkillList = armor.GetSeriesList();
                allSkillList.AddRange(armor.GetSkillList());

                // 通常防具の場合、要求を満たしていないスキルを持つ防具以外は除外する.
                return(allSkillList
                       .Any(skill =>
                {
                    return searchReport.UnsatisfyList
                    .Contains(skill.Index);
                }));
            })
                               .Select(candidate => new CandidateData(true, candidate))
                               .ToList();

            // 1件目に未確定を挿入.
            filteredList.Insert(0, new CandidateData(true, new PartDataArmor(this.Part)));

            // 検索に使用するリストを格納して返す.
            return(new CandidateArmor(this.Part, filteredList));
        }