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.EducationYears, Request.Cookies["user"]["Permission"].ToString()))
                {
                    Response.Redirect("~/StudentAfair/UnAuthorized.aspx");
                }
            }
            AddSubmitEvent();
            DataTable dt = new EducationalYear().getList();

            ASPxGridView1.DataSource = dt;
            ASPxGridView1.DataBind();
            AddSubmitEvent();
            if (!IsPostBack)
            {
                if (Request.QueryString["alert"] == "success")
                {
                    Response.Write("<script>alert('تم الحفظ بنجاح.');</script>");
                }
            }
        }
Beispiel #2
0
        private void FillGrid()
        {
            if (Request.QueryString["id"].ToString() != null)
            {
                System.Data.DataTable dt = new DataTable();
                string sql = "";
                if (Session["Table"] == null)
                {
                    ddlOldEdyYear.SelectedValue = Request.QueryString["id"].ToString();
                    sql = "select ID,Name as oldClass,'' as newClass from Std_Class where EdyID = " + Request.QueryString["id"].ToString();
                    dt  = DataAccess.ExecuteSQLQuery(sql);
                    Session["Table"] = dt;
                }
                else
                {
                    dt = Session["Table"] as DataTable;
                }
                grid.DataSource = dt;
                grid.DataBind();

                sql = "select ID,Name as oldClass from Std_Class where EdyID = " + ddlOldEdyYear.SelectedValue.ToString();
                dt  = DataAccess.ExecuteSQLQuery(sql);
                GridViewDataComboBoxColumn regioncolumn = (grid.Columns["oldClass"] as GridViewDataComboBoxColumn);
                regioncolumn.PropertiesComboBox.DataSource = dt;
                regioncolumn.PropertiesComboBox.ValueField = "ID";
                regioncolumn.PropertiesComboBox.TextField  = "oldClass";
                regioncolumn.ReadOnly = true;

                FillNewClass();
                if (ddlOldEdyYear.SelectedValue != "")
                {
                    //get students in this year didn't pay the total money
                    DataTable notPaid = new EducationalYear().getStudentnotPaid(int.Parse(ddlOldEdyYear.SelectedValue.ToString()));
                    if (notPaid != null)
                    {
                        studentnotPaid.Visible    = true;
                        studentnotPaid.DataSource = notPaid;
                        studentnotPaid.DataBind();
                    }
                    else
                    {
                        studentnotPaid.Visible = false;
                    }
                }
                else
                {
                    studentnotPaid.Visible = false;
                }
            }
        }
Beispiel #3
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.ViewYear, 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)
             {
                 EducationalYear ed = new EducationalYear();
                 ed.get(Convert.ToInt32(Request.QueryString["id"].ToString()));
                 lblEducationYearID.Text   = ed.ID.ToString();
                 lblEducationYearName.Text = ed.Name;
                 lblRank.Text             = ed.Rank.ToString();
                 lblLastModifiedDate.Text = ed.LastModifiedDate.ToString();
                 lblCreationDate.Text     = ed.CreationDate.ToString();
                 txtBreakFrom.Text        = ed.Breaks.Rows[0]["BreakFrom"].ToString();
                 txtBreakTo.Text          = ed.Breaks.Rows[0]["BreakTo"].ToString();
                 txtLecTime.Text          = ed.LecTimeMin.ToString();
                 txtNoOfLec.Text          = ed.NoOfLec.ToString();
                 DataTable dt = ed.GetClasses(ed.ID);
                 ASPxGridView2.DataSource = dt;
                 ASPxGridView2.DataBind();
                 DataTable dt2 = ed.GetCourses(ed.ID);
                 ASPxGridView1.DataSource = dt2;
                 ASPxGridView1.DataBind();
                 btnEdit.Visible = true;
             }
             else
             {
                 btnEdit.Visible = false;
             }
         }
     }
     AddSubmitEvent();
 }
Beispiel #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.AddYear, 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)
                    {
                        EducationalYear ed = new EducationalYear();
                        ed.get(Convert.ToInt32(Request.QueryString["id"].ToString()));

                        txtYearName.Text      = ed.Name;
                        ddlRank.SelectedValue = ed.Rank.ToString();
                        txtNoOfLec.Text       = ed.NoOfLec.ToString();
                        txtLecTime.Text       = ed.LecTimeMin.ToString();
                        if (ed.Breaks != null && ed.Breaks.Rows != null && ed.Breaks.Rows.Count > 0)
                        {
                            txtBreakFrom.Text = ed.Breaks.Rows[0]["BreakFrom"].ToString();
                            txtBreakTo.Text   = ed.Breaks.Rows[0]["BreakTo"].ToString();
                        }
                        btnSave.Visible = false;
                        btnEdit.Visible = true;
                    }
                    else
                    {
                        btnSave.Visible = true;
                        btnEdit.Visible = false;
                    }
                }
            }
        }
Beispiel #5
0
        protected void btnEdit_Click(object sender, EventArgs e)
        {
            EducationalYear ed = new EducationalYear();

            ed.Name = txtYearName.Text;
            ed.ID   = Convert.ToInt32(Request.QueryString["id"].ToString());
            int Yrank = 0;

            int.TryParse(ddlRank.SelectedValue, out Yrank);
            ed.Rank = Yrank;

            int YNoLec = 0;

            int.TryParse(txtNoOfLec.Text, out YNoLec);
            ed.NoOfLec = YNoLec;

            int YLecPeriod = 0;

            int.TryParse(txtLecTime.Text, out YLecPeriod);
            ed.LecTimeMin = YLecPeriod;
            DataTable dt = new DataTable();

            dt.Columns.Add("BreakFrom");
            dt.Columns.Add("BreakTo");
            DataRow dr = dt.NewRow();

            dr["BreakFrom"] = txtBreakFrom.Text;
            dr["BreakTo"]   = txtBreakTo.Text;
            dt.Rows.Add(dr);
            ed.Breaks = dt;
            HttpCookie myCookie = Request.Cookies["user"];

            ed.OperatorID = Convert.ToInt32(myCookie.Values["userid"].ToString());
            int id = ed.update();

            if (id > 0)
            {
                Response.Redirect("~/StudentAfair/EducationYears.aspx?alert=success");
            }
            else
            {
                Response.Redirect("~/StudentAfair/AddYear.aspx?id=0&&alret=notpass");
            }
        }
Beispiel #6
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;
             }
         }
     }
 }
Beispiel #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.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();
        }