private void btnDelete_Click(object sender, EventArgs e)
        {
            if (!cu.is_dataGridView_colored(dataGridViewLevels))
            {
                MessageBox.Show("Nothing is picked on table!");
                return;
            }
            Lessons   les       = new Lessons();
            string    field     = "kod_level";
            string    code      = cu.GetID(dataGridViewLevels);
            DataTable lessonsID = les.GetLessonsByString(field, code);

            foreach (DataRow dr in lessonsID.Rows)
            {
                if (dr[field].ToString().Equals(code) && cu.is_date_in_future(dr["due_date"].ToString()))
                {
                    MessageBox.Show("Cannot delete level with scheduled lessons!");
                    return;
                }
            }
            levels mkk = new levels();

            mkk.Delete(cu.GetID(dataGridViewLevels));
            cu.charge_data_grid_view(mkk.GetLevels(), dataGridViewLevels);
            dataGridViewLevels.ClearSelection();
        }
        private void btnUpdate_Click(object sender, EventArgs e)
        {
            if (!cu.is_dataGridView_colored(dataGridViewLevels))
            {
                MessageBox.Show("Pick something to update");
                return;
            }
            if (textBoxLevel.Text.Equals(""))
            {
                MessageBox.Show("you can't add empty level");
                return;
            }
            if (cu.is_value_exists(dataGridViewLevels, textBoxLevel.Text, 1))
            {
                MessageBox.Show(string.Format("you can't add existing level {0} ! ", textBoxLevel.Text));
                return;
            }
            if (cu.is_one_value_short(textBoxLevel.Text))
            {
                MessageBox.Show("short name");
                return;
            }
            string a  = cu.GetID(dataGridViewLevels);
            levels mk = new levels();

            mk.Update(a, textBoxLevel.Text);
            cu.charge_data_grid_view(mk.GetLevels(), dataGridViewLevels);
            cu.stay_on_added_value(textBoxLevel.Text, dataGridViewLevels, 1);
        }
Exemplo n.º 3
0
        public string Get_Value_of_level(string code)
        {
            levels    k       = new levels();
            DataTable classes = k.GetLevelByCode(code);

            return(classes.Rows[0]["rama"].ToString());
        }
        private void frmLevelsProject_Load(object sender, EventArgs e)
        {
            levels mik = new levels();

            cu.charge_data_grid_view(mik.GetLevels(), dataGridViewLevels);
            cu.make_dgv_non_sortable(dataGridViewLevels);
            dataGridViewLevels.ClearSelection();
        }
Exemplo n.º 5
0
        public void can_teach_create_test_data()
        {
            MorimProject mp    = new MorimProject();
            kita         kit   = new kita();
            levels       level = new levels();
            MikP         mik   = new MikP();

            DataTable morim       = mp.GetMorim();
            DataTable kitot       = kit.GetKita();
            DataTable ramot       = level.GetLevels();
            DataTable mikzoot     = mik.GetMikzoot();
            Random    ran         = new Random();
            int       top_morim   = morim.Rows.Count;
            int       top_kitot   = kitot.Rows.Count;
            int       top_ramot   = ramot.Rows.Count;
            int       top_mikzoot = mikzoot.Rows.Count;

            for (int i = 0; i < 200; i++)
            {
                int morim_row   = ran.Next(0, top_morim);
                int kitot_row   = ran.Next(0, top_kitot);
                int ramot_row   = ran.Next(0, top_ramot);
                int mikzoot_row = ran.Next(0, top_mikzoot);

                string code_more  = morim.Rows[morim_row]["id"].ToString();
                string code_kita  = kitot.Rows[kitot_row]["Code"].ToString();
                string code_level = ramot.Rows[ramot_row]["code"].ToString();
                string mik_code   = mikzoot.Rows[mikzoot_row]["mikCode"].ToString();

                CanTeachProject ct = new CanTeachProject();
                try
                {
                    ct.AddCanTeachProject(int.Parse(code_kita), int.Parse(code_level), int.Parse(mik_code), code_more);
                }
                catch
                { }
            }
        }
