private StuGLSearch SetCompareString(StuGLSearch stuSearch00) { StuGLSearch stuReturn = stuSearch00; List <string> lstCompare = new List <string>(); //stuReturn.StrCompares = string.Empty; #region FieldMode if (stuReturn.FieldMode) { if (cmbCompare01.SelectedValue != "none") { lstCompare.Add(cmbCompare01.SelectedValue); } if (cmbCompare02.SelectedValue != "none") { lstCompare.Add(cmbCompare02.SelectedValue); } if (cmbCompare03.SelectedValue != "none") { lstCompare.Add(cmbCompare03.SelectedValue); } if (cmbCompare04.SelectedValue != "none") { lstCompare.Add(cmbCompare04.SelectedValue); } if (cmbCompare05.SelectedValue != "none") { lstCompare.Add(cmbCompare05.SelectedValue); } } #endregion FieldMode if (lstCompare.Count > 0) { lstCompare.Sort(); stuReturn.StrCompares = string.Join("#", lstCompare.Distinct()); stuReturn = new CglMethod().SetComparesDetail(stuReturn); } else { stuReturn.StrCompares = "gen"; stuReturn.StrComparesDetail = "none"; } return(stuReturn); }
private void StartThread01(StuGLSearch _gstuSearch) { if (localAction == Properties.Resources.SessionsFreqActiveHT01 || localAction == Properties.Resources.SessionsFreqActiveHT01P) { StuGLSearch stuGLSearchTemp = _gstuSearch; stuGLSearchTemp.FilterRange = true; stuGLSearchTemp.StrFilterRange = "1"; stuGLSearchTemp.SglFilterMin = 0; stuGLSearchTemp.SglFilterMax = 0; SetSearchOrder(stuGLSearchTemp, localAction, SetRequestId(stuGLSearchTemp), AspFileName, LocalIP, LocalBrowserType); stuGLSearchTemp.FilterRange = true; stuGLSearchTemp.StrFilterRange = "1#2"; stuGLSearchTemp.SglFilterMin = 0; stuGLSearchTemp.SglFilterMax = 0; SetSearchOrder(stuGLSearchTemp, localAction, SetRequestId(stuGLSearchTemp), AspFileName, LocalIP, LocalBrowserType); stuGLSearchTemp.FilterRange = true; stuGLSearchTemp.StrFilterRange = "2#3"; stuGLSearchTemp.SglFilterMin = 0; stuGLSearchTemp.SglFilterMax = 0; SetSearchOrder(stuGLSearchTemp, localAction, SetRequestId(stuGLSearchTemp), AspFileName, LocalIP, LocalBrowserType); stuGLSearchTemp.FilterRange = true; stuGLSearchTemp.StrFilterRange = "none"; stuGLSearchTemp.SglFilterMin = 1; stuGLSearchTemp.SglFilterMax = 1000; SetSearchOrder(stuGLSearchTemp, localAction, SetRequestId(stuGLSearchTemp), AspFileName, LocalIP, LocalBrowserType); } if (localAction == Properties.Resources.SessionsDataB || localAction == Properties.Resources.SessionsDataN) { List <string> Fields = (List <string>) new CglValidFields().GetValidFieldsLst(_gstuSearch); foreach (string field in Fields) { StuGLSearch stuGLSearchTemp = _gstuSearch; stuGLSearchTemp.FieldMode = field != "gen"; stuGLSearchTemp.StrCompares = field != "gen" ? field : "gen"; stuGLSearchTemp = new CglSearch().InitSearch(stuGLSearchTemp); stuGLSearchTemp = new CglMethod().GetMethodSN(stuGLSearchTemp); stuGLSearchTemp = new CglMethod().GetSearchMethodSN(stuGLSearchTemp); stuGLSearchTemp = new CglMethod().GetSecFieldSN(stuGLSearchTemp); SetSearchOrder(stuGLSearchTemp, localAction, SetRequestId(stuGLSearchTemp), AspFileName, LocalIP, LocalBrowserType); } } }
//private string KeySearchOrder { get; set; } //private Dictionary<string, DataSet> _dicFreqDataSet; #pragma warning disable CA1707 // Identifiers should not contain underscores protected void Page_Load(object sender, EventArgs e) #pragma warning restore CA1707 // Identifiers should not contain underscores { LocalBrowserType = Request.Browser.Type; LocalIP = Dns.GetHostEntry(Dns.GetHostName()).AddressList[1].ToString(); //KeySearchOrder = string.Format(InvariantCulture, "{0}#{1}#dtSearchOrder", LocalIP, LocalBrowserType); if (Session["SearchOption"] == null) { Response.Write("<script language='javascript'>window.close();</script>"); } else { StuGLSearch stuGLSearchTemp = (StuGLSearch)Session["SearchOption"]; stuGLSearchTemp = new CglSearch().InitSearch(stuGLSearchTemp); stuGLSearchTemp = new CglMethod().GetMethodSN(stuGLSearchTemp); stuGLSearchTemp = new CglMethod().GetSearchMethodSN(stuGLSearchTemp); localAction = stuGLSearchTemp.Action; AspFileName = stuGLSearchTemp.PageFileName; localRequestID = SetRequestId(stuGLSearchTemp); Session[localAction + localRequestID] = stuGLSearchTemp; if (Session[localAction + localRequestID] == null || string.IsNullOrEmpty(localAction) || string.IsNullOrEmpty(localRequestID) || string.IsNullOrEmpty(AspFileName)) { Response.Write("<script language='javascript'>window.close();</script>"); } else { Thread01 = new Thread(() => { StartThread01(stuGLSearchTemp); }) { Name = "ShortCut01" }; Thread01.Start(); Response.Write("<script language='javascript'>window.close();</script>"); } } }
private string SetupSession() { var targetTable = cmbLottoType.SelectedValue switch { "LottoBig" => TargetTable.LottoBig, "Lotto539" => TargetTable.Lotto539, "LottoWeli" => TargetTable.LottoWeli, "LottoSix" => TargetTable.LottoSix, _ => TargetTable.Lotto539, }; StuGLSearch stuGLSearch = new StuGLSearch(targetTable) { LngDataEnd = long.Parse(cmbDataRangeEnd.SelectedValue, InvariantCulture), LngTotalSN = long.Parse(cmbDataRangeEnd.SelectedValue, InvariantCulture), StrCompareType = cmbCompareType.Visible ? cmbCompareType.SelectedValue : "AND" //包含方式 }; //資料限制 txtDataLimit.Text = string.IsNullOrEmpty(txtDataLimit.Text) ? Properties.Resources.defaultDataLimitValue : txtDataLimit.Text; txtDataLimit.Text = dtlDataRange.Visible ? txtDataLimit.Text : Properties.Resources.defaultDataLimitValue; stuGLSearch.InDataLimit = int.Parse(txtDataLimit.Text, InvariantCulture); //資料位移 txtDataOffset.Text = string.IsNullOrEmpty(txtDataOffset.Text) ? Properties.Resources.defaultDataOffsetValue : txtDataOffset.Text; txtDataOffset.Text = dtlDataRange.Visible ? txtDataOffset.Text : Properties.Resources.defaultDataOffsetValue; stuGLSearch.InDataOffset = int.Parse(txtDataOffset.Text, InvariantCulture); //搜尋限制 txtSearchLimit.Text = string.IsNullOrEmpty(txtSearchLimit.Text) ? Properties.Resources.defaultSearchLimitValue : txtSearchLimit.Text; txtSearchLimit.Text = dtlDataRange.Visible ? txtSearchLimit.Text : Properties.Resources.defaultSearchLimitValue; stuGLSearch.InSearchLimit = int.Parse(txtSearchLimit.Text, InvariantCulture); //搜尋位移 txtSearchOffset.Text = string.IsNullOrEmpty(txtSearchOffset.Text) ? Properties.Resources.defaultSearchOffsetValue : txtSearchOffset.Text; txtSearchOffset.Text = dtlDataRange.Visible ? txtSearchOffset.Text : Properties.Resources.defaultSearchOffsetValue; stuGLSearch.InSearchOffset = int.Parse(txtSearchOffset.Text, InvariantCulture); // 欄位 stuGLSearch.FieldMode = chkField.Visible && chkField.Checked; stuGLSearch = SetCompareString(stuGLSearch); //拖牌 stuGLSearch.NextNumsMode = chkNextNums.Visible && chkNextNums.Checked; stuGLSearch.InNextNums = int.Parse(chkNextNums.Checked ? cmbNextNums.SelectedValue : "1", InvariantCulture); stuGLSearch.InNextStep = int.Parse(chkNextNums.Checked ? cmbNextStep.SelectedValue : "1", InvariantCulture); stuGLSearch = new CglMethod().SetNextNums(stuGLSearch); stuGLSearch.StrNextNums = "none"; stuGLSearch.StrNextNumSpe = "none"; //顯示期數DP txtDisplayPeriod.Text = string.IsNullOrEmpty(txtDisplayPeriod.Text) ? Properties.Resources.defaultDisplayPeriodValue : txtDisplayPeriod.Text; stuGLSearch.InDisplayPeriod = txtDisplayPeriod.Visible ? int.Parse(txtDisplayPeriod.Text, InvariantCulture) : int.Parse(Properties.Resources.defaultDisplayPeriodValue, InvariantCulture); //連續測試期數 txtTestPeriods.Text = string.IsNullOrEmpty(txtTestPeriods.Text) ? "1" : txtTestPeriods.Text; txtTestPeriods.Text = txtTestPeriods.Visible ? txtTestPeriods.Text : Properties.Resources.defaultTestPeriodsValue; stuGLSearch.InTestPeriods = int.Parse(txtTestPeriods.Text, InvariantCulture); stuGLSearch.GeneralMode = chkGeneral.Visible && chkGeneral.Checked; stuGLSearch.PeriodMode = chkPeriod.Visible && chkPeriod.Checked; //產生uid string uid = string.Format(InvariantCulture, "{0}_{1}", "FreqResult", stuGLSearch.GetHashCode()); Session.Add(uid, stuGLSearch); return(uid); }