public FrmClassesManagement()
        {
            InitializeComponent();

            db = new DbAndBusiness(Commons.PathAndFileDatabase);
            bl = new BusinessLayer(Commons.PathAndFileDatabase);
        }
Пример #2
0
        private void btnFileOldDatabase_Click(object sender, EventArgs e)
        {
            openFileDialog1.InitialDirectory = txtPathOldDatabase.Text;
            DialogResult r = openFileDialog1.ShowDialog();

            if (r == System.Windows.Forms.DialogResult.OK)
            {
                txtFileOldDatabase.Text = Path.GetFileName(openFileDialog1.FileName);
                txtPathOldDatabase.Text = Path.GetDirectoryName(openFileDialog1.FileName);
            }
            if (!File.Exists(txtPathOldDatabase.Text + "\\" + txtFileOldDatabase.Text))
            {
                Console.Beep();
                return;
            }
            dbOld = new DbAndBusiness(
                txtPathOldDatabase.Text + "\\" + txtFileOldDatabase.Text);

            treeOld = new TreeMptt(trwOldTopics,
                                   txtOldTopicName, txtOldDescription, txtSearchOld, null, txtCodOldTopic,
                                   Commons.globalPicLed, DragDropEffects.Copy);
            treeOld.AddNodesToTreeviewByBestMethod();
            treeOld.ClearBackColorOnClick = false;

            highligthDifferences();
        }
Пример #3
0
 public frmMosaic(SchoolGrades.DbClasses.Class Class)
 {
     InitializeComponent();
     db              = new DbAndBusiness(Commons.PathAndFileDatabase);
     currentClass    = Class;
     currentStudents = db.GetStudentsOfClassList(Commons.IdSchool,
                                                 currentClass.SchoolYear, currentClass.Abbreviation, false);
 }
Пример #4
0
        public frmNewYear(string IdStartYear)
        {
            InitializeComponent();

            db = new DbAndBusiness(Commons.PathAndFileDatabase);

            idStartYear = IdStartYear;
        }
        public frmStartLinksManagement(Class CurrentClass)
        {
            InitializeComponent();

            db = new DbAndBusiness(Commons.PathAndFileDatabase);

            currentClass = CurrentClass;
        }
        public frmEditLookupTable(string Table, string IdTable)
        {
            InitializeComponent();

            db = new DbAndBusiness(Commons.PathAndFileDatabase);

            table   = Table;
            idTable = IdTable;
        }
Пример #7
0
        public frmBackupManagement()
        {
            InitializeComponent();

            DbAndBusiness db     = new DbAndBusiness(Commons.PathAndFileDatabase);
            TreeMpttDb    dbMptt = new TreeMpttDb(db);

            topicTreeMptt = new TreeMptt(db, null, null, null, null, null, null, null, DragDropEffects.None);
        }
        /// <summary>
        /// Constructor that passes a list of those to whom the annotation must apply
        /// </summary>
        /// <param name="ChosenStudents"></param>
        /// <param name="IdSchoolYear"></param>
        public frmAnnotationsAboutStudents(List <Student> ChosenStudents, string IdSchoolYear)
        {
            InitializeComponent();

            db = new DbAndBusiness(db.DatabaseName);

            idSchoolYear           = IdSchoolYear;
            this.chosenStudents    = ChosenStudents;
            dgwStudents.DataSource = ChosenStudents;
        }
        public frmTopicChooseByPeriod(TopicChooseFormType FormType,
                                      Class Class, SchoolSubject Subject)
        {
            InitializeComponent();
            db = new DbAndBusiness(Commons.PathAndFileDatabase);

            currentClass   = Class;
            currentSubject = Subject;
            formType       = FormType;
            TopicChosen    = new Topic();
            TopicChosen.Id = 0;
        }
        public frmGradesStudentsSummary(Student Student, string IdSchoolYear,
                                        GradeType GradeType, SchoolSubject SchoolSubject)
        {
            InitializeComponent();
            db                   = new  DbAndBusiness(Commons.PathAndFileDatabase);
            currentStudent       = Student;
            currentSchoolYear    = IdSchoolYear;
            currentGradeType     = GradeType;
            currentSchoolSubject = SchoolSubject;

            lblCurrentStudent.Text = $"{Student.LastName} {Student.FirstName}";
            currentAnnotation      = new StudentAnnotation();
        }
Пример #11
0
        public frmTag(bool IsDialog)
        {
            InitializeComponent();

            db       = new DbAndBusiness(Commons.PathAndFileDatabase);
            isDialog = IsDialog;
            if (isDialog)
            {
                btnChoose.Visible = true;
            }
            else
            {
                btnChoose.Visible = false;
            }
        }
