// Constructeur public UcUpdateOperator(int iIdOperator) { InitializeComponent(); InitializeDisplay(); dOperator = GetOperatorToUpdateData(iIdOperator); InitializeControlsData(); }
// Méthodes #region Méthodes // Affichage #region Affichage private void InitializeDisplay(T_OPERATOR connectedOperator) { // Permet de : // - positionner les controls par rapport à la page // - définir leur taille // Pour les information Ticket this.pnlInformations.Height = (int)(this.Height * 0.85); this.InitializeDisplayInformation(); this.InitializeDisplayHistory(); // Control panel design this.pnlDesign.Height = (int)(this.Height * 0.15); this.lblIndicatorTicketOwner.Width = (int)(this.pnlDesign.Width * 0.05); iDefaultHeight = this.Height; // Affichage selon type droit // Liste des droit de l'utilisateur List <string> liOperatorRights = (from r in Program.dcIndusDev.T_RIGHT join tj in Program.dcIndusDev.TJ_RIGHT_OPERATOR_TYPE on r.ID_RIGHT equals tj.ID_RIGHT where tj.ID_OPERATOR_TYPE == connectedOperator.ID_OPERATOR_TYPE select r.NAME_RIGHT).ToList(); // - Droit de modifiaction this.ptbxEdit.Visible = (liOperatorRights.Contains("Modification Ticket")) ? true : false; // - Droit de suppression this.ptbxDelete.Visible = (liOperatorRights.Contains("Suppression Ticket")) ? true : false; }
/*_____________________________________________________________________________________________*/ // Méthodes #region Méthodes // Affichage #region Affichage private void InitializeDisplay(T_OPERATOR connectedOperator) { // Permet de : // - positionner les controls par rapport à la page // - définir leur taille this.pnlManagement.Width = (int)(this.Width * 0.4); this.pnlMenu.Height = (int)(this.Height * 0.05); // Menu this.InitializeDisplayMenu(connectedOperator); // Titre champs this.InitializeDisplayField(); }
/*_____________________________________________________________________________________________*/ // Récupérer les informations du formulaire private T_OPERATOR GetOperatorData() { T_OPERATOR dOperator = new T_OPERATOR(); // Prénom, nom, login, mot de passe, type d'opérateur dOperator.FIRST_NAME_OPERATOR = tbxOperatorFirstName.Text; dOperator.LAST_NAME_OPERATOR = tbxOperatorLastName.Text; dOperator.LOGIN_OPERATOR = CreateOperatorLogin(tbxOperatorFirstName.Text, tbxOperatorLastName.Text, GetOperatorId()); dOperator.PASSWORD_OPERATOR = DateTime.Now.Year.ToString() + "TicketManager!"; dOperator.T_OPERATOR_TYPE = (from t in Program.dcIndusDev.T_OPERATOR_TYPE where t.NAME_OPERATOR_TYPE == cbbxOperatorType.SelectedItem.ToString() select t).FirstOrDefault(); ; return(dOperator); }
/*_____________________________________________________________________________________________*/ private void InitializeDisplayMenu(T_OPERATOR connectedOperator) { // Controls du pnlMenu // Boutons this.btnDisconnect.Width = (int)(this.pnlMenu.Width * 0.15); // Images Size sPtb = new Size((int)(this.pnlMenu.Height * 0.9), (int)(this.pnlMenu.Height * 0.9)); this.ptbAddTicketOrOperator.Size = sPtb; // Permet de moduler l'affichage si l'utilisateur connecté est un administrateur ou non if (connectedOperator.T_OPERATOR_TYPE.NAME_OPERATOR_TYPE == "Administrateur") { this.btnTicketsOrOperateur.Visible = true; this.btnTicketsOrOperateur.Width = (int)(this.pnlMenu.Width * 0.1); // Le bouton de modification des droits est disponible qu'en mode de saisie operateur (bEntryMode = false) if (!bEntryMode) { this.ptbAddTicketOrOperator.Location = new Point((int)(this.pnlMenu.Width * 0.5 + this.ptbUpdateOperatorRights.Width * 2.2), (int)(this.pnlMenu.Height * 0.05)); this.ptbUpdateOperatorRights.Visible = true; this.ptbUpdateOperatorRights.Size = sPtb; this.ptbUpdateOperatorRights.Location = new Point((int)(this.pnlMenu.Width * 0.5 - this.ptbUpdateOperatorRights.Width * 1.2), (int)(this.pnlMenu.Height * 0.05)); } else { this.ptbAddTicketOrOperator.Location = new Point((int)(this.pnlMenu.Width * 0.5 - this.ptbAddTicketOrOperator.Width * 0.5), (int)(this.pnlMenu.Height * 0.05)); this.ptbUpdateOperatorRights.Visible = false; } } else { this.btnTicketsOrOperateur.Visible = false; this.ptbAddTicketOrOperator.Location = new Point((int)(this.pnlMenu.Width * 0.5 - this.ptbAddTicketOrOperator.Width * 0.5), (int)(this.pnlMenu.Height * 0.05)); this.ptbUpdateOperatorRights.Visible = false; } }
/*_____________________________________________________________________________________________*/ // Ajouter nouvel opérateur (intervevant, technicien ou administrateur) private void AddOperator(T_OPERATOR dOperator) { Program.dcIndusDev.T_OPERATOR.InsertOnSubmit(dOperator); }