private void DBComboxHall3_SelectedValueChanged(object sender, EventArgs e) { UInt32 SelectedItemID_UL; if (DBComboxHall3.GetSelectedItemID(out SelectedItemID_UL)) { UpdateMachineDBCombox(DBComboxMachine3, SelectedItemID_UL); } }
private void CheckingEdition_Load(object sender, EventArgs e) { // Fill dep and machine check DB combo box with prefered user dep DBComboxDep.FillList(mDataBaseManager_O, "TypeDep", "TypeDepID", "TypeDepLib"); DBComboxHall1.FillList(mDataBaseManager_O, "Hall", "HallID", "HallName"); DBComboxHall2.FillList(mDataBaseManager_O, "Hall", "HallID", "HallName"); DBComboxHall3.FillList(mDataBaseManager_O, "Hall", "HallID", "HallName"); DBComboxHall4.FillList(mDataBaseManager_O, "Hall", "HallID", "HallName"); // Get user prefered dep and hall UInt32 PrefDep_UL = 0; UInt32 PrefHall_UL = 0; UInt32.TryParse(mDataBaseManager_O.GetTableField("Pers", "PrefDepID", "PersID=" + mPersID_UL), out PrefDep_UL); UInt32.TryParse(mDataBaseManager_O.GetTableField("Pers", "PrefHallID", "PersID=" + mPersID_UL), out PrefHall_UL); // If prefered dep and hall found, select it in dep combo box if (PrefDep_UL > 0) { DBComboxDep.SelectItemByID(PrefDep_UL); } if (PrefHall_UL > 0) { DBComboxHall1.SelectItemByID(PrefHall_UL); DBComboxHall2.SelectItemByID(PrefHall_UL); DBComboxHall3.SelectItemByID(PrefHall_UL); DBComboxHall4.SelectItemByID(PrefHall_UL); } // Update Task combo box UpdateTaskDBComboBox(PrefDep_UL); UpdateMachineDBCombox(DBComboxMachine1, PrefHall_UL); UpdateMachineDBCombox(DBComboxMachine2, PrefHall_UL); UpdateMachineDBCombox(DBComboxMachine3, PrefHall_UL); UpdateMachineDBCombox(DBComboxMachine4, PrefHall_UL); if (mMode_e == CheckingEditionMode.Edit) { LoadChecking(); } if (mDataBaseManager_O.mConnected_b) { LblSumHours.Text = mDataBaseManager_O.mFunctionManager_O.SCFNC_CountPersHourInJob(mComJobID_UL, mPersID_UL).ToString(); } }
public void LoadChecking() { String SQLRequest_ST; SqlDataReader SqlDataReader_O; UInt32 PointageMachine_UL = 1; UInt32 TaskID_UL = 0; UInt32 MachineID_UL = 0; UInt32 HallID_UL = 0; UInt32 DepID_UL = 0; if (mDataBaseManager_O != null && mDataBaseManager_O.mConnected_b) { // Fill pointage info SQLRequest_ST = "SELECT * FROM Pointage WHERE ComJobEtapeID=" + mComJobEtapeID_UL; SqlDataReader_O = mDataBaseManager_O.Select(SQLRequest_ST); while (SqlDataReader_O.Read()) { // Select Task if (UInt32.TryParse(mDataBaseManager_O.GetTableField("ComJobEtape", "TypeTacheID", "ComJobEtapeID=" + mComJobEtapeID_UL), out TaskID_UL)) { if (UInt32.TryParse(mDataBaseManager_O.GetTableField("TypeTache", "TypeDepID", "TypeTacheID=" + TaskID_UL), out DepID_UL)) { DBComboxDep.SelectItemByID(DepID_UL); DBComboxTask.SelectItemByID(TaskID_UL); } } // Fill NbrH field TxtNbrH.Text = SqlDataReader_O["NbrH"].ToString(); // Fill Rem field TxtRem.Text = SqlDataReader_O["Rem"].ToString(); } SqlDataReader_O.Close(); // Fill pointage machine info SQLRequest_ST = "SELECT * FROM PointageMachine WHERE ComJobEtapeID=" + mComJobEtapeID_UL; SqlDataReader_O = mDataBaseManager_O.Select(SQLRequest_ST); while (SqlDataReader_O.Read()) { if (PointageMachine_UL >= 1 && PointageMachine_UL <= 4) { UInt32.TryParse(SqlDataReader_O["PointageMachinelID"].ToString(), out mPointageMachineID_O[PointageMachine_UL - 1]); } if (PointageMachine_UL == 1) { if (UInt32.TryParse(SqlDataReader_O["MachineID"].ToString(), out MachineID_UL)) { if (UInt32.TryParse(mDataBaseManager_O.GetTableField("Machine", "HallID", "MachineID=" + MachineID_UL), out HallID_UL)) { DBComboxHall1.SelectItemByID(HallID_UL); DBComboxMachine1.SelectItemByID(MachineID_UL); } } TxtNbrhMach1.Text = SqlDataReader_O["NbrHMachine"].ToString(); } else if (PointageMachine_UL == 2) { if (UInt32.TryParse(SqlDataReader_O["MachineID"].ToString(), out MachineID_UL)) { if (UInt32.TryParse(mDataBaseManager_O.GetTableField("Machine", "HallID", "MachineID=" + MachineID_UL), out HallID_UL)) { DBComboxHall2.SelectItemByID(HallID_UL); DBComboxMachine2.SelectItemByID(MachineID_UL); } } TxtNbrhMach2.Text = SqlDataReader_O["NbrHMachine"].ToString(); } else if (PointageMachine_UL == 3) { if (UInt32.TryParse(SqlDataReader_O["MachineID"].ToString(), out MachineID_UL)) { if (UInt32.TryParse(mDataBaseManager_O.GetTableField("Machine", "HallID", "MachineID=" + MachineID_UL), out HallID_UL)) { DBComboxHall3.SelectItemByID(HallID_UL); DBComboxMachine3.SelectItemByID(MachineID_UL); } } TxtNbrhMach3.Text = SqlDataReader_O["NbrHMachine"].ToString(); } else if (PointageMachine_UL == 4) { if (UInt32.TryParse(SqlDataReader_O["MachineID"].ToString(), out MachineID_UL)) { if (UInt32.TryParse(mDataBaseManager_O.GetTableField("Machine", "HallID", "MachineID=" + MachineID_UL), out HallID_UL)) { DBComboxHall4.SelectItemByID(HallID_UL); DBComboxMachine4.SelectItemByID(MachineID_UL); } } TxtNbrhMach4.Text = SqlDataReader_O["NbrHMachine"].ToString(); } PointageMachine_UL++; } SqlDataReader_O.Close(); } }