private void button11_Click(object sender, EventArgs e) { CommonBusinessRule cb = new CommonBusinessRule(); var a = comboBox1.SelectedIndex; var ps = cb.QueryProducts(dateTimePicker1.Value, dateTimePicker2.Value); if (a == 1) { ps = ps.Where(x => x.Type == "B"); } else if (a == 2) { ps = ps.Where(x => x.Type == "S"); } this.Stocks = ps.Select(x => new Stock() { Id = x.Id, Name = x.Name }).Distinct(); this.iStock = -1; InitListView(); if (this.Stocks.Count() > 0) { button1_Click(sender, e); } }
private void CargarComboMoneda() { CommonBusinessRule oCommonBR = new CommonBusinessRule(); try { //Limpio el combo cmbMoneda.Items.Clear(); //Busco los paises en la base DataTable dtMonedas = oCommonBR.BuscarMonedas(); if (dtMonedas.Rows.Count > 0) { cmbMoneda.DataSource = dtMonedas.DefaultView; cmbMoneda.ValueMember = "Moneda_ID"; cmbMoneda.DisplayMember = "Moneda_Tipo"; } } catch (Exception ex) { throw new BaseDatosException(); } }
private void CargarRoles() { CommonBusinessRule oCommonBR = new CommonBusinessRule(); try { //Limpio el combo chkRoles.Items.Clear(); //Busco los paises en la base DataTable dtRoles = oCommonBR.BuscarRoles(); if (dtRoles.Rows.Count > 0) { chkRoles.DataSource = dtRoles.DefaultView; chkRoles.ValueMember = "Rol_ID"; chkRoles.DisplayMember = "Rol_Nombre"; } } catch (Exception ex) { throw new BaseDatosException(); } }
private void CargarComboTipoDocumento() { CommonBusinessRule oCommonBR = new CommonBusinessRule(); try { //Limpio el combo cmbTipoDoc.Items.Clear(); //Busco los paises en la base DataTable dtTipoDocumentos = oCommonBR.BuscarTiposDocumentos(); if (dtTipoDocumentos.Rows.Count > 0) { cmbTipoDoc.DataSource = dtTipoDocumentos.DefaultView; cmbTipoDoc.ValueMember = "Tipo_Documento_ID"; cmbTipoDoc.DisplayMember = "Tipo_Documento_Desc"; } } catch (Exception ex) { throw new BaseDatosException(); } }
private void InitProductsTable(DateTime start, DateTime end) { panel1.Controls.Clear(); CommonBusinessRule cb = new CommonBusinessRule(); this.Products = cb.QueryProducts(start, end); TableLayoutPanel table = new TableLayoutPanel(); int ic = 0; string[] titles = new string[] { "股票代碼", "股票名稱", "交易日期", "交易方式", "成交價", "數量", "手續費", "交易稅", "收付", "損益", "報酬率" }; foreach (var t in titles) { Label title = new Label(); title.Text = t; table.Controls.Add(title, ic, 0); ic = ic + 1; } table.Size = new Size(1140, 20); panel1.Controls.Add(table); table = new TableLayoutPanel(); int ir = 0; foreach (var p in this.Products) { Label title = new Label(); title.Text = p.Id; table.Controls.Add(title, 0, ir); title = new Label(); title.Text = p.Name; table.Controls.Add(title, 1, ir); title = new Label(); title.Text = p.Date; table.Controls.Add(title, 2, ir); title = new Label(); title.Text = p.Type == "B"?"買進":"賣出"; table.Controls.Add(title, 3, ir); title = new Label(); title.Text = p.Price.ToString(); table.Controls.Add(title, 4, ir); title = new Label(); title.Text = p.Vol.ToString(); table.Controls.Add(title, 5, ir); title = new Label(); title.Text = p.Fee.ToString(); table.Controls.Add(title, 6, ir); title = new Label(); title.Text = p.Tax.ToString(); table.Controls.Add(title, 7, ir); title = new Label(); title.Text = p.Income.ToString(); table.Controls.Add(title, 8, ir); title = new Label(); title.Text = p.Increase.ToString(); table.Controls.Add(title, 9, ir); title = new Label(); title.Text = p.Rate.ToString(); table.Controls.Add(title, 10, ir); ir = ir + 1; } //table.Location = new Point(14, 43); table.Top = 20; table.Size = new Size(1140, 300); table.AutoScroll = true; panel1.Controls.Add(table); Chart(); //this.Controls.Add(table); }