Пример #12
0
        public frmImages(ImagesFormType Type, Lesson Lesson, Class Class,
                         List <SchoolGrades.DbClasses.Image> Images, SchoolSubject Subject)
        {
            InitializeComponent();
            db = new DbAndBusiness(Commons.PathAndFileDatabase);

            listImages     = Images;
            currentLesson  = Lesson;
            currentClass   = Class;
            currentSubject = Subject;

            type = Type;

            lessonImagesPath = currentClass.SchoolYear +
                               currentClass.Abbreviation + "\\Lessons" +
                               "\\" + currentLesson.IdSchoolSubject;
        }
Пример #13
0
        public frmKnotsToTheComb(frmMicroAssessment GrandparentForm, int?IdStudent, SchoolSubject SchoolSubject, string Year)
        {
            InitializeComponent();
            db = new DbAndBusiness(Commons.PathAndFileDatabase);

            currentStudent      = db.GetStudent(IdStudent);
            lblStudent.Text     = currentStudent.LastName + " " + currentStudent.FirstName;
            currentIdSchoolYear = Year;
            currentSubject      = SchoolSubject;
            grandparentForm     = GrandparentForm;

            // fills the lookup tables' combos
            cmbSchoolSubject.DisplayMember = "Name";
            cmbSchoolSubject.ValueMember   = "idSchoolSubject";
            cmbSchoolSubject.DataSource    = db.GetListSchoolSubjects(true);

            currentSubject = SchoolSubject;
            ChosenQuestion = null;
        }
Пример #14
0
        private void btnFileNewDatabase_Click(object sender, EventArgs e)
        {
            openFileDialog1.InitialDirectory = txtPathNewDatabase.Text;
            DialogResult r = openFileDialog1.ShowDialog();

            if (r == System.Windows.Forms.DialogResult.OK)
            {
                txtFileNewDatabase.Text = Path.GetFileName(openFileDialog1.FileName);
                txtPathNewDatabase.Text = Path.GetDirectoryName(openFileDialog1.FileName);
            }

            dbNew = new DbAndBusiness(txtPathNewDatabase.Text + "\\" + txtFileNewDatabase.Text);
            //List<Topic> lNew = dbNew.GetTopicsByParent();

            treeNew = new TreeMptt(dbNew, trwNewTopics,
                                   txtNewTopicName, txtNewDescription, null, null, txtCodNewTopic,
                                   Commons.globalPicLed, DragDropEffects.Copy);
            treeNew.AddNodesToTreeviewByBestMethod();
            treeNew.ClearBackColorOnClick = false;
        }
Пример #15
0
        public frmGroups(List<Student> GroupsList, Class Class, SchoolSubject subject, GradeType grade)
        {
            InitializeComponent();

            listGroups = GroupsList;
            schoolClass = Class;
            schoolSubject = subject;
            schoolGrade = grade;
            db = new DbAndBusiness(Commons.PathAndFileDatabase);

            List<SchoolPeriod> listPeriods = db.GetSchoolPeriods(Class.SchoolYear);
            foreach (SchoolPeriod sp in listPeriods)
            {
                if (sp.DateFinish > DateTime.Now && sp.DateStart < DateTime.Now
                    && sp.IdSchoolPeriodType == "P")
                {
                    schoolPeriod = sp;
                }
            }
        }
