Exemplo n.º 1
0
        private DataTable fillGridCol()
        {
            int       noOfLec = new StdClass().getNoOfLec(int.Parse(ddlClasses.SelectedValue.ToString()));
            DataTable dt      = new StdClass().GetCourses(int.Parse(ddlClasses.SelectedValue.ToString()));
            DataTable table   = new DataTable();

            if (grid.Columns.Count != noOfLec)
            {
                GridViewDataComboBoxColumn x;
                GridViewDataComboBoxColumn ThisBool = new GridViewDataComboBoxColumn();
                for (int i = 1; i <= noOfLec; i++)
                {
                    table.Columns.Add("Lecture" + i.ToString(), typeof(String));
                    x = grid.Columns["Lecture" + i.ToString()] as GridViewDataComboBoxColumn;
                    if (x == null)
                    {
                        ThisBool              = new GridViewDataComboBoxColumn();
                        ThisBool.Caption      = "Lecture" + i.ToString();
                        ThisBool.FieldName    = "Lecture" + i.ToString();
                        ThisBool.Name         = "Lecture" + i.ToString();
                        ThisBool.VisibleIndex = i + 3;
                        ThisBool.PropertiesComboBox.DataSource = dt;
                        ThisBool.PropertiesComboBox.TextField  = "Name";
                        ThisBool.PropertiesComboBox.ValueField = "ID";
                        ThisBool.Visible = true;
                        grid.Columns.Add(ThisBool);
                    }
                }
            }
            return(table);
        }
Exemplo n.º 2
0
        public CY.GFive.Core.Business.StdClass GetClassByStudentCode(string code)
        {
            StdClass sc = new StdClass();

            SqlServerUtility utility = new SqlServerUtility();
            utility.AddParameter("StdCode", SqlDbType.VarChar, code);

            SqlDataReader reader = utility.ExecuteSqlReader(SQL_GET_CLASS_BY_CODE);

            if (reader != null && !reader.IsClosed)
            {

                if (reader.Read())
                {
                    if (!reader.IsDBNull(0))
                        sc.Id = reader.GetInt32(0);
                    if (!reader.IsDBNull(1))
                        sc.StdCode = reader.GetString(1);
                    if (!reader.IsDBNull(2))
                        sc.ClassCode = reader.GetString(2);
                    if (!reader.IsDBNull(3))
                        sc.State = reader.GetBoolean(3);
                }
                reader.Close();

            }

            return sc;
        }
Exemplo n.º 3
0
        protected void ddlClasses_SelectedIndexChanged(object sender, EventArgs e)
        {
            StdClass st      = new StdClass();
            int      classID = Convert.ToInt32(ddlClasses.SelectedValue.ToString());

            st.getSchdulebyclass(classID);
            DataTable dt = st.ClassSchedule;

            if (dt != null && dt.Rows != null && dt.Rows.Count > 0)
            {
                //   grid.DataSource = dt;
                // grid.DataBind();
                fillGridCol();
            }
            else
            {
                Session["Table"] = null;
                dt = GetTable();
            }
            grid.DataSource = dt;
            grid.DataBind();
            dt.PrimaryKey             = new DataColumn[] { dt.Columns["ID"] };
            dt.Columns["ID"].ReadOnly = true;
            Session["Table"]          = dt;
        }
Exemplo n.º 4
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Request.Cookies["user"] == null)
            {
                Response.Redirect("~/Default.aspx");
            }
            else
            {
                if (!new UserSecurity().CheckFormPermission((int)Global.formSecurity.Classes, Request.Cookies["user"]["Permission"].ToString()))
                {
                    Response.Redirect("~/StudentAfair/UnAuthorized.aspx");
                }
            }
            AddSubmitEvent();
            DataTable dt = new StdClass().getList();

            ASPxGridView1.DataSource = dt;
            ASPxGridView1.DataBind();
            AddSubmitEvent();
            if (!IsPostBack)
            {
                if (Request.QueryString["alert"] == "success")
                {
                    Response.Write("<script>alert('تم الحفظ بنجاح.');</script>");
                }
            }
        }
