//private DataGridViewPrinter _DataGridViewPrinter; public frmMain() { InitializeComponent(); CommonDoubleM.LoadAppConfig(); _pdalStock = new DALDoubleM(lblDMMsg, pBarDM); _pdalStock.MarqueeUpdate(); CommonDoubleM._pdalStock1 = new DALDoubleM(lblDMMsg, pBarDM); ////////////////////////// _groupPaneBar.Add(CreateButton("Basics", CommonDoubleM.Basics.Length), "Basics ", imglstMain.Images[0], true); _groupPaneBar.Add(CreateButton("Online", CommonDoubleM.Online.Length), "Online ", imglstMain.Images[1], true); _groupPaneBar.Add(CreateButton("Analysis", CommonDoubleM.Analysis.Length), "Analysis ", imglstMain.Images[2], true); _groupPaneBar.Add(CreateButton("Views", CommonDoubleM.Views.Length), "Views ", imglstMain.Images[3], true); _groupPaneBar.Add(CreateButton("Configuration", CommonDoubleM.Configuration.Length), "Configuration ", imglstMain.Images[4], true); _groupPaneBar.Add(CreateButton("About", CommonDoubleM.About.Length), " About ", imglstMain.Images[5], true); _groupPaneBar.CollapseAll(false); _groupPaneBar.CanResize = false; _groupPaneBar[0].Expanded = true; _groupPaneBar.ShowExpandCollapseButton = false; selectAllToolStripMenuItem.Checked = false; /*Winform FAQ*/ //http://www.syncfusion.com/faq/windowsforms/default.aspx /*Hiding Tab Pages on tab control*/ //http://www.experts-exchange.com/Programming/Programming_Languages/C_Sharp/Q_21549892.html tbMain.Top = tbMain.Top - tbMain.ItemSize.Height; tbMain.Height = tbMain.Height + tbMain.ItemSize.Height; tbMain.Region = new Region(new RectangleF(tpMain.Left, tpMain.Top, tpMain.Width, tpMain.Height + tbMain.ItemSize.Height)); LoadStocks(); LoadStock(); ddlPeriod.DataSource = DoubleM.CommonDoubleM.Period; chkAllStocks.Checked = true; rdobPeriod.Checked = true; pTradings = new frmTradingHist(_pdalStock); pAccount = new frmAc(_pdalStock); }
private void btnSearch_Click(object sender, EventArgs e) { string sSID = "", sTime = ""; DataTable dtAccount = null; DataView dvAC = _pdalStock.Accouting_ProfitLoss(DateTime.MinValue); if (dvAC != null) { if (!chkAllStocks.Checked) { if (lstBStocks.SelectedItems.Count > 0) { for (int i = 0; i <= lstBStocks.SelectedItems.Count - 1; i++) { DataRowView ln = lstBStocks.SelectedItems[i] as DataRowView; sSID += ln[0].ToString() + ","; } sSID = "StockID IN (" + sSID.Substring(0, sSID.Length - 1) + ")"; } } if (ddlPeriod.Visible) { if (ddlPeriod.SelectedIndex == 0) //Last week { sTime = "(TradeOn >=#" + DateTime.Now.AddDays(-7).ToShortDateString() + "#)"; } else if (ddlPeriod.SelectedIndex == 1) //Last 2 Weeks { sTime = "(TradeOn >=#" + DateTime.Now.AddDays(-15).ToShortDateString() + "#)"; } else if (ddlPeriod.SelectedIndex == 2) //This month { sTime = "(TradeOn >=#" + new DateTime(DateTime.Now.Year, DateTime.Now.Month, 1).ToShortDateString() + "#)"; } else if (ddlPeriod.SelectedIndex == 3) //Last month { sTime = "(TradeOn >=#" + new DateTime(DateTime.Now.Year, DateTime.Now.Month - 1, 1).ToShortDateString() + "#)"; } else if (ddlPeriod.SelectedIndex == 4) //This quater { sTime = "(TradeOn >=#" + new DateTime(DateTime.Now.Year, ((3 * (DateTime.Now.Month - 1) / 3 + 1) - 1), 1).ToShortDateString() + "#)"; } else if (ddlPeriod.SelectedIndex == 5) //6 Months { sTime = "(TradeOn >=#" + DateTime.Now.AddMonths(-6).ToShortDateString() + "#)"; } else if (ddlPeriod.SelectedIndex == 6) //This year //sTime = "(TradeOn >=#" + DateTime.Now.AddYears(-1).ToShortDateString() + "#)"; { sTime = "(TradeOn >=#" + new DateTime(DateTime.Now.Year, 1, 1).ToShortDateString() + "#)"; } else if (ddlPeriod.SelectedIndex == 7) //last year { sTime = "(TradeOn >=#" + DateTime.Now.AddYears(-1).ToShortDateString() + "#)"; } } else if (chkFromTo.Visible) { sTime = "(TradeOn " + (string)(chkFromTo.Checked == true ? "<=#" : ">=#") + dtpSince.Value.ToShortDateString() + "#)"; } else if (dtpTo.Visible) { sTime = "(TradeOn >= #" + dtpSince.Value.ToShortDateString() + " #) AND (TradeOn <= #" + dtpTo.Value.ToShortDateString() + "#)"; } //dvAC.RowFilter = "(TradeOn >= #12/31/2008#) AND (TradeOn <= #3/1/2009#)"; dvAC.RowFilter = (sSID == "")?sTime: sSID + " AND " + sTime; dtAccount = dvAC.ToTable(); } btnSearch.Enabled = false; Cursor = Cursors.WaitCursor; if (pAccount == null) { pAccount = new frmAc(_pdalStock); } pAccount.MdiParent = this; pAccount.Show(); pAccount.Select(); pAccount.FillAc(dtAccount); btnSearch.Enabled = true; Cursor = Cursors.Default; }