private void butSearch_Click(object sender, EventArgs e) { objDatabase Database = new objDatabase(); string strSQL = CreateSQL(); DataTable objTable = new DataTable(); //objDataReader = Database.ReturnData(strSQL); objTable = Database.ReturnDataTable(strSQL); if (objTable.Rows.Count > 0) { objGrid.DataSource = objTable; objGrid.Columns[0].Visible = false; objGrid.Columns[4].Visible = false; if (objTable.Rows.Count == 1) { Fill_Control(objGrid.Rows[0]); } } else { MessageBox.Show("No rows were returned, for the given critera, please try again"); ClearControl(); } }
private void update_ListBoxes() { if (dtDay.Value.ToShortDateString() != "") { lstScheduled.Items.Clear(); lstWorkers.Items.Clear(); objDatabase Database = new objDatabase(); string strSQL = "spReturnSchedule '" + dtDay.Value.ToShortDateString() + "'"; dtSchedule = Database.ReturnDataTable(strSQL); dtSchedule.Columns.Add("Action", typeof(string)); foreach (DataRow objRow in dtSchedule.Rows) { if (objRow["Shift"].ToString() == cmbShift.Text) { lstScheduled.DrawMode = DrawMode.OwnerDrawFixed; lstScheduled.Items.Add(objRow["Worker"]); } else if (objRow["Shift"].ToString() == "") { lstWorkers.DrawMode = DrawMode.OwnerDrawFixed; strCurrentItem = strCurrentItem + "|" + objRow["Worker"]; lstWorkers.Items.Add(objRow["Worker"]); } } } }
private void LoadControl() { objDatabase Database = new objDatabase(); string strSQL; cmbShift.Items.Clear(); strSQL = "Select Name, TimeIn, TimeOut"; strSQL = strSQL + " From Shift"; objTable = Database.ReturnDataTable(strSQL); // Loading Shifts into combobox foreach (DataRow objRow in objTable.Rows) { cmbShift.Items.Add(objRow[0].ToString()); } cmbShift.SelectedIndex = -1; cmbShift.Text = "<New Shift>"; dtStartTime.Text = "12:00 AM"; dtEndTime.Text = "12:00 AM"; cmbShift.Focus(); }
private DataTable QueryDB(string strSQL) { objDatabase Database = new objDatabase(); DataTable objDTable; return(objDTable = Database.ReturnDataTable(strSQL)); }
private void objTabs_SelectedIndexChanged(object sender, EventArgs e) { if (objTabs.SelectedIndex == 2) { cmbShift.Items.Clear(); // Filing cmbShifts objDatabase DataBase = new objDatabase(); string strSQL = "Select Shift.Name From Shift"; DataTable objDTable = DataBase.ReturnDataTable(strSQL); foreach (DataRow objRow in objDTable.Rows) { cmbShift.Items.Add(objRow[0]); } cmbReports.Items.Clear(); cmbReports.Items.Add("Schedule"); cmbReports.Items.Add("Accounting"); cmbReports.SelectedIndex = -1; } }
private void FillGrid() { objDatabase Database = new objDatabase(); string strSQL = "spReturnUserTime " + strID; dtTimes = Database.ReturnDataTable(strSQL); grdTimes.Columns.Clear(); grdTimes.DataSource = dtTimes; grdTimes.Columns[0].Visible = false; grdTimes.Columns[2].Visible = false; grdTimes.Columns[4].Visible = false; grdTimes.Columns[5].Visible = false; SetupDateTime(dtStart, chkAddStartTime, false); SetupDateTime(dtEnd, chkAddEndTime, false); butAdjust.Enabled = false; butAdd.Enabled = false; }