Esempio n. 1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            HelperClasses.Token myToken = new HelperClasses.Token();

            if (myToken.getToken() == "")
            {
                Response.Redirect("Home.aspx");
            }
            else
            {
                try
                {
                    string url = Request.Url.AbsoluteUri;

                    int uidIndex = url.IndexOf("?uid=") + 5;
                    int fidIndex = url.IndexOf("&fid=");

                    string uid = url.Substring(uidIndex, fidIndex - uidIndex);
                    string fid = url.Substring(fidIndex + 5);

                    int index = url.IndexOf("&fid=");

                    HelperClasses.IvleUserInfo userInfo = new HelperClasses.IvleUserInfo();

                    string userID = userInfo.getUserID();

                    string friendID = url.Substring(index + 5);

                    if (uid == userID)
                    {
                        SqlConnection conn = new SqlConnection();

                        conn.ConnectionString = @"Server=tcp:yq6ulqknjf.database.windows.net,1433;Database=ModulesDB;User ID=rstyle@yq6ulqknjf;Password=Zxcv2345;Trusted_Connection=False;Encrypt=True;Connection Timeout=30;";

                        conn.Open();

                        string insert = "SELECT(friendName) FROM FriendList WHERE userID='" + userID + "' and friendID='" + friendID + "'";
                        SqlCommand cmd = new SqlCommand(insert, conn);

                        chatTitleLabel.Text = (string)cmd.ExecuteScalar();

                        conn.Close();
                    }
                    else
                    {
                        Response.Redirect("Chats.aspx");
                    }
                }
                catch
                {
                    Response.Redirect("Chats.aspx");
                }

            }
        }
Esempio n. 2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            HelperClasses.Token myToken = new HelperClasses.Token();

            if (myToken.getToken() == "")
            {
                Response.Redirect("Home.aspx");
            }
            else
            {
                string url = Request.Url.AbsoluteUri;
                int index = url.IndexOf("?");
                int uidIndex = url.IndexOf("&uid=");
                string title = url.Substring(index + 5, uidIndex - (index + 5));
                title = title.Replace("%20", " ");
                //publicChatLabel.Text = title;
                publicChatLabel.Text = Server.UrlDecode(Request.QueryString["gid"]);
            }
        }
Esempio n. 3
0
        public string getCourseID(string modCode, string acadYear, string sem)
        {
            // string token = (string)(Session["sessionToken"]);
            Token myToken = new Token();
            XmlResponse myXmlResponse = new XmlResponse();

            string token = myToken.getToken();
            string authTokenUrl = "&AuthToken=";
            string getOptionUrl = "Modules_Search?";
            string otherOptionUrl = "&IncludeAllInfo=false";
            string moduleCodeUrl = "&ModuleCode=";
            string semesterUrl = "&Semester=Semester ";
            string acadYearUrl = "&AcadYear=";
            string url = ivleUrl + getOptionUrl + apiKey + authTokenUrl + token + otherOptionUrl +
                moduleCodeUrl + modCode + semesterUrl + sem + acadYearUrl + acadYear;

            string courseIdText = myXmlResponse.getXmlResponse(url);
            string courseID = trimCourseIdText(courseIdText, modCode);

            return courseID;
        }
Esempio n. 4
0
        private HttpCookie isLoginCookie()
        {
            HttpCookie isLoginCookie = new HttpCookie("isLoginCookie");
            Token ivleToken = new Token();

            string token = ivleToken.getToken();

            if (token != "")
            {
                isLoginCookie.Value = "true";

            }
            else
            {
                isLoginCookie.Value = "false";
            }

            isLoginCookie.Expires = DateTime.Now.AddDays(1);
            //userCookie.Expires = DateTime.Now.AddSeconds(2);

            return isLoginCookie;
        }
Esempio n. 5
0
        protected void Page_Load(object sender, EventArgs e)
        {
            HelperClasses.Token myToken = new HelperClasses.Token();

            if (myToken.getToken() == "")
            {
                Response.Redirect("Home.aspx");
            }
        }
Esempio n. 6
0
        private string getMyToken()
        {
            Token myToken = new Token();

            return myToken.getToken();
        }
Esempio n. 7
0
        protected void Page_Load(object sender, EventArgs e)
        {
            HelperClasses.Token myToken = new HelperClasses.Token();

            if (myToken.getToken() == "")
            {
                Response.Redirect("Home.aspx");
            }

            ListModCode = modInfo.getModInfo("CourseCode");
            ListModName = modInfo.getModInfo("CourseName");
            ListCourseSem = modInfo.getSemNum(modInfo.getModInfo("CourseSemester"));
            ListAcadYear = modInfo.getModInfo("CourseAcadYear");

            /* from test friends */

            //groupListDiv.Controls.Add(new LiteralControl() { Text = moduleFriendList() });
            //List<String> ListModName = new List<String>();
            //ListModName = modInfo.getModInfo("CourseName");

            int value = moduleDropDownList.Items.Count;

            if (value < ListModName.Count)
            {
                for (int i = 0; i < ListModName.Count; i++)
                {
                    moduleDropDownList.Items.Add(ListModName[i]);
                }
            }
        }
Esempio n. 8
0
        protected void Page_Load(object sender, EventArgs e)
        {
            HelperClasses.Token myToken = new HelperClasses.Token();

            if (myToken.getToken() == "")
            {
                Response.Redirect("Home.aspx");
            }

            chatGroupListDiv.Controls.Add(new LiteralControl() { Text = getPublicChatListHtml() });
        }
