protected void Page_Load(object sender, EventArgs e)
        {
            AchieversDAL dal = new AchieversDAL();

            try
            {
                if (!IsPostBack)
                {
                    if (Request.QueryString["sid"] != null)
                    {
                        Users user = new Users();
                        user                  = (Users)(Session["user"]);
                        sgnName.Text          = user.FullName;
                        studentId             = int.Parse(Request.QueryString["sid"].ToString());
                        stu                   = business.getStudent(studentId);
                        fvStudents.DataSource = stu;
                        fvStudents.DataBind();
                        string deptName = stu[0].ProgramName;
                        int    Year     = stu[0].StartYear;

                        //string filePath = "http://dcm.uhcl.edu/capf17gswen2/DefaultPDF's/UHCL_EM_ACTIVE_COURSE_CATALOG_7133_"+Year+".xlsx";
                        //bool exists = false;
                        //HttpWebRequest request = (HttpWebRequest)System.Net.WebRequest.Create(filePath);
                        //HttpWebResponse response = (HttpWebResponse)request.GetResponse();
                        //exists = CheckIfFileExistsOnServer(filePath);

                        if (File.Exists(AppDomain.CurrentDomain.BaseDirectory + @"DefaultPDF's\UHCL_EM_ACTIVE_COURSE_CATALOG_7133_" + Year + ".xlsx"))
                        {
                            ConfigurationManager.AppSettings["Year"] = Year.ToString();
                        }
                        else
                        {
                            ConfigurationManager.AppSettings["Year"] = DateTime.Now.Year.ToString();
                        }
                        //ConfigurationManager.AppSettings["excelPath"] = Server.MapPath("http://dcm.uhcl.edu/capf17gswen2/DefaultPDF's/UHCL_EM_ACTIVE_COURSE_CATALOG_7133_"+ConfigurationManager.AppSettings["Year"]+".xlsx");

                        GridView1.DataSource = dal.GetAllCourses(deptName);
                        GridView1.DataBind();
                        GridView2.DataSource = dal.GetAllMandatoryCoursesByDept(deptName);
                        GridView2.DataBind();
                        GridView3.DataSource = dal.GetAllElectiveCoursesByDept(deptName);



                        GridView3.DataBind();
                    }
                    else
                    {
                        Response.Redirect("Error.aspx");
                    }
                }
            }
            catch (Exception ex)
            {
                Page.ClientScript.RegisterStartupScript(this.GetType(), "Message", "<script> alert('" + ex.Message + "')</script>");
            }
        }
Ejemplo n.º 2
0
        protected void btn_viewStdCPS_Click(object sender, EventArgs e)
        {
            getstudentdetailspanel.Visible = false;
            vieworprintcpsfac.Visible      = true;
            pnlPrintCPS.Visible            = true;
            List <Student> studentList = bizl.getStudent(int.Parse(txt_view_std_id.Text));

            std              = studentList[0];
            lblName.Text     = std.StudentName;
            lblAdmitted.Text = std.StartYear.ToString();
            lblSemester.Text = std.semester;
            lblDept.Text     = std.ProgramName;
            BindData(std.StudentId);
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Session["userRole"] == null)
            {
                Session["user"] = null;
                Response.Redirect("Login.aspx");
            }
            else if (Session["userRole"].ToString() == "Student")
            {
                Users user = new Users();
                user = (Users)(Session["user"]);
                AchieversBL    bl      = new AchieversBL();
                List <Student> student = bl.getStudent(int.Parse(user.Userid));

                if (student.Count == 1)
                {
                    foreach (Student stu in student)
                    {
                        std = stu;
                    }
                    sgnName.Text = std.StudentName;
                    lblName.Text = std.StudentName;
                }
            }
        }