Ejemplo n.º 1
0
        public override int UpdateDB(object o)
        {
            // custom update assignment
            cInstAssignViewRow d = (cInstAssignViewRow)o;

            if (d != null)
            {
                vlist.Reset();

                vlist.Add("name", d.data[2]);       // assignment name
                vlist.Add("type_num", d.data[3]);   // assignment type
                vlist.Add("is_extra", d.data[4]);   // is extra
                vlist.Add("max_points", d.data[5]); // max points
                vlist.Add("details", d.data[9]);    // details

                string sql = string.Format("{0} WHERE assign_id={1}",
                                           vlist.SQL,
                                           d.data[0]
                                           );

                return(Update("js_assign", sql));
            }

            return(1);
        }
Ejemplo n.º 2
0
        public void RowChanged(int row)
        {
            // instructor
            if (security_level == 1)
            {
                if (sub_state == 0) // section
                {
                    current_section = section_view.GetRow(row);

                    if (current_section != null)
                    {
                        main_form.sectionLink.Text = current_section.ToString();
                    }
                    else
                    {
                        main_form.sectionLink.Text = "";
                    }
                }
                else if (sub_state == 2) // assignment
                {
                    current_assign = inst_assign_view.GetRow(row);

                    if (current_assign != null)
                    {
                        main_form.assignLink.Text = current_assign.ToString();
                    }
                    else
                    {
                        main_form.assignLink.Text = "";
                    }
                }

                UpdateState();
            }
        }
Ejemplo n.º 3
0
        public cInstAssignViewRow GetRow(int row)
        {
            if (row < dlist.Count)
            {
                cInstAssignViewRow d = (cInstAssignViewRow)dlist[row];
                return(d);
            }

            return(null);
        }
Ejemplo n.º 4
0
        public void Logout()
        {
            CurrentYear = DateTime.Now.Year;
            CurrentSem  = "Fall";

            current_view    = null;
            current_id      = -1;
            current_login   = null;
            current_section = null;
            current_assign  = null;
            sub_state       = 0;
            UpdateSecurityLevel(-1);
        }
Ejemplo n.º 5
0
        public override int DeleteDB(object o)
        {
            cInstAssignViewRow d = (cInstAssignViewRow)o;

            if (d != null)
            {
                vlist.Reset();
                vlist.Add("assign_id", d.data[0]);

                return(Delete("js_assign", vlist.SQL));
            }

            return(1);
        }
Ejemplo n.º 6
0
        // for row selection
        public int GetIndex(int id)
        {
            for (int i = 0; i < dlist.Count; i++)
            {
                cInstAssignViewRow d = (cInstAssignViewRow)dlist[i];
                if (d != null)
                {
                    if (id == d.ID)
                    {
                        return(i);
                    }
                }
            }

            return(0);
        }
Ejemplo n.º 7
0
        public override int InsertDB(object o)
        {
            // custom update assignment
            cInstAssignViewRow d = (cInstAssignViewRow)o;

            if (d != null)
            {
                vlist.Reset();

                vlist.AddSeqNextValue("js_assign");
                vlist.Add(Program.main.CurrentSection);
                vlist.Add(d.data[2]);
                vlist.Add(d.data[3]);
                vlist.Add(d.data[4]);
                vlist.Add(d.data[5]);
                vlist.Add(d.data[9]);

                return(Insert("js_assign", vlist.SQL));
            }

            return(1);
        }
Ejemplo n.º 8
0
        public void RowChanged(int row)
        {
            // instructor
            if (security_level == 1)
            {
                if (sub_state == 0) // section
                {
                    current_section = section_view.GetRow(row);

                    if(current_section != null)
                        main_form.sectionLink.Text = current_section.ToString();
                    else
                        main_form.sectionLink.Text = "";
                }
                else if (sub_state == 2) // assignment
                {
                    current_assign = inst_assign_view.GetRow(row);

                    if (current_assign != null)
                        main_form.assignLink.Text = current_assign.ToString();
                    else
                        main_form.assignLink.Text = "";
                }

                UpdateState();
            }
        }
Ejemplo n.º 9
0
        public void Logout()
        {
            CurrentYear = DateTime.Now.Year;
            CurrentSem = "Fall";

            current_view = null;
            current_id = -1;
            current_login = null;
            current_section = null;
            current_assign = null;
            sub_state = 0;
            UpdateSecurityLevel(-1);
        }