private void AddCheckingToolStripMenuItem_Click(object sender, EventArgs e) { if (mDBManager_O != null && mDBManager_O.mConnected_b) { String JobOrder_ST = mDBManager_O.GetTableField("ComJob", "NumOrdre", "ComJobID=" + DbListViewComJobs.GetSelectedItemID()); String ComJobNumRef_ST = mDBManager_O.GetTableField("ComJobSelectPop", "NumRefInterne", "ComJobID=" + DbListViewComJobs.GetSelectedItemID()); String JobLib_ST = mDBManager_O.GetTableField("ComJob", "JobLib", "ComJobID=" + DbListViewComJobs.GetSelectedItemID()); if (DbListViewComJobs.GetSelectedItemID() > 0) { FormCheckingEdition FormCheckingEdition_O = new FormCheckingEdition(); FormCheckingEdition_O.Initialize(mDBManager_O, DayCheckingViewerCtrl.GetViewerDate(), mUserID_UL, DbListViewComJobs.GetSelectedItemID()); FormCheckingEdition_O.SetFrameTitle("Ajout pointage sur job n° " + JobOrder_ST + " dans " + ComJobNumRef_ST + " : " + JobLib_ST); FormCheckingEdition_O.ShowDialog(); DbListViewComJobs.Refresh(); DayCheckingViewerCtrl.RefreshPersPointage(); // Check if easy to only add one check viewer in list instead of refresh everything } else { MessageBox.Show("Veuillez sélectionner un job pour enregistrer un nouveau pointage.", "Erreur", MessageBoxButtons.OK, MessageBoxIcon.Warning); } } }
/// <summary> /// Constructor /// </summary> public FormChecking(DatabaseManager DBManager_O, UInt32 UserID_UL) { InitializeComponent(); // Init Database Manager mDBManager_O = DBManager_O; mDocManager_O = new DocumentManager(mDBManager_O); mUserID_UL = UserID_UL; DbListViewComJobs.AddToolStripBtn(ToolStripBtnAddChecking); DbListViewComJobs.AddToolStripBtn(ToolStripBtnCloseJob); DbListViewComJobs.AddToolStripBtn(ToolStripBtnAll); FormCheckingToolStrip.Visible = false; // Set drag bar parent window an title this.FormDragBar.SetParentWindow(this); this.FormDragBar.SetTitle("MMSoft - Pointages"); // Initialize db list view com job DbListViewComJobs.ListTitle = "Sélection des jobs"; // Define column DB fields mComJobTableField_ST = new List <String>(); mComJobTableField_ST.Add("NumRefInterne"); mComJobTableField_ST.Add("LibelleCmd"); mComJobTableField_ST.Add("NumCmdClient"); mComJobTableField_ST.Add("ClientNom"); mComJobTableField_ST.Add("NumOrdre"); mComJobTableField_ST.Add("JobLib"); mComJobTableField_ST.Add("Qte"); mComJobTableField_ST.Add("NumPlan"); mComJobTableField_ST.Add("DelaiPromis"); mComJobTableField_ST.Add("JobStatusLib"); //mComJobTableField_ST.Add("DateEncod"); // Unshown elements mComJobTableField_ST.Add("ComJobID"); // Define column headers text mComJobColumnHeaderName_ST = new List <string>(); mComJobColumnHeaderName_ST.Add("Num cmd int"); mComJobColumnHeaderName_ST.Add("Libellé cmd"); mComJobColumnHeaderName_ST.Add("Num cmd client"); mComJobColumnHeaderName_ST.Add("Nom client"); mComJobColumnHeaderName_ST.Add("# job"); mComJobColumnHeaderName_ST.Add("Job libellé"); mComJobColumnHeaderName_ST.Add("Qte"); mComJobColumnHeaderName_ST.Add("Num plan"); mComJobColumnHeaderName_ST.Add("Délai"); mComJobColumnHeaderName_ST.Add("Statut"); //mComJobColumnHeaderName_ST.Add("Date encodage"); // Define column headers objects mComJobTextAlign_O = new List <HorizontalAlignment>(); for (int i = 0; i < mComJobColumnHeaderName_ST.Count; i++) { if (i == 4 || i == 6) { mComJobTextAlign_O.Add(HorizontalAlignment.Center); } else { mComJobTextAlign_O.Add(HorizontalAlignment.Left); } } mComJobColumnHeaderDefaultSize_i = new List <int>(); mComJobColumnHeaderDefaultSize_i.Add(100); mComJobColumnHeaderDefaultSize_i.Add(100); mComJobColumnHeaderDefaultSize_i.Add(150); mComJobColumnHeaderDefaultSize_i.Add(150); mComJobColumnHeaderDefaultSize_i.Add(50); mComJobColumnHeaderDefaultSize_i.Add(600); mComJobColumnHeaderDefaultSize_i.Add(50); mComJobColumnHeaderDefaultSize_i.Add(100); mComJobColumnHeaderDefaultSize_i.Add(100); mComJobColumnHeaderDefaultSize_i.Add(100); mComJobColumnHeaderDefaultSize_i.Add(100); DbListViewComJobs.Initialize(mDBManager_O, "PersComJobSelectPop", mComJobTableField_ST, 10, mComJobColumnHeaderName_ST, mComJobColumnHeaderDefaultSize_i, mComJobTextAlign_O, "JobStatusID < 3 AND PersID=" + mUserID_UL, null); DbListViewComJobs.ItemDoubleClicked += new DBListView.ItemDoubleClickedHandler(ComJobDoubleClick); // Initialize day checking viewer DayCheckingViewerCtrl.Initialize(mDBManager_O, DateTime.Today, mUserID_UL, false); DayCheckingViewerCtrl.RefreshPersPointage(); this.splitContainer1.SplitterDistance = this.Height / 3; // Set menu items renderer MainMenuStrip.RenderMode = ToolStripRenderMode.Professional; MainMenuStrip.Renderer = new CustomMenuItemRenderer(); //Display user name if (mDBManager_O.mConnected_b) { LblUsername.Text = mDBManager_O.GetTableField("Pers", "PersNom", "PersID=" + mUserID_UL); } LblConnectionStatus.Text = mDBManager_O.mDBInstanceName_ST; // Set control style ControlStyle.SetBackgroundStyle(this.splitContainer1); ControlStyle.SetFrameHeaderStyle(this.splitContainer1.Panel1); ControlStyle.SetFrameHeaderStyle(this.splitContainer1.Panel2); ControlStyle.SetBackgroundStyle(MainMenuStrip); ControlStyle.SetBackgroundStyle(this.StatusStripFormChecking); RefreshPersPointage(); }
/// <summary> /// Method that reload the pers pointage according to the date selected by user /// </summary> public void RefreshPersPointage() { DayCheckingViewerCtrl.RefreshPersPointage(); }