Esempio n. 1
0
 /*-----------------------------UPDATING FUNCTIONS-----------------------------*/
 /// <summary>
 /// Updates repositories.
 /// </summary>
 private  void UpdateRepositories() {
     years = new HttpYearsRepository();
     subjects = new HttpSubjectsRepository();
     grades = new HttpSubjectDetailsRepository();
     users = new HttpUsersRepository();
     groups = new HttpGroupsRepository();
     groupDetails = new HttpGroupDetailsRepository();
 }
Esempio n. 2
0
        /// <summary>
        /// Method that handles click on grade label. Left click shows edit grade form to edit given grade.
        /// Right click deletes given grade.
        /// </summary>
        /// <param name="sender">Clicked object</param>
        /// <param name="e">Event parameters</param>
        private async void ShowGradePanel(object sender, LinkLabelLinkClickedEventArgs e)
        {
            var lblSender = sender as LinkLabel;
            var data = (Point)lblSender.Tag;

            var gradesPanel = this.Controls.Find("panel" + data.Y, true).First() as FlowLayoutPanel;

            var repo = new HttpSubjectDetailsRepository();
            var g = await repo.GetOne(data.X);
            //var g = repo.GetGrade(data.X);
            if (e.Button == MouseButtons.Left)
            {
                if (g == null)
                    MessageBox.Show("Test");
                //var editForm = Program.GetKernel().Get<EditGradeForm>(new ConstructorArgument("grade", g));
                var editForm = new EditGradeForm(g);
                editForm.ShowDialog();
                UpdateMainForm();
            }
            else if (e.Button == MouseButtons.Right)
            {
                await repo.DeleteOne(g);
                //repo.DeleteGrade(g);
                //gradesPanel.Controls.Remove(lblSender);
                //Refresh();
                UpdateMainForm();
            }
        }