Пример #16
0
        internal frmQuestion(QuestionFormType Type, Question Question,
                             SchoolSubject Subject, Class Class, Topic Topic)
        {
            InitializeComponent();

            DbAndBusiness db     = new DbAndBusiness(Commons.PathAndFileDatabase);
            TreeMpttDb    dbMptt = new TreeMpttDb(db);

            // fills the lookup tables' combos
            List <QuestionType> listQuestions = db.GetListQuestionTypes(true);

            cmbQuestionType.DisplayMember = "Name";
            cmbQuestionType.ValueMember   = "idQuestionType";
            cmbQuestionType.DataSource    = listQuestions;

            List <SchoolSubject> listSubjects = db.GetListSchoolSubjects(true);

            cmbSchoolSubject.DisplayMember = "Name";
            cmbSchoolSubject.ValueMember   = "idSchoolSubject";
            cmbSchoolSubject.DataSource    = listSubjects;

            currentClass    = Class;
            currentSubject  = Subject;
            currentQuestion = Question;
            formType        = Type;
            if (formType == QuestionFormType.EditOneQuestion)
            {
                currentQuestion = db.GetQuestionById(Question.IdQuestion);
            }
            if (Topic != null)
            {
                currentTopic = db.GetTopicById(Topic.Id);
                if (currentTopic.Id != 0)
                {
                    txtTopic.Text = dbMptt.GetTopicPath(currentTopic.Id);
                }
            }

            //if (Subject != null)
            //    idSchoolSubject = Subject.IdSchoolSubject;
        }
        public frmGradesClassSummary(Class Class, GradeType GradeType,
                                     SchoolSubject Subject)
        {
            InitializeComponent();

            db = new DbAndBusiness(Commons.PathAndFileDatabase);

            currentClass     = Class;
            currentGradeType = GradeType;
            currentSubject   = Subject;

            // fill the combos of lookup tables
            List <GradeType> listGradeTypes = db.GetListGradeTypes();

            cmbSummaryGradeType.DisplayMember = "Name";
            cmbSummaryGradeType.ValueMember   = "idGradeType";
            cmbSummaryGradeType.DataSource    = listGradeTypes;

            List <SchoolSubject> listSubjects = db.GetListSchoolSubjects(false);

            cmbSchoolSubjects.DisplayMember = "Name";
            cmbSchoolSubjects.ValueMember   = "idSchoolSubject";
            cmbSchoolSubjects.DataSource    = listSubjects;

            List <SchoolPeriod> listPeriods = db.GetSchoolPeriods(Class.SchoolYear);

            cmbSchoolPeriod.DataSource = listPeriods;
            // select the combo item of the partial period of the DateTime.Now
            foreach (SchoolPeriod sp in listPeriods)
            {
                if (sp.DateFinish > DateTime.Now && sp.DateStart < DateTime.Now &&
                    sp.IdSchoolPeriodType == "P")
                {
                    cmbSchoolPeriod.SelectedItem = sp;
                }
            }
            currentClass     = Class;
            currentGradeType = GradeType;
            currentSubject   = Subject;
        }
Пример #18
0
        private void frmLogin_Load(object sender, EventArgs e)
        {
            db = new DbAndBusiness();
            bl = new BusinessLayer.BusinessLayer();

            //// test examples
            //User u;
            //u = new User("pippo", "pluto");
            ////u = new User("pina", "pluto");
            //////u = new User("ugo", "pina");
            ////bl.CreateUser(u);
            //u.Password = "******";
            //bl.ChangePassword(u);

            //u.FirstName = "Ugo";
            //u.LastName = "Fantozzi";
            //u.Email = "*****@*****.**";
            //u.Description = "Inferiore Rag. Ugo Fantozzi";
            //bl.UpdateUser(u);

            //User u1 = bl.GetUser("ugo");
        }
Пример #19
0
        private void frmTopicsRecover_Load(object sender, EventArgs e)
        {
            Commons.ReadConfigFile();
            txtPathNewDatabase.Text = Commons.PathDatabase;
            txtPathOldDatabase.Text = Commons.PathDatabase;
            txtFileNewDatabase.Text = Commons.FileDatabase;

            DbAndBusiness dbNew = new DbAndBusiness(txtPathNewDatabase.Text + "\\" + txtFileNewDatabase.Text);

            treeNew = new TreeMptt(trwNewTopics,
                                   txtNewTopicName, txtNewDescription, txtSearchNew, null, txtCodNewTopic,
                                   Commons.globalPicLed, DragDropEffects.Copy);
            treeNew.AddNodesToTreeviewByBestMethod();
            treeNew.ClearBackColorOnClick = false;

            picNewOnly.BackColor  = colorNewOnly;
            picOldOnly.BackColor  = colorOldOnly;
            picSameId.BackColor   = colorSameId;
            picSameName.BackColor = colorSameName;
            picSameDesc.BackColor = colorSameDesc;
            picSameNodeChangedParent.BackColor   = colorSameNodeChangedParent;
            picSameNodeChangedPosition.BackColor = colorSameNodeChangedPosition;
        }