Exemplo n.º 5
0
        protected void btnEdit_Click(object sender, EventArgs e)
        {
            StdClass sc = new StdClass();

            sc.Name = txtClassName.Text;
            sc.ID   = Convert.ToInt32(Request.QueryString["id"].ToString());
            int EdtYear = 0;

            int.TryParse(ddlEdtYear.SelectedValue.ToString(), out EdtYear);
            sc.EdID = EdtYear;
            int supID = 0;

            int.TryParse(ddlSup.SelectedValue.ToString(), out supID);
            sc.SupID = supID;
            HttpCookie myCookie = Request.Cookies["user"];

            sc.OperatorID      = Convert.ToInt32(myCookie.Values["userid"].ToString());
            sc.CoursesTeachers = Session["table"] as DataTable;
            int id = sc.update();

            if (id > 0)
            {
                Response.Redirect("~/StudentAfair/Classes.aspx?alert=success");
            }
            else
            {
                Response.Redirect("~/StudentAfair/AddClass.aspx?id=0&&alret=notpass");
            }
        }
Exemplo n.º 6
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            StdClass st = new StdClass();

            st.ClassSchedule = Session["Table"] as DataTable;
            st.ID            = Convert.ToInt32(ddlClasses.SelectedValue.ToString());
            st.updateSchdulebyclass();
        }
Exemplo n.º 7
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Request.Cookies["user"] == null)
            {
                Response.Redirect("~/Default.aspx");
            }
            else
            {
                if (!new UserSecurity().CheckFormPermission((int)Global.formSecurity.AddClass, Request.Cookies["user"]["Permission"].ToString()))
                {
                    Response.Redirect("~/StudentAfair/UnAuthorized.aspx");
                }
            }
            if (!IsPostBack)
            {
                if (Request.QueryString["id"].ToString() != null)
                {
                    if (Convert.ToInt32(Request.QueryString["id"].ToString()) > 0)
                    {
                        StdClass sttclass = new StdClass();
                        sttclass.get(Convert.ToInt32(Request.QueryString["id"].ToString()));
                        //txtNoOfStudent.Text=sttclass.
                        txtClassName.Text        = sttclass.Name;
                        ddlEdtYear.SelectedValue = sttclass.EdID.ToString();
                        if (sttclass.SupID != 0)
                        {
                            ddlSup.SelectedValue = sttclass.SupID.ToString();
                        }

                        ASPxGridView1.DataSource = sttclass.CoursesTeachers;
                        ASPxGridView1.DataBind();
                        string    sql = "select ID as TeacherID,Name as TeacherName from Std_Teacher ";
                        DataTable dt  = DataAccess.ExecuteSQLQuery(sql);
                        GridViewDataComboBoxColumn regioncolumn = (ASPxGridView1.Columns["clTeacher"] as GridViewDataComboBoxColumn);
                        regioncolumn.PropertiesComboBox.DataSource = dt;
                        regioncolumn.PropertiesComboBox.ValueField = "TeacherID";
                        regioncolumn.PropertiesComboBox.TextField  = "TeacherName";
                        Session["table"] = sttclass.CoursesTeachers;
                        btnSave.Visible  = false;
                        btnEdit.Visible  = true;
                    }
                    else
                    {
                        btnSave.Visible = true;
                        btnEdit.Visible = false;
                    }
                }
            }
            if (IsPostBack)
            {
                ASPxGridView1.DataSource = Session["table"];
                ASPxGridView1.DataBind();
            }
        }
Exemplo n.º 8
0
        protected void ddlClasses_SelectedIndexChanged(object sender, EventArgs e)
        {
            StdClass st      = new StdClass();
            int      classID = Convert.ToInt32(ddlEmaxName.SelectedValue.ToString());
            //st.getSchdulebyclass(classID);
            int colNo = grid.Columns.Count - 1;
            List <GridViewColumn> cols = new List <GridViewColumn>();

            foreach (GridViewColumn col in grid.Columns)
            {
                if (col.Name == "StudentName" || col.Name == "ID" || col.Name == "#" || col.Name == "Edit")
                {
                    cols.Add(col);
                }
            }
            grid.Columns.Clear();
            for (int i = 0; i < cols.Count; i++)
            {
                grid.Columns.Add(cols[i]);
            }
            //grid.Columns = cols;

            Session["TableDegree"] = null;
            DataTable  dt    = new DataTable();
            DataColumn colid = dt.Columns.Add("ID", typeof(Int32));
            DataColumn Days  = dt.Columns.Add("StudentName", typeof(String));

            fillGridCol(dt);

            /*
             * if (dt != null && dt.Rows != null && dt.Rows.Count > 0)
             * {
             *
             *  //   grid.DataSource = dt;
             *  // grid.DataBind();
             *  fillGridCol(dt);
             * }
             * else
             * {
             *  Session["Table"] = null;
             *  dt = GetTable();
             *
             * }*/
            grid.DataSource = dt;
            grid.DataBind();
            dt.PrimaryKey             = new DataColumn[] { dt.Columns["ID"] };
            dt.Columns["ID"].ReadOnly = true;
            Session["TableDegree"]    = dt;
        }
