public FormUpdateProject(Project project)
 {
     InitializeComponent();
     txtProjectCode.Text          = project.ProjectCode;
     txtName.Text                 = project.Name;
     cmbProjectManager.DataSource = broker.getAllUsersWithRole(1);
     this.project                 = project;
 }
 public object getAllUsersWithRole(int v)
 {
     try
     {
         DBBroker broker = new DBBroker();
         return(broker.getAllUsersWithRole(v));
     }
     catch (Exception)
     {
         throw;
     }
 }
        public FormCreateTask(Project project)
        {
            InitializeComponent();
            this.project = project;
            listUsers    = new BindingList <User>(broker.getAllUsersWithRole(2));
            foreach (User user in listUsers)
            {
                cmbDevelopers.Items.Add(user);
            }

            cmbDevelopers.Items.Insert(0, "");

            dtpDeadline.MinDate = DateTime.Today;
        }
 public FormCreateProject(User userLogged)
 {
     InitializeComponent();
     this.userLogged = userLogged;
     if (userLogged.Role == 0)
     {
         cmbProjectManager.DataSource = broker.getAllUsersWithRole(1);
     }
     else
     {
         cmbProjectManager.Visible = false;
         label3.Visible            = false;
     }
     txtProjectCode.Text = randomCodeForProjectCode();
 }
        public FormUpdateTask(Task task)
        {
            InitializeComponent();
            this.task            = task;
            cmbStatus.DataSource = Enum.GetValues(typeof(Status));
            listUsers            = new BindingList <User>(broker.getAllUsersWithRole(2));

            cmbDevelopers.Items.Insert(0, "");
            foreach (User user in listUsers)
            {
                cmbDevelopers.Items.Add(user);
            }
            int i = getCurrentIndex(listUsers);

            cmbDevelopers.SelectedIndex = i;

            cmbDevelopers.SelectedItem = task.Assignee;

            dtpDeadline.Value      = (DateTime)task.Deadline;
            cmbStatus.SelectedItem = (Status)task.Status;
            txtProgress.Text       = (task.Progress * 100).ToString();
            tbxDescription.Text    = task.Description;
        }