Ejemplo n.º 1
0
 public void InitPermissions()
 {
     addStockButton.Enabled      = UserRights.Any(d => d.Libelle_Droit == "writeStocks");
     deleteProductButton.Visible = UserRights.Any(d => d.Libelle_Droit == "writeStocks");
     editButton.Visible          = UserRights.Any(d => d.Libelle_Droit == "writeStocks");
     sellButton.Enabled          = UserRights.Any(d => d.Libelle_Droit == "writeStocks");
 }
Ejemplo n.º 2
0
 public void InitPermissions()
 {
     addIssueButton.Enabled = UserRights.Any(d => d.Libelle_Droit == "writeIssues");
     deleteButton.Visible   = UserRights.Any(d => d.Libelle_Droit == "writeIssues");
     editButton.Visible     = UserRights.Any(d => d.Libelle_Droit == "writeIssues");
     resolveButton.Enabled  = UserRights.Any(d => d.Libelle_Droit == "writeIssues");
 }
Ejemplo n.º 3
0
 public void InitPermissions()
 {
     addEmployeeButton.Enabled          = UserRights.Any(d => d.Libelle_Droit == "writeEmployees");
     dismissButton.Enabled              = UserRights.Any(d => d.Libelle_Droit == "writeEmployees");
     editButton.Visible                 = UserRights.Any(d => d.Libelle_Droit == "writeEmployees");
     permissionButton.Enabled           = UserRights.Any(d => d.Libelle_Droit == "writeEmployees");
     addEmployeePhotoPictureBox.Visible = UserRights.Any(d => d.Libelle_Droit == "writeEmployees");
 }
Ejemplo n.º 4
0
 private void MostAskedLocationsListView_DoubleClick(object sender, EventArgs e)
 {
     if (mostAskedlocationsListView.SelectedItems.Count > 0)
     {
         if (UserRights.Any(d => d.Libelle_Droit == "readMap"))
         {
             int code = int.Parse(mostAskedlocationsListView.SelectedItems[0].Name);
             HomeUserControl.StartLocationsFromStats(code);
         }
         else
         {
             MessageBox.Show(Resources.denied_access);
         }
     }
 }
Ejemplo n.º 5
0
 private void BestClientsListView_DoubleClick(object sender, EventArgs e)
 {
     if (bestClientsListView.SelectedItems.Count > 0)
     {
         if (UserRights.Any(d => d.Libelle_Droit == "readClients"))
         {
             int code = int.Parse(bestClientsListView.SelectedItems[0].Name);
             code = Db.Client.First(i => i.Code_Personne == code).Code_Personne;
             HomeUserControl.StartClientsFromStats(code);
         }
         else
         {
             MessageBox.Show(Resources.denied_access);
         }
     }
 }
Ejemplo n.º 6
0
 private void MostAskedProductsListView_DoubleClick(object sender, EventArgs e)
 {
     if (mostAskedProductsListView.SelectedItems.Count > 0)
     {
         if (UserRights.Any(d => d.Libelle_Droit == "readStocks"))
         {
             var code = int.Parse(mostAskedProductsListView.SelectedItems[0].Name);
             code = Db.Produit.First(i => i.Code_Produit == code).Code_Produit;
             HomeUserControl.StartProductsFromStats(code);
         }
         else
         {
             MessageBox.Show(Resources.denied_access);
         }
     }
 }
Ejemplo n.º 7
0
        private void UpdateEmployeeDetails()
        {
            if (employeesListView.SelectedItems.Count != 0)
            {
                int code     = int.Parse(employeesListView.SelectedItems[0].Name);
                var employee = Db.Employe.Find(code);

                if (employee == null)
                {
                    return;
                }

                surnameTextBox.Text   = employee.Personne.Nom_Personne;
                nameTextBox.Text      = employee.Personne.Prenom_Personne;
                birthDateTextBox.Text = employee.Personne.Date_Naissance.ToShortDateString();
                addressTextBox.Text   = employee.Personne.Adresse;
                phoneTextBox.Text     = employee.Personne.Telephone;
                emailTextBox.Text     = employee.Personne.Email;
                loginTextBox.Text     = employee.Login;

                if (employee.Photo != null)
                {
                    try
                    {
                        MemoryStream ms     = new MemoryStream(employee.Photo);
                        Bitmap       bitmap = new Bitmap(ms);
                        pictureBox.Image = bitmap;
                        ms.Close();
                    }
                    catch (ArgumentException)
                    {
                        //Crashes may occur if file is corrupted or convertion to bitmap fails
                        pictureBox.Image = new Bitmap(Resources.ic_contact_default);
                    }
                }
                else
                {
                    pictureBox.Image = new Bitmap(Resources.ic_contact_default);
                }

                dismissButton.Enabled = (employee.Personne.Code_Personne != 1) &&
                                        UserRights.Any(d => d.Libelle_Droit == "writeEmployees"); //Mr Campo can't be dismissed
                editButton.Visible = (employee.Personne.Code_Personne == LoginTools.Employee.Code_Personne) ||
                                     UserRights.Any(d => d.Libelle_Droit == "writeEmployees");
                passButton.Enabled = (employee.Personne.Code_Personne == LoginTools.Employee.Code_Personne);
            }
        }
Ejemplo n.º 8
0
        private void UpdateIssueDetails()
        {
            if (issuesListView.SelectedItems.Count != 0)
            {
                int code  = int.Parse(issuesListView.SelectedItems[0].Name);
                var issue = Db.Incident.Find(code);

                if (issue != null)
                {
                    idTextBox.Text                    = Resources.hash_symbol + issue.Code_Incident;
                    locationTextBox.Text              = issue.Emplacement.Nom_Emplacement;
                    issueTypeTextBox.Text             = issue.Type_Incident.Type_Incident1;
                    creationDateTextBox.Text          = issue.Date_Incident.ToShortDateString();
                    resolutionDateTextBox.Text        = issue.Date_Resolution?.ToShortDateString() ?? "";
                    criticalityComboBox.SelectedIndex = issue.Criticite_Incident - 1;
                    statusTextBox.Text                = issue.Avancement_Incident;
                    descriptionTextBox.Text           = issue.Description_Incident;

                    resolveButton.Enabled = (issue.Date_Resolution == null) &&
                                            UserRights.Any(d => d.Libelle_Droit == "writeIssues");
                }
            }
        }
Ejemplo n.º 9
0
 private void MostCommonIssuesListView_DoubleClick(object sender, EventArgs e)
 {
     if (mostCommonIssueslistView.SelectedItems.Count > 0)
     {
         if (UserRights.Any(d => d.Libelle_Droit == "readIssues"))
         {
             if (mostCommonIssueslistView.SelectedItems[0].SubItems[2].Text != 0.ToString())
             {
                 int codeType = int.Parse(mostCommonIssueslistView.SelectedItems[0].Name);
                 int code     = Db.Incident.First(i => i.Code_Type == codeType).Code_Incident;
                 HomeUserControl.StartIssuesFromStats(code);
             }
             else
             {
                 MessageBox.Show(Resources.no_issue_corresponding);
             }
         }
         else
         {
             MessageBox.Show(Resources.denied_access);
         }
     }
 }
Ejemplo n.º 10
0
 public void InitPermissions()
 {
     addClientButton.Enabled = UserRights.Any(d => d.Libelle_Droit == "writeClients");
     deleteButton.Visible    = UserRights.Any(d => d.Libelle_Droit == "writeClients");
     editButton.Visible      = UserRights.Any(d => d.Libelle_Droit == "writeClients");
 }