public ActionResult SearchView(FormSearch search) { try { switch (search.SelectedOption) { case 1: { return(RedirectToAction("SearchYearView", "Search", search)); } case 2: { return(RedirectToAction("SearchSourseView", "Search", search)); } case 3: { return(RedirectToAction("SearchChronologyView", "Search", search)); } default: { throw new System.Exception(); } } } catch (System.Exception) { return(NotFound()); } }
public JsonResult ReadStockStatistics(FormSearch form) { bool status = true; bool check = true; List <RSS> data = null; string msg = ""; if (string.IsNullOrEmpty(form.type)) { check = false; } if (check) { data = reportModel.ReadStockStatistics(form); status = data.Count() > 0 ? true : false; msg = status ? "查詢成功!" : "查詢失敗!"; } else { status = false; msg = "資料輸入錯誤!"; } return(Json(new Results <List <RSS> > { Success = status, Message = msg, Data = data, TotalCount = status ? data.FirstOrDefault().totalCount : 0 })); }
private void RunSingleQuery() { // Test function to scrape a single office var search = new FormSearch { ElectionYear = "2018", OfficeTypeId = "120", OfficeName = "State%20Senate", District = "", Circuit = "", Division = "", County = "", City = "", FilerId = "" }; backgroundWorkerScrape.ReportProgress(1, "Begin new search with FormSearch : " + Environment.NewLine + search); if (!UpdateCandidates.ReadFirstPage(search)) { backgroundWorkerScrape.ReportProgress(1, UpdateCandidates.CurrentStatus.LastOpMessage); return; } var candidates = UpdateCandidates.Candidates; backgroundWorkerScrape.ReportProgress(2, UpdateCandidates.CurrentStatus.LastOpMessage + Environment.NewLine); while (UpdateCandidates.CurrentStatus.LastPageCompleted < UpdateCandidates.CurrentStatus.TotalPages) { var finished = UpdateCandidates.ReadSubsequentPage(search); backgroundWorkerScrape.ReportProgress(2, UpdateCandidates.CurrentStatus.LastOpMessage + Environment.NewLine); } }
private void buttonFilter_Click(object sender, EventArgs e) { FormSearch formSearch; switch (printType) { case PrintType.TrackList: formSearch = new FormSearch(dataBase, printFilter, true, false); break; default: formSearch = new FormSearch(dataBase, printFilter, false, true); break; } if (formSearch.ShowDialog(this) == DialogResult.OK) { printFilter = formSearch.GetCondition(); printPreviewControl.InvalidatePreview(); } /*FormExtendedSearch formExtendedSearch = new FormExtendedSearch(dataBase, printFilter); * * if (formExtendedSearch.ShowDialog(this) == DialogResult.OK) * { * printFilter = formExtendedSearch.Condition; * printPreviewControl.InvalidatePreview(); * }*/ }
public ActionResult DetailsInfo(string name) { FormSearch search = new FormSearch { Name = name, SelectedOption = 3 }; return(RedirectToAction("SearchView", "Search", search)); }
// GET: stockFavorite public ActionResult selfFavorite() { StockFavoriteView stockFavoriteView = new StockFavoriteView(); FormSearch form = new FormSearch(); form.operId = UserInfo.OperId; stockFavoriteView.formSearch = form; stockFavoriteView.data = reportModel.ReadStockFavorite(form); return(View(stockFavoriteView)); }
public ActionResult getSingleStock() { StockDataView StockDataView = new StockDataView(); FormSearch form = new FormSearch(); form.dataDate = DateTime.UtcNow.AddHours(8).AddMonths(-1); StockDataView.formSearch = form; StockDataView.data = new List <RSD>(); return(View(StockDataView)); }
// GET: stockProfit public ActionResult stockProfit() { StockProfitView stockProfitView = new StockProfitView(); //預設查詢條件 FormSearch form = new FormSearch(); form.operId = UserInfo.OperId; stockProfitView.formSearch = form; stockProfitView.data = reportModel.ReadStockProfit(form); return(View(stockProfitView)); }
public ActionResult getSingleStock(StockDataView data) { //預設查詢條件 FormSearch form = new FormSearch(); form = data.formSearch; form.options.sortBy = new string[] { "dataDate" }; form.options.sortDesc = new bool[] { true }; StockDataView StockDataView = new StockDataView(); StockDataView.data = reportModel.ReadStockData(form); return(View(StockDataView)); }
public FormCadastroClasse(bool isSubCadastro) { InitializeComponent(); this.isSubCadastro = isSubCadastro; dao = new ClasseDAO(); daoProfessor = new ProfessorDAO(); formSearchProfessores = new FormSearch(daoProfessor); formSearchProfessores.FormAdd = new FormCadastroPessoaMembro(true); classe = new ClasseEntity(); idProfessoresExcluir = new List <int>(); configTela(); configEvents(); }
public ActionResult SearchYearView(FormSearch search) { try { List <ResponseSearch> Ob = repo.SearchYearView(search); if (Ob.Count == 0) { throw new System.Exception(); } return(View(Ob)); } catch (System.Exception) { return(NotFound()); } }
// GET: stockIndex public ActionResult Index() { //預設查詢條件 FormSearch form = new FormSearch(); form.type = "上"; form.options.sortBy = new string[] { "id" }; form.options.sortDesc = new bool[] { false }; StockIndexView StockIndexView = new StockIndexView(); StockIndexView.data = ReportModel.ReadStockIndex(form); return(View(StockIndexView)); }
public ActionResult stockStatistics() { StockStatisticsView stockStatisticsView = new StockStatisticsView(); //預設查詢條件 FormSearch form = new FormSearch(); form.type = "上"; form.shares = 1; form.closePrice = 0.0; form.position2 = 10; form.options.sortBy = new string[] { "position" }; form.options.sortDesc = new bool[] { false }; stockStatisticsView.formSearch = form; stockStatisticsView.sysConfig = new WebStockEntities().sysConfig.FirstOrDefault(); stockStatisticsView.data = ReportModel.ReadStockStatistics(form); return(View(stockStatisticsView)); }
internal List <RSF> ReadStockFavorite(FormSearch form) { List <RSF> favorites = new List <RSF>(); using (var db = new WebStockEntities()) { string sql = @"SELECT count(1) over() as totalCount, i.type ,i.category ,i.code ,i.company ,f.id ,n.closePrice ,n.position ,ISNULL( m.ext1 + ',' + m.ext2 + ',' + m.ext3 + ',' + m.ext4 + ',' + m.ext5 + ',' + m.ext6 + ',' + m.ext7 , '') AS memo ,f.memo AS selfmemo FROM stockIndex i JOIN stockNow n ON i.code = n.code JOIN stockFavorite f ON i.code = f.code LEFT JOIN stockMemo m ON f.code = m.code WHERE f.operId = @operId ORDER BY i.code {0}"; string pageStr = (form.options.page != 0 && form.options.itemsPerPage != 0) ? "OFFSET @OFFSET ROWS FETCH NEXT @FETCH ROWS ONLY" : ""; string strsql = string.Format(sql, pageStr); favorites = db.Database.SqlQuery <RSF>(strsql, new SqlParameter("@operId", form.operId), new SqlParameter("@OFFSET", ((form.options.page - 1) * form.options.itemsPerPage)), new SqlParameter("@FETCH", form.options.itemsPerPage)).ToList(); } return(favorites); }
internal List <RSP> ReadStockProfit(FormSearch form) { List <RSP> stockInventoryProfits = new List <RSP>(); using (var db = new WebStockEntities()) { string sql = @"SELECT count(1) over() as totalCount, p.id ,i.code ,i.company ,n.position ,n.closePrice ,p.buyPrice ,p.buyShares ,p.buyCost ,p.profit ,p.profitPercentage FROM stockIndex i JOIN stockNow n ON i.code = n.code JOIN stockProfit p ON i.code = p.code WHERE p.operId = @operId ORDER BY i.code"; string pageStr = (form.options.page != 0 && form.options.itemsPerPage != 0) ? "OFFSET @OFFSET ROWS FETCH NEXT @FETCH ROWS ONLY" : ""; string strsql = string.Format(sql, pageStr); stockInventoryProfits = db.Database.SqlQuery <RSP>(strsql, new SqlParameter("@operId", form.operId), new SqlParameter("@OFFSET", ((form.options.page - 1) * form.options.itemsPerPage)), new SqlParameter("@FETCH", form.options.itemsPerPage)).ToList(); const double sellcommision = 0.004425; const int percentage = 100; foreach (var item in stockInventoryProfits) { item.profit = ((item.closePrice * item.buyShares * (1 - sellcommision)) - item.buyCost); item.profitPercentage = Math.Round(item.profit / item.buyCost * percentage, 2); } } return(stockInventoryProfits); }
private void textBoxComponentID_Click(object sender, EventArgs e) { FormSearch formSearch = new FormSearch(); formSearch.Show(); formSearch.SetSelectFinishCallback(new Action <int>((int ID) => { //Console.WriteLine(ID); Supply supply = (from s in wmsEntities.Supply where s.ID == ID select s).FirstOrDefault(); WMS.DataAccess.Component component = (from c in wmsEntities.Component where c.ID == ID select c).FirstOrDefault(); if (supply != null) { //this.Controls.Find("textBoxComponentID", true)[0].Text = ID.ToString(); this.Controls.Find("textBoxComponentName", true)[0].Text = supply.Component.Name; this.Controls.Find("textBoxComponentNo", true)[0].Text = supply.No; this.componentID = ID; } else { MessageBox.Show("找不到该零件"); } })); }
private void btnSearch_Click(object sender, EventArgs e) { var frm = new FormSearch(Dispatcher); frm.Show(); }
internal List <RSI> ReadStockIndex(FormSearch form) { using (var db = new WebStockEntities()) { string sqlStr = @" SELECT count(1) over() as totalCount, a.id, a.type, a.category, a.code, a.company, a.dataDate, a.isEnable FROM stockIndex a WHERE {0} {1} {2} {3} "; string whereStr = ""; if (string.IsNullOrEmpty(form.code)) { whereStr = @" a.type LIKE '%'+ @type +'%' "; } else { whereStr = @" a.code LIKE @code OR a.company LIKE @code "; } string sortStr = "ORDER BY "; string sortDESC = (form.options.sortDesc != null && form.options.sortDesc[0]) ? "DESC" : "ASC"; string pageStr = (form.options.page != 0 && form.options.itemsPerPage != 0) ? "OFFSET @OFFSET ROWS FETCH NEXT @FETCH ROWS ONLY" : ""; string sortByType = (form.options.sortBy != null && form.options.sortBy[0] != "") ? form.options.sortBy[0] : ""; switch (sortByType) { case "id": sortStr += "a.id"; break; case "type": sortStr += "a.type"; break; case "category": sortStr += "a.category"; break; case "code": sortStr += "a.code"; break; case "company": sortStr += "a.company"; break; case "dataDate": sortStr += "a.dataDate"; break; case "isEnable": sortStr += "a.isEnable"; break; default: sortStr += "a.id"; break; } sqlStr = string.Format(sqlStr, whereStr, sortStr, sortDESC, pageStr); List <RSI> rs = db.Database.SqlQuery <RSI>(sqlStr, new SqlParameter("@type", form.type), new SqlParameter("@code", form.code ?? string.Empty), new SqlParameter("@OFFSET", ((form.options.page - 1) * form.options.itemsPerPage)), new SqlParameter("@FETCH", form.options.itemsPerPage) ).ToList(); return(rs); } }
internal List <RSS> ReadStockStatistics(FormSearch form) { using (var db = new WebStockEntities()) { string strSqlTmp = @" SELECT count(1) over() as totalCount, i.type ,i.category ,i.code ,i.company ,a.avgShares ,a.avgTurnover ,a.highestPrice ,a.lowestPrice ,n.closePrice ,n.position ,ISNULL( m.ext1 + ',' + m.ext2 + ',' + m.ext3 + ',' + m.ext4 + ',' + m.ext5 + ',' + m.ext6 + ',' + m.ext7 , '') AS memo FROM stockIndex i JOIN stockAvg a ON i.code = a.code JOIN stockNow n ON i.code = n.code LEFT JOIN stockMemo m ON m.code = i.code" ; if (string.IsNullOrEmpty(form.code)) { strSqlTmp += @" WHERE i.type LIKE '%'+ @type +'%' AND a.avgShares >= @shares AND n.position <= @position AND n.closePrice >= @closePrice {0} {1} {2} "; string sortStr = "ORDER BY "; string sortDESC = (form.options.sortDesc != null && form.options.sortDesc[0]) ? "DESC" : "ASC"; string pageStr = (form.options.page != 0 && form.options.itemsPerPage != 0) ? "OFFSET @OFFSET ROWS FETCH NEXT @FETCH ROWS ONLY" : ""; string sortByType = (form.options.sortBy != null && form.options.sortBy[0] != "") ? form.options.sortBy[0] : ""; switch (sortByType) { case "position": sortStr += "n.position"; break; case "category": sortStr += "i.category"; break; case "avgShares": sortStr += "a.avgShares"; break; case "avgTurnover": sortStr += "a.avgTurnover"; break; case "highestPrice": sortStr += "a.highestPrice"; break; case "lowestPrice": sortStr += "a.lowestPrice"; break; case "closePrice": sortStr += "n.closePrice"; break; default: sortStr += "i.dataDate"; break; } string strSql = string.Format(strSqlTmp, sortStr, sortDESC, pageStr); List <RSS> datas = db.Database.SqlQuery <RSS>(strSql, new SqlParameter("@type", form.type), new SqlParameter("@shares", form.shares), new SqlParameter("@position", form.position2), new SqlParameter("@closePrice", form.closePrice), new SqlParameter("@OFFSET", ((form.options.page - 1) * form.options.itemsPerPage)), new SqlParameter("@FETCH", form.options.itemsPerPage) ).ToList(); if (datas.Count == 0) { return(new List <RSS>()); } return(datas); } else { strSqlTmp += @" WHERE ( a.code LIKE @code OR i.company LIKE @code )"; List <RSS> datas = db.Database.SqlQuery <RSS>(strSqlTmp, new SqlParameter("@code", form.code)).ToList(); if (datas.Count == 0) { return(new List <RSS>()); } return(datas); } } }
private void търсенеНаКнигиToolStripMenuItem_Click(object sender, EventArgs e) { FormSearch fS = new FormSearch(0, 0); fS.Show(); }
internal List <RSD> ReadStockData(FormSearch form) { using (var db = new WebStockEntities()) { string strSqlTmp = @" SELECT count(1) over() as totalCount, a.id, a.code, b.company, a.dataDate, a.shares, a.turnover, a.openPrice, a.highestPrice, a.lowestPrice, a.closePrice FROM stockData a JOIN stockIndex b ON a.code = b.code WHERE ( a.code LIKE @code OR b.company LIKE @code ) AND ( a.dataDate >= @dataDate ) AND ( b.isEnable = 'true' ) {0} {1} {2} "; string sortStr = "ORDER BY "; string sortDESC = (form.options.sortDesc != null && form.options.sortDesc[0]) ? "DESC" : "ASC"; string pageStr = (form.options.page != 0 && form.options.itemsPerPage != 0) ? "OFFSET @OFFSET ROWS FETCH NEXT @FETCH ROWS ONLY" : ""; string sortByType = (form.options.sortBy != null && form.options.sortBy[0] != "") ? form.options.sortBy[0] : ""; switch (sortByType) { case "id": sortStr += "a.id"; break; case "code": sortStr += "a.code"; break; case "company": sortStr += "b.company"; break; case "dataDate": sortStr += "a.dataDate"; break; case "shares": sortStr += "a.shares"; break; case "turnover": sortStr += "a.turnover"; break; case "openPrice": sortStr += "a.openPrice"; break; case "highestPrice": sortStr += "a.highestPrice"; break; case "lowestPrice": sortStr += "a.lowestPrice"; break; case "closePrice": sortStr += "a.closePrice"; break; default: sortStr += "a.dataDate"; break; } string strSql = string.Format(strSqlTmp, sortStr, sortDESC, pageStr); List <RSD> datas = db.Database.SqlQuery <RSD>(strSql, new SqlParameter("@code", form.code ?? string.Empty), new SqlParameter("@dataDate", form.dataDate), new SqlParameter("@OFFSET", ((form.options.page - 1) * form.options.itemsPerPage)), new SqlParameter("@FETCH", form.options.itemsPerPage) ).ToList(); if (datas.Count == 0) { return(new List <RSD>()); } return(datas); } }
public List <ResponseSearch> SearchSourseView(FormSearch search) { return(Search(search.Name, "Sourse.Name AS Information", "Sourse JOIN Part ON (Part.Sourse_idSourse = Sourse.idSourse) JOIN DetailsInformation ON (DetailsInformation.id = Part.DetailsInformation_id) JOIN Midle ON(Midle.id = DetailsInformation.Midle_id)", "YEAR(DetailsInformation.Year) = '" + search.Year + "' AND Midle.id = ")); }
public List <ResponseSearch> SearchChronologyView(FormSearch search) { return(Search(search.Name, "Part.Information, DetailsInformation.Year", "Part JOIN DetailsInformation ON (DetailsInformation.id = Part.DetailsInformation_id) JOIN Midle ON(Midle.id = DetailsInformation.Midle_id)", "Midle.id = ", "", "DetailsInformation.Year")); }
public List <ResponseSearch> SearchYearView(FormSearch search) { return(Search(search.Name, "Part.Information, DetailsInformation.Year", "Part JOIN DetailsInformation ON (DetailsInformation.id = Part.DetailsInformation_id) JOIN Midle ON(Midle.id = DetailsInformation.Midle_id)", "YEAR(DetailsInformation.Year) = '" + search.Year + "' AND Midle.id = ")); }
//Constructor public FormMainMenu() { InitializeComponent(); leftBorderBtn = new Panel(); leftBorderBtn.Size = new Size(7, 60); panelMenu.Controls.Add(leftBorderBtn); //Form this.Text = string.Empty; this.ControlBox = false; this.DoubleBuffered = true; this.MaximizedBounds = Screen.FromHandle(this.Handle).WorkingArea; if (System.Deployment.Application.ApplicationDeployment.IsNetworkDeployed) { Version myVersion = System.Deployment.Application.ApplicationDeployment.CurrentDeployment.CurrentVersion; lbVersion.Text = string.Concat("v", myVersion); if (ApplicationDeployment.CurrentDeployment.IsFirstRun) { try { string assemblyTitle = ""; object[] titleAttributes = Assembly.GetEntryAssembly().GetCustomAttributes(typeof(AssemblyTitleAttribute), true); if (titleAttributes.Length > 0 && titleAttributes[0] is AssemblyTitleAttribute) { assemblyTitle = (titleAttributes[0] as AssemblyTitleAttribute).Title; } string iconSourcePath = Path.Combine(System.Windows.Forms.Application.StartupPath, "comics.ico"); if (!File.Exists(iconSourcePath)) { return; } RegistryKey myUninstallKey = Registry.CurrentUser.OpenSubKey(@"Software\Microsoft\Windows\CurrentVersion\Uninstall"); string[] mySubKeyNames = myUninstallKey.GetSubKeyNames(); for (int i = 0; i < mySubKeyNames.Length; i++) { RegistryKey myKey = myUninstallKey.OpenSubKey(mySubKeyNames[i], true); object myValue = myKey.GetValue("DisplayName"); if (myValue != null && myValue.ToString() == assemblyTitle) { myKey.SetValue("DisplayIcon", iconSourcePath); break; } } } catch (Exception ex) { MessageBox.Show(ex.ToString()); } } } //Load cấu hình string configStr = File.ReadAllText("config.json", Encoding.UTF8); var config = JsonConvert.DeserializeObject <Config>(configStr); DataForm.WebComics = config.WebComics; DataForm.MaxProcessDownload = config.MaxProcessDownload; DataForm.DownloadType = config.DownloadType; DataForm.Action = config.Action; DataForm.FolderDownload = string.IsNullOrEmpty(config.FolderDownload) ? Environment.GetFolderPath(Environment.SpecialFolder.Desktop) : config.FolderDownload; DataForm.OffAlert = config.OffAlert; DataForm.IsPause = false; //Load danh sách tải string downloadListStr = File.Exists("downloadlist.json") ? File.ReadAllText("downloadlist.json", Encoding.UTF8) : null; DataDownload.ListDownload = string.IsNullOrEmpty(downloadListStr) ? new List <ItemDownload>() : JsonConvert.DeserializeObject <List <ItemDownload> >(downloadListStr); //Open default form Search formSearch = new FormSearch(); if (DataDownload.ListDownload.Where(x => x.Status != "Đã xong").Any()) { ActivateButton(btnOrder, RGBColors.color2); OpenChildForm(new FormDownloading()); } else { ActivateButton(btnDashboard, RGBColors.color1); OpenChildForm(formSearch); } //Start Download timer1.Start(); }
public ActionResult Index() { FormSearch Ob = new FormSearch(); return(View(Ob)); }