Exemplo n.º 9
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Request.Cookies["user"] == null)
            {
                Response.Redirect("~/Default.aspx");
            }
            else
            {
                if (!new UserSecurity().CheckFormPermission((int)Global.formSecurity.ViewDocuments, Request.Cookies["user"]["Permission"].ToString()))
                {
                    Response.Redirect("~/StudentAfair/UnAuthorized.aspx");
                }
            }
            if (!IsPostBack)
            {
                if (Request.QueryString["alert"] == "notpass")
                {
                    Response.Write("<script>alert('لم يتم الحفظ');</script>");
                }
                if (Request.QueryString["id"].ToString() != null)
                {
                    if (Convert.ToInt32(Request.QueryString["id"].ToString()) > 0)
                    {
                        Document doc = new Document();
                        doc.get(Convert.ToInt32(Request.QueryString["id"].ToString()));
                        txtName.Text = doc.Name;
                        //FileUpload1.ResolveUrl(doc.URL);
                        Course course = new Course();
                        course.get(doc.CourseID);
                        ddlcourses.Text = course.Name;
                        StdClass stdclass = new StdClass();
                        stdclass.get(doc.ClassID);
                        ddlClasse.Text      = stdclass.Name;
                        btnEdit.Visible     = true;
                        linkButton1.Visible = true;
                        //   downloadUrl = doc.URL;
                    }
                    else
                    {
                        linkButton1.Visible = false;

                        btnEdit.Visible = false;
                    }
                }
            }
        }
Exemplo n.º 10
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            StdClass sc = new StdClass();

            sc.Name = txtClassName.Text;
            int EdtYear = 0;

            int.TryParse(ddlEdtYear.SelectedValue.ToString(), out EdtYear);
            sc.EdID = EdtYear;
            int supID = 0;

            int.TryParse(ddlSup.SelectedValue.ToString(), out supID);
            sc.SupID = supID;
            HttpCookie myCookie = Request.Cookies["user"];

            sc.OperatorID = Convert.ToInt32(myCookie.Values["userid"].ToString());

            /*DataTable dtcourseteacher = new DataTable();
             * dtcourseteacher.Columns.Add("Course");
             * dtcourseteacher.Columns.Add("Teacher");
             * for (int i = 0; i < count; i++)
             * {
             *    string opid1 = "lblCourse" + dt2.Rows[i]["Name"].ToString() ;
             *       Label lblName = (Label)panel.FindControl(opid1);
             *      string Attr;
             *      Attr = "ddlTeacher" + dt3.Rows[i]["Name"].ToString();
             *      DropDownList ddlTeacher = (DropDownList)panel.FindControl(Attr);
             *      DataRow dr = dtcourseteacher.NewRow();
             *      dr["Course"] = lblName.Text;
             *      dr["Teacher"] = ddlTeacher.SelectedValue;
             *      dtcourseteacher.Rows.Add(dr);
             *     }*/
            sc.CoursesTeachers = Session["table"] as DataTable;

            int id = sc.save();

            if (id > 0)
            {
                Response.Redirect("~/StudentAfair/Classes.aspx?alert=success");
            }
            else
            {
                Response.Redirect("~/StudentAfair/AddClass.aspx?id=0&&alret=notpass");
            }
        }
