public CostsForm() { InitializeComponent(); costTableAdapter = new JSManagementDataSetTableAdapters.CostTableAdapter(); costTableAdapter.Connection = CommonHelper.GetSQLConnection(); costTypeTableAdapter.Connection = CommonHelper.GetSQLConnection(); bankAccountTableAdapter = new JSManagementDataSetTableAdapters.BankAccountTableAdapter(); bankAccountTableAdapter.Connection = CommonHelper.GetSQLConnection(); }
public CashManagementForm() { InitializeComponent(); cashDetailTableAdapter = new JSManagementDataSetTableAdapters.CashDetailTableAdapter(); cashDetailTableAdapter.Connection = CommonHelper.GetSQLConnection(); incomeTableAdapter = new JSManagementDataSetTableAdapters.IncomeTableAdapter(); incomeTableAdapter.Connection = CommonHelper.GetSQLConnection(); costTableAdapter = new JSManagementDataSetTableAdapters.CostTableAdapter(); costTableAdapter.Connection = CommonHelper.GetSQLConnection(); cashSumaryTableAdapter = new JSManagementDataSetTableAdapters.CashSumaryTableAdapter(); cashSumaryTableAdapter.Connection = CommonHelper.GetSQLConnection(); cul = CultureInfo.GetCultureInfo(Constant.VN_CULTURE_FORMAT); this.WindowState = FormWindowState.Maximized; }
private void ViewDetailReceiableFromOther(DataGridViewCellEventArgs e) { if (e.RowIndex == -1 || e.RowIndex == grvReceivableFromCustomer.Rows.Count - 1) { return; } DataGridViewRow row = grvReceivableFromCustomer.Rows[e.RowIndex]; int costId = int.Parse(row.Cells[0].Value.ToString()); JSManagementDataSetTableAdapters.CostTableAdapter costTableAdapter = new JSManagementDataSetTableAdapters.CostTableAdapter(); costTableAdapter.Connection = CommonHelper.GetSQLConnection(); DataRow[] costDataRows = costTableAdapter.GetData().Select(string.Format("CostId ={0}", costId.ToString())); if (costDataRows.Length > 0) { string costDate = DateTime.Parse(costDataRows[0].ItemArray[1].ToString()).ToShortDateString(); string costName = costDataRows[0].ItemArray[2].ToString(); string amount = costDataRows[0].ItemArray[3].ToString(); MessageBox.Show(string.Format("Ngày: {0} Nội dung chi: {1} Số tiền: {2}", costDate, costName, amount)); } }