Пример #20
0
        private void btnFileOldDatabase_Click(object sender, EventArgs e)
        {
            openFileDialog1.InitialDirectory = txtPathOldDatabase.Text;
            DialogResult r = openFileDialog1.ShowDialog();

            if (r == System.Windows.Forms.DialogResult.OK)
            {
                txtFileOldDatabase.Text = Path.GetFileName(openFileDialog1.FileName);
                txtPathOldDatabase.Text = Path.GetDirectoryName(openFileDialog1.FileName);
            }
            if (!File.Exists(txtPathOldDatabase.Text + "\\" + txtFileOldDatabase.Text))
            {
                Console.Beep();
                return;
            }
            dbOld = new DbAndBusiness(
                txtPathOldDatabase.Text + "\\" + txtFileOldDatabase.Text);

            treeOld = new TreeMptt(dbOld, trwOldTopics,
                                   txtOldTopicName, txtOldDescription, txtSearchOld, null, txtCodOldTopic,
                                   Commons.globalPicLed, DragDropEffects.Copy);
            treeOld.Name = "treeOld";
            treeOld.AddNodesToTreeviewByBestMethod();
            treeOld.ClearBackColorOnClick = false;

            // stop background saving thread when using this form so it will not interfere
            // locks a concurrent modification of Commons.BackgroundCanStillSaveTopicsTree
            lock (Commons.LockBackgroundCanStillSaveTopicsTree)
            {
                Commons.BackgroundCanStillSaveTopicsTree = false;
            }
            // we wait for the saving Thread to finish
            // (it aborts in a point in which status is preserved)
            Commons.BackgroundSaveThread.Join(30000); // enormous timeout just for big problems

            highligthDifferences();
        }
Пример #21
0
 public FrmSchoolSubjectManagement()
 {
     InitializeComponent();
     db = new DbAndBusiness(Commons.PathAndFileDatabase);
 }
Пример #22
0
        private void btnRecover_Click(object sender, EventArgs e)
        {
            DbAndBusiness dbNew = new DbAndBusiness(txtPathNewDatabase.Text + "\\" + txtFileNewDatabase.Text);
            List <Topic>  lNew  = dbNew.GetTopics();

            if (txtFileOldDatabase.Text == "")
            {
                Console.Beep();
                return;
            }

            DbAndBusiness dbOld = new DbAndBusiness(txtPathOldDatabase.Text + "\\" + txtFileOldDatabase.Text);
            List <Topic>  lOld  = dbOld.GetTopics();

            int  newIndex    = 0;
            bool newFinished = false;

            foreach (Topic tOld in lOld)
            {
                Topic tNew = lNew[newIndex];
                while (tNew.Id < tOld.Id && !newFinished)
                {
                    tNew = lNew[++newIndex];
                    if (newIndex > lNew.Count)
                    {
                        newFinished = true;
                    }
                }
                if (newFinished)
                {
                    break;
                }
                if (tOld.Id == tNew.Id)
                {
                    if (tOld.Name != tNew.Name || tOld.Desc != tNew.Desc)
                    {
                        if (chkCheckChangesSameId.Checked)
                        {
                            if (MessageBox.Show("Record diversi con lo stesso Id\r\n" +
                                                "Nuovo record = " + tNew.Id + " " + tNew.Name + " " + tNew.Desc + "\r\n" +
                                                "Vecchio record = " + tOld.Id + " " + tOld.Name + " " + tOld.Desc + "\r\n" +
                                                "Sovrascrivere il nuovo record con il vecchio?", "", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                            {
                                // ???? should we save Left Right and Parent ????"
                                dbNew.UpdateTopic(tOld, null);
                            }
                        }
                    }
                }
                else
                {
                    if (chkErasedId.Checked)
                    {
                        if (MessageBox.Show("Id non presente nel nuovo database\r\n" +
                                            "Nuovo record = " + tNew.Id + " " + tNew.Name + " " + tNew.Desc + "\r\n" +
                                            "Vecchio record = " + tOld.Id + " " + tOld.Name + " " + tOld.Desc + "\r\n" +
                                            "Aggiungere il vecchio record nel nuovo database?", "", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                        {
                            // ???? should we save Left Right and Parent ????"
                            dbNew.InsertTopic(tOld, null);
                        }
                    }
                }
            }
            this.Close();
        }
Пример #23
0
 private void frmLogin_Load(object sender, EventArgs e)
 {
     db = new DbAndBusiness();
     bl = new BusinessLayer.BusinessLayer();
 }
Пример #24
0
        public frmTestAssessing()
        {
            InitializeComponent();

            db = new DbAndBusiness(Commons.PathAndFileDatabase);
        }
Пример #25
0
        public frmAnswer()
        {
            InitializeComponent();

            db = new DbAndBusiness(Commons.PathAndFileDatabase);
        }
Пример #26
0
 public TreeMpttDb(DbAndBusiness DatabaseAndBusinessLayer)
 {
     db = DatabaseAndBusinessLayer;
     dl = new DataLayer(DatabaseAndBusinessLayer.DatabaseName);
 }