示例#1
0
        /// <summary>
        /// Initializes a new instance of the form Shedule class.
        /// </summary>
        public Shedule()
        {
            InitializeComponent();
            cellPos = new int[2];

            grades       = new List <Grade>();
            subjects     = new List <Subject>();
            appointments = new List <Appointment>();

            taskController          = new TaskController();
            repeatingTaskController = new RepeatingTaskController();
            gradeController         = new GradeController();
            subjectController       = new SubjectController();
            appointmentController   = new AppointmentController();

            for (int i = 0; i < dgvShedule.Columns.Count; i++)
            {
                dgvShedule.Columns[i].SortMode = DataGridViewColumnSortMode.NotSortable;
            }

            for (int i = 0; i < 7; i++)
            {
                dgvShedule.Columns[i].HeaderText = DateTime.Today.AddDays(i).ToString("dd-MM-yyyy");
            }

            CleanupExpiredRecords();
            LoadToGrid(typeof(Task));
        }
 /// <summary>
 /// Initializes a new instance of the form AddTask class.
 /// </summary>
 /// <param name="dateTime">DateTime of the task.</param>
 /// <param name="userId">Id of the user who initiated AddTask.</param>
 public AddTask(DateTime dateTime)
 {
     InitializeComponent();
     this.dateTime           = dateTime;
     taskController          = new TaskController();
     repeatingTaskController = new RepeatingTaskController();
     result = 0;
 }
示例#3
0
 /// <summary>
 /// Initializes a new instance of the form DeleteUsers class.
 /// </summary>
 /// <param name="user">User details to extract.</param>
 public DeleteUsers(User user)
 {
     InitializeComponent();
     this.user                    = user;
     userController               = new UserController();
     taskController               = new TaskController();
     repeatingTaskController      = new RepeatingTaskController();
     gradeController              = new GradeController();
     subjectController            = new SubjectController();
     appointmentController        = new AppointmentController();
     dgvUsers.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill;
     LoadToGrid();
 }
        /// <summary>
        /// Initializes a new instance of the form Shedule class.
        /// </summary>
        /// <param name="model">User details to extract.</param>
        public Shedule(User model)
        {
            InitializeComponent();
            this.currentUser  = model;
            this.selectedUser = model;
            cellPos           = new int[2];
            logout            = false;

            grades       = new List <Grade>();
            subjects     = new List <Subject>();
            appointments = new List <Appointment>();

            taskController          = new TaskController();
            repeatingTaskController = new RepeatingTaskController();
            userController          = new UserController();
            gradeController         = new GradeController();
            subjectController       = new SubjectController();
            appointmentController   = new AppointmentController();

            for (int i = 0; i < dgvShedule.Columns.Count; i++)
            {
                dgvShedule.Columns[i].SortMode = DataGridViewColumnSortMode.NotSortable;
            }

            for (int i = 0; i < 7; i++)
            {
                dgvShedule.Columns[i].HeaderText = DateTime.Today.AddDays(i).ToString("dd-MM-yyyy");
            }

            lblUsername.Text = model.Username;
            if (model.Role != "Admin")
            {
                lblViewUser.Visible        = false;
                cbUsernames.Visible        = false;
                lblViewDeleteUsers.Visible = false;
                btnDeleteUser.Visible      = false;
            }
            else
            {
                cbUsernames.Click         += cbUsernames_Click;
                lblViewUser.Visible        = true;
                cbUsernames.Visible        = true;
                lblViewDeleteUsers.Visible = true;
                btnDeleteUser.Visible      = true;
                cbUsernames.Items.Add(currentUser.Username + " (ik)");
                cbUsernames.SelectedIndex = 0;
            }

            CleanupExpiredRecords();
            LoadToGrid(typeof(Task));
        }
 /// <summary>
 /// Initializes a new instance of the form EditTask class.
 /// </summary>
 /// <param name="shedule">Details of the shedule.</param>
 /// <param name="model">Task details to edit.</param>
 /// <param name="dateTime">DateTime to edit.</param>
 public EditTask(Task model, DateTime dateTime)
 {
     InitializeComponent();
     this.dateTime  = dateTime;
     this.taskModel = new Task()
     {
         Id       = model.Id,
         Title    = model.Title,
         Date     = dateTime,
         Duration = model.Duration,
         Label    = model.Label
     };
     taskController          = new TaskController();
     repeatingTaskController = new RepeatingTaskController();
     txtTitle.Text           = model.Title;
     nudDuration.Value       = model.Duration;
     txtLabel.Text           = model.Label;
     result = 0;
 }
 /// <summary>
 /// Initializes a new instance of the form EditTask class.
 /// </summary>
 /// <param name="shedule">Details of the shedule to edit.</param>
 /// <param name="model">Repeating task details to edit.</param>
 /// <param name="dateTime">DateTime to edit.</param>
 public EditTask(RepeatingTask model, DateTime dateTime)
 {
     InitializeComponent();
     this.dateTime           = dateTime;
     this.repeatingTaskModel = new RepeatingTask()
     {
         Id       = model.Id,
         Title    = model.Title,
         Day      = dateTime.ToString("dddd"),
         Time     = model.Time,
         Duration = model.Duration,
         Label    = model.Label
     };
     taskController          = new TaskController();
     repeatingTaskController = new RepeatingTaskController();
     txtTitle.Text           = model.Title;
     nudDuration.Value       = model.Duration;
     txtLabel.Text           = model.Label;
     cbRepeating.Checked     = true;
     result = 0;
 }