Exemplo n.º 11
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (Request.Cookies["user"] == null)
     {
         Response.Redirect("~/Default.aspx");
     }
     else
     {
         if (!new UserSecurity().CheckFormPermission((int)Global.formSecurity.ViewClass, Request.Cookies["user"]["Permission"].ToString()))
         {
             Response.Redirect("~/StudentAfair/UnAuthorized.aspx");
         }
     }
     if (!IsPostBack)
     {
         if (Request.QueryString["id"].ToString() != null)
         {
             if (Convert.ToInt32(Request.QueryString["id"].ToString()) > 0)
             {
                 StdClass sttclass = new StdClass();
                 sttclass.get(Convert.ToInt32(Request.QueryString["id"].ToString()));
                 EducationalYear edy = new EducationalYear();
                 edy.get(sttclass.EdID);
                 txtClassName.Text = sttclass.Name;
                 ddlEdtYear.Text   = edy.Name;
                 Teacher teacher = new Teacher();
                 teacher.get(sttclass.SupID);
                 ddlSup.Text = teacher.Name;
                 ASPxGridView1.DataSource = sttclass.CoursesTeachers;
                 ASPxGridView1.DataBind();
                 btnEdit.Visible = true;
             }
             else
             {
                 btnEdit.Visible = false;
             }
         }
     }
 }
Exemplo n.º 12
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Request.Cookies["user"] == null)
            {
                Response.Redirect("~/Default.aspx");
            }
            else
            {
                if (!new UserSecurity().CheckFormPermission((int)Global.formSecurity.ViewStudent, Request.Cookies["user"]["Permission"].ToString()))
                {
                    Response.Redirect("~/StudentAfair/UnAuthorized.aspx");
                }
            }
            if (!IsPostBack)
            {
                if (Request.QueryString["id"].ToString() != null)
                {
                    if (Convert.ToInt32(Request.QueryString["id"].ToString()) > 0)
                    {
                        Student student = new Student();
                        student.get(Convert.ToInt32(Request.QueryString["id"].ToString()));
                        lblStudentID.Text = student.ID.ToString();
                        Parent parent = new Parent();
                        lblStudentName.Text = student.Name;
                        parent.get(student.ParentID);
                        lblParentName.Text = parent.Name;
                        lblParentJob.Text  = parent.Job;
                        lblBirthDate.Text  = student.BirthDate.ToShortDateString();
                        DateTime ioct = new DateTime(DateTime.Now.Year, 10, 1);
                        lbl1oct.Text    = (((ioct - student.BirthDate)).TotalDays / 365).ToString();
                        ddlType.Text    = student.Type.ToString();
                        lblAddress.Text = student.Address.ToString();
                        lblPhone.Text   = student.Phone;
                        StdClass sclass = new StdClass();
                        sclass.get(student.StudClass);
                        lblClass.Text    = sclass.Name;
                        lblGender.Text   = student.Gender;
                        lblReligion.Text = student.Religion;
                        if (student.LearningDisabilities == 1)
                        {
                            cbtxtDisabilities.Checked = true;
                        }
                        else
                        {
                            cbtxtDisabilities.Checked = false;
                        }
                        txtDisabilities.Text = student.Note;
                        if (student.Father != 0)
                        {
                            parent.get(student.Father);
                            lblFather.Text   = parent.Name;
                            txtfjob.Text     = parent.Job;
                            txtfPhone.Text   = parent.Phone;
                            txtfAddress.Text = parent.Address;
                        }
                        if (student.Mother != 0)
                        {
                            parent.get(student.Mother);
                            ddlMpther.Text   = parent.Name;
                            txtmJob.Text     = parent.Job;
                            txtmphone.Text   = parent.Phone;
                            txtmAddress.Text = parent.Address;
                        }

                        btnEdit.Visible = true;
                        DataTable dt = new DataTable();//Exams
                        ASPxGridView3.DataSource = dt;
                        ASPxGridView3.DataBind();
                        StdClass c = new StdClass();
                        c.get(student.StudClass);
                        DataTable dt2 = new EducationalYear().GetCourses(c.EdID);//Courses
                        coursesGrid.DataSource = dt2;
                        coursesGrid.DataBind();
                        DataTable dt3 = new Student().getAbsent(int.Parse(lblStudentID.Text));//Absents
                        absentGrid.DataSource = dt3;
                        absentGrid.DataBind();
                    }
                    else
                    {
                        btnEdit.Visible = false;
                    }
                }
                AddSubmitEvent();
            }
            AddSubmitEvent();
        }