public FinancialAdministrator_FinancialUse() { TableSql = "select * from OutlayCost,Types where ItemId = TypeId"; InitializeComponent(); InitTabelToOutLayIn(); FinancialUseTable.DataTableSelect(TableSql, "更新"); FinancialUseTable.dataGrid.SelectionChanged += FinancialUseTable_SelectionChanged; dt = FinancialUseTable.Getdt(); Total.Content = dt.Rows.Count;//获取总行数 }
private void InitTabelToOutLayIn() { FinancialUseTable.InitTableHeightWidth(460, 878); FinancialUseTable.SetCanUserAddRows(false); FinancialUseTable.AddColumns("Id", "出账编号", 80); FinancialUseTable.AddColumns("CDate", "出账日期", 148); FinancialUseTable.AddColumns("ItemId", "项目编号", 100); FinancialUseTable.AddColumns("CSum", "使用金额", 80); FinancialUseTable.AddColumns("Ryname", "经办人", 80); FinancialUseTable.AddColumns("Ryname1", "批准人", 170); FinancialUseTable.AddColumns("CDescribe", "费用摘要", 170); FinancialUseTable.AddColumns("Memo", "备注", 220); }
private void SearchButton_Click(object sender, RoutedEventArgs e) { int numId = Convert.ToInt32(Search.Text); string sql = "select * from OutlayCost where Id = '" + numId + "'"; try { FinancialUseTable.DataTableSelect(sql, "更新"); } catch { MessageBox.Show("搜索失败!"); return; } }
private void button_Click(object sender, RoutedEventArgs e) { string Date = DateTime.Now.ToString("yyyy-MM-dd") + " " + DateTime.Now.ToLongTimeString().ToString();;//获取当前时间 string Submitsql = "insert into OutlayCost values('" + Date + "','" + Itemld.Text + "','" + CSum.Text + "','" + Ryname.Text + "','" + Ryname1.Text + "','" + CDescribe.Text + "','" + Memo.Text + "')"; string SQL2 = "insert into Types values('" + Itemld.Text + "','" + TypeName.Text + "',2)"; try { SqlCommand cmd = new SqlCommand(Submitsql, Temp.GetConn()); cmd.ExecuteNonQuery(); cmd.CommandText = SQL2; cmd.ExecuteNonQuery(); } catch (Exception se) { MessageBox.Show("提交失败!" + se); return; } FinancialUseTable.DataTableSelect(TableSql, "更新"); dt = FinancialUseTable.Getdt(); }
private void button1_Click(object sender, RoutedEventArgs e) { string[] Str = { "出账编号", "使用日期", "经费明细编号", "金额", "经办人", "批准人", "费用摘要", "备注" }; FinancialUseTable.ExportExcel("select * from OutlayCost", Str, "出账表格.xlsx"); }