Esempio n. 9
0
        protected void Page_Load(object sender, EventArgs e)
        {
            string userID = userInfo.getUserID();

               HelperClasses.Token myToken = new HelperClasses.Token();

               if (myToken.getToken() == "")
               {
               Response.Redirect("Home.aspx");
               }

                try
                {
                    string url = Request.Url.AbsoluteUri;

                    int docNameIndex = url.IndexOf("?docName=") + 9;
                    int docIdIndex = url.IndexOf("&docId=");
                    int userIdIndex = url.IndexOf("&userId=");

                    string strDocName = url.Substring(docNameIndex, docIdIndex - docNameIndex);
                    string strDocID = url.Substring(docIdIndex + 7, userIdIndex - (docIdIndex + 7));

                    //docTitleLabel.Text = strDocName.Replace("%20", " ");
                    docTitleLabel.Text = Server.UrlDecode(Request.QueryString["docName"]);
                    //renameTextBox.Value = strDocName;

                    SqlWrapper _SqlWrapper = new SqlWrapper(@"Server=tcp:yq6ulqknjf.database.windows.net,1433;Database=ModulesDB;User ID=rstyle@yq6ulqknjf;Password=Zxcv2345;Trusted_Connection=False;Encrypt=True;Connection Timeout=30;");
                    DataTable _DataTable = _SqlWrapper.executeQuery(@"SELECT memberID FROM documents WHERE docId = '" + strDocID + "'");

                    foreach (DataRow _DataRow in _DataTable.Rows)
                    {
                        if (_DataRow["memberID"].ToString() == userID)
                        {
                            SqlConnection conn = new SqlConnection();

                            conn.ConnectionString = @"Server=tcp:yq6ulqknjf.database.windows.net,1433;Database=ModulesDB;User ID=rstyle@yq6ulqknjf;Password=Zxcv2345;Trusted_Connection=False;Encrypt=True;Connection Timeout=30;";

                            conn.Open();

                            string selectData = "SELECT data FROM myDoc WHERE docID='" + strDocID + "';";
                            SqlCommand cmd = new SqlCommand(selectData, conn);

                            SqlDataReader dataReader = null;

                            dataReader = cmd.ExecuteReader();

                            string data = null;

                            while (dataReader.Read())
                            {
                                data = dataReader["data"].ToString();
                            }

                            myText.Value = data;

                            break;
                        }
                    }

                }
                catch { }
        }
Esempio n. 10
0
        /*
        List<String> ListModCode = new List<String>();
        List<String> ListModName = new List<String>();
        List<String> ListCourseSem = new List<String>();
        List<String> ListAcadYear = new List<String>();
         */
        protected void Page_Load(object sender, EventArgs e)
        {
            HelperClasses.Token myToken = new HelperClasses.Token();

            if (myToken.getToken() == "")
            {
                Response.Redirect("Home.aspx");
            }
            /*
            ListModCode = modInfo.getModInfo("CourseCode");
            ListModName = modInfo.getModInfo("CourseName");
            ListCourseSem = modInfo.getSemNum(modInfo.getModInfo("CourseSemester"));
            ListAcadYear = modInfo.getModInfo("CourseAcadYear");
            */
            documentListDiv.Controls.Add(new LiteralControl() { Text = getDocumentListHtml() });
        }
Esempio n. 11
0
        /*
        List<String> ListModCode = new List<String>();
        List<String> ListModName = new List<String>();
        List<String> ListCourseSem = new List<String>();
        List<String> ListAcadYear = new List<String>();
         * */
        protected void Page_Load(object sender, EventArgs e)
        {
            /*
            LinkButton chatLink = (LinkButton)Master.FindControl("chatLinkButton");
            LinkButton logoutLink = (LinkButton)Master.FindControl("logoutLinkButton");
            chatLink.Visible = true;
            logoutLink.Visible = true;
            */

            Master.getVisibleLink();

            HelperClasses.Token myToken = new HelperClasses.Token();

            if (myToken.getToken() == "")
            {
                Response.Redirect("Home.aspx");
            }
            /*
            ListModCode = modInfo.getModInfo("CourseCode");
            ListModName = modInfo.getModInfo("CourseName");
            ListCourseSem = modInfo.getSemNum(modInfo.getModInfo("CourseSemester"));
            ListAcadYear = modInfo.getModInfo("CourseAcadYear");
            */

            /* from test friends */

            //groupListDiv.Controls.Add(new LiteralControl() { Text = moduleFriendList() });
            addFriendToSql();
        }
Esempio n. 12
0
        protected void Page_Load(object sender, EventArgs e)
        {
            /*
                if (isLoginClick ==true)
                {
                    if (isAuthenticated == false)
                    {
                        ivleToken();

                    }
                }
               */
            string url = HttpContext.Current.Request.RawUrl;

            if(url.Contains("?token="))
            {
                ivleToken();
            }
            loginLabel.Text = "Login";
            userLabel.Text = "Login";

            HelperClasses.Token tok = new HelperClasses.Token();
            string token = tok.getToken();
            if (token != "")
            {
                loginLabel.Text = Username();
                userLabel.Text = Username();
                visibleLink();
            }
            else
            {
                loginLabel.Text = "Login";
                userLabel.Text = "Login";
                nonVisibleLink();
            }
        }