protected void Page_Load(object sender, EventArgs e)
        {
            if (Request["lang"] != null)
            {
                if (Request["lang"] == "en")
                {
                    Session["lang"] = "en";
                }
                else
                {
                    Session["lang"] = "my";
                }
            }
            if (HttpContext.Current.Request.Cookies["user_email"]!=null && Session["user_name"]==null)
            {
                CUser userObj = new CUser();
                List<CUser> lstUser=new List<CUser>();
                lstUser=userObj.GetUserByEmail(HttpContext.Current.Request.Cookies["user_email"].Value);
                if (lstUser.Count() > 0)
                {
                    RegisterSession(lstUser);
                    //throw new Exception("cookies");
                }

            }

            if ((string)Session["user_email"] == null)
            {
                Response.Redirect("Login.aspx");
            }

            //initz initObj = new initz();
            //List<Dictionary<string, Object>> primary_nav = new List<Dictionary<string, object>>();
            //primary_nav = initObj.primary_nav;
        }
        public static string Submit(string user_name,string user_password, bool ischecked)
        {
            string strErr = "";
            TextBox txt_login_email;
            TextBox txt_login_password;
            Page page = (Page)HttpContext.Current.Handler;
            if (user_name.Trim() == "" || user_password.Trim() == "")
            {
                strErr = "<div class='alert alert-danger'><i class='fa fa-bell-o'></i>  Username/Email or Password still empty! </div>";
            }
            else
            {

                //           string str_login_email = Microsoft.Security.Application.Encoder.JavaScriptEncode(user_name);
                //           string str_login_password = Microsoft.Security.Application.Encoder.JavaScriptEncode(user_password);

                using (MD5 md5Hash = MD5.Create())
                {
                    CUser userObj = new CUser();
                    string hash = userObj.GetMd5Hash(md5Hash, user_password);
                    List<CUser> lstUser = new List<CUser>();
                    lstUser = userObj.Login(user_name, hash);
                    if (lstUser.Count() > 0)
                    {
                        Login objLogin = new Login();
                        objLogin.RegisterSession(lstUser);
                        if (ischecked == true)
                        {
                            Login objLogin2 = new Login();
                            objLogin2.RegisterCookie(lstUser);
                        }
                    }
                    else
                    {
                        strErr = "<div class='alert alert-danger'><i class='fa fa-bell-o'></i>  Username/Email and Password is wrong! </div>";
                    }
                }

            }
            return strErr;
        }
示例#3
0
        //searches for classes that are available this quarter that student meets requirements for
        protected List<string> QtrClassSearch()
        {
            List<string> currentClasses = new List<string>();
            List<string> needed = new List<string>();
            List<int> reqList = new List<int>();
            int count;

            if (date[1] == 3 || date[1] == 4) count = SummerN;
            else count = QtrN;

            //if you still need intro courses, you can't take any else
            if (introNeeded)
            {
                reqList = new List<int>(introReqID);
                reqList.Sort();
                foreach (int ReqID in reqList)
                {
                    //gets classes offered that have met prereqs
                    needed = ClassesOffered(ReqID);
                    while (count > 0 && needed.Count() > 0 && ReqIDNumberNeeded[ReqID] > 0)
                    {
                        string course = needed[0];
                        needed.Remove(course);
                        ReqIDClassesNeeded[ReqID].Remove(course);

                        if (!studentHistory.Contains(course) && !currentClasses.Contains(course))
                        {
                            ReqIDNumberNeeded[ReqID] = ReqIDNumberNeeded[ReqID] - 1;
                            count = count - 1;
                            currentClasses.Add(course);
                        }
                    }
                }
                if (checkIntro()) introNeeded = false;
            }
            //searches for main courses
            else
            {
                reqList = new List<int>(mainReqID);
                reqList.Sort();
                foreach (int ReqID in reqList)
                {
                    //gets classes offered that have met prereqs
                    needed = ClassesOffered(ReqID);
                    while (count > 0 && needed.Count() > 0 && ReqIDNumberNeeded[ReqID] > 0)
                    {
                        string course = needed[0];
                        needed.Remove(course);
                        ReqIDClassesNeeded[ReqID].Remove(course);

                        //if(course == "GAM 690") resultsBox.Items.Add(new ListItem("Looking at " + course + "in qtrSearch", course));

                        if (!studentHistory.Contains(course) && !currentClasses.Contains(course))
                        {
                            ReqIDNumberNeeded[ReqID] = ReqIDNumberNeeded[ReqID] - 1;
                            count = count - 1;
                            currentClasses.Add(course);
                        }
                    }
                }
            }
            //adds classes to studenthistory
            foreach (string cl in currentClasses) { studentHistory.Add(cl); }
            return currentClasses;
        }