Exemplo n.º 6
0
        private void frmBigForm_Load(object sender, EventArgs e)
        {
            MikP mik = new MikP();

            dataGridViewMikP.DataSource = mik.GetMikzoot();
            cu.clean_dataGridView(dataGridViewMikP);
            levels level = new levels();

            dataGridViewLevels.DataSource = level.GetLevels();
            cu.clean_dataGridView(dataGridViewLevels);
            kita kita = new kita();

            dataGridViewKita.DataSource = kita.GetKita();
            cu.clean_dataGridView(dataGridViewKita);
            tan();

            cu.clean_dataGridView(dataGridViewZmanProject);
            cu.zman(dataGridViewZmanProject);
            first = true;
            cu.make_dgv_non_sortable(dataGridViewKita, dataGridViewLevels, dataGridViewMikP, dataGridViewMorimProject, dataGridViewStudents, dataGridViewZmanProject);
            dataGridViewStudents.ClearSelection();
            dataGridViewZmanProject.ClearSelection();
        }
        private void btnAdd_Click(object sender, EventArgs e)
        {
            if (textBoxLevel.Text.Equals(""))
            {
                MessageBox.Show("you can't add empty level");
                return;
            }
            if (cu.is_value_exists(dataGridViewLevels, textBoxLevel.Text, 1))
            {
                MessageBox.Show(string.Format("you can't add existing level {0} ! ", textBoxLevel.Text));
                return;
            }
            if (cu.is_one_value_short(textBoxLevel.Text))
            {
                MessageBox.Show("short name");
                return;
            }
            levels mik = new levels();

            mik.AddLevel(textBoxLevel.Text);
            cu.charge_data_grid_view(mik.GetLevels(), dataGridViewLevels);
            cu.stay_on_added_value(textBoxLevel.Text, dataGridViewLevels, 1);
        }
Exemplo n.º 8
0
        public void create_lessons()
        {
            kita         kit   = new kita();
            levels       level = new levels();
            MikP         mik   = new MikP();
            BigForm      bf    = new BigForm();
            Student      st    = new Student();
            PanuiProject pp    = new PanuiProject();
            Lessons      les   = new Lessons();

            DataTable kitot   = kit.GetKita();
            DataTable ramot   = level.GetLevels();
            DataTable mikzoot = mik.GetMikzoot();
            Random    ran     = new Random();

            int top_kitot   = kitot.Rows.Count;
            int top_ramot   = ramot.Rows.Count;
            int top_mikzoot = mikzoot.Rows.Count;

            for (int i = 0; i < 800; i++)
            {
                int kitot_row   = ran.Next(0, top_kitot);
                int ramot_row   = ran.Next(0, top_ramot);
                int mikzoot_row = ran.Next(0, top_mikzoot);

                string code_kita  = kitot.Rows[kitot_row]["Code"].ToString();
                string code_level = ramot.Rows[ramot_row]["code"].ToString();
                string mik_code   = mikzoot.Rows[mikzoot_row]["mikCode"].ToString();

                DataTable morim = bf.GetMorim(int.Parse(mik_code), int.Parse(code_level), int.Parse(code_kita));
                if (morim.Rows.Count == 0)
                {
                    continue;
                }
                int       teacher_index = ran.Next(0, morim.Rows.Count);
                string    teacher_id = morim.Rows[teacher_index]["id"].ToString();
                DataTable students = st.GetStudents();
                int       student_index = ran.Next(0, students.Rows.Count);
                string    student_id = students.Rows[student_index]["tz"].ToString();
                int       mon = ran.Next(4, 8);
                int       day = ran.Next(1, 30);
                string    yom, hod;
                if (day < 10)
                {
                    yom = "0" + day.ToString();
                }
                else
                {
                    yom = day.ToString();
                }
                if (mon < 10)
                {
                    hod = "0" + mon.ToString();
                }
                else
                {
                    hod = mon.ToString();
                }
                string    due     = yom + "/" + hod + "/2016";
                int       in_week = (int)(DateTime.ParseExact(due, "d/M/yyyy", null).DayOfWeek) + 1;
                DataTable panui   = pp.GetPanuiForDay(in_week, teacher_id);
                if (panui.Rows.Count == 0)
                {
                    continue;
                }
                int panui_index = ran.Next(0, panui.Rows.Count);
                int start       = int.Parse(panui.Rows[panui_index]["shaa"].ToString());
                int end         = start;
                int counter     = 0;
                while (counter < panui.Rows.Count)
                {
                    if (int.Parse(panui.Rows[counter]["shaa"].ToString()) - 1 == end)
                    {
                        end++;
                    }
                    counter++;
                }
                DataTable lessons_for_teacher = bf.GetLessonTimeDetailsForTeacher(teacher_id);
                DataTable lessons_for_student = les.GetLessonsByStudentId(student_id);
                bool      flag = true;
                if (lessons_for_teacher.Rows.Count != 0)
                {
                    foreach (DataRow dr in lessons_for_teacher.Rows)
                    {
                        if (dr["due_date"].ToString().Equals(due) && dr["start_time"].ToString().Equals(start) && dr["end_time"].ToString().Equals(end))
                        {
                            flag = false;
                        }
                    }
                }
                if (lessons_for_student.Rows.Count != 0)
                {
                    foreach (DataRow dr in lessons_for_student.Rows)
                    {
                        if (dr["due_date"].ToString().Equals(due) && dr["start_time"].ToString().Equals(start) && dr["end_time"].ToString().Equals(end))
                        {
                            flag = false;
                        }
                    }
                }
                if (!flag)
                {
                    continue;
                }

                les.AddLessons(teacher_id, student_id, int.Parse(mik_code), int.Parse(code_kita), int.Parse(code_level), due, start, end, "");
            }
        }