示例#1
0
        protected void btnSaveDetailChanges_OnClick(object sender, EventArgs e)
        {
            string name  = txtTopicName.Text;
            string descr = txtDescr.Text;
            int    marks = Convert.ToInt32(txtMark.Text);


            string uId        = Session["user_id"].ToString();
            int    visibility = 0;

            if (!checkVisible.Checked)
            {
                visibility = 1;
            }
            var topicDetails = courseclass.UpdateTopic(name, descr, uId, marks, visibility);

            if (topicDetails.Equals("Success"))
            {
                // display a notification saying project changes successfully implemented
                communicateclass.ShowMessage(this, "Topic Details have been Updated Successfully", clsCommunicate.MessageType.success);

                Response.Redirect("create.aspx?ID=" + authclass.EncryptString(projectclass.lastProjectInsert));
            }
            else
            {
                communicateclass.ShowMessage(this, "There was an error in editing your topic, try again in a few minutes", clsCommunicate.MessageType.error);
            }
        }
示例#2
0
        protected void btnSave_OnClick(object sender, EventArgs e)
        {
            string name       = txtName.Text.ToString().Trim();
            string htmlCode   = this.htmlCode.Text;
            string cssCode    = this.cssCode.Value;
            string jsCode     = this.jsCode.Value;
            string uId        = Session["user_id"].ToString();
            int    visibility = 0;

            if (!chkVisible.Checked)
            {
                visibility = 1;
            }
            var project = projectclass.CreateProject(name, htmlCode, cssCode, jsCode, visibility, uId);

            if (project.Equals("Success"))
            {
                // display a notification saying project changes successfully implemented
                communicateclass.ShowMessage(this, "Project Created Successfully", clsCommunicate.MessageType.success);

                Response.Redirect("create.aspx?ID=" + authclass.EncryptString(projectclass.lastProjectInsert));
            }
            else
            {
                communicateclass.ShowMessage(this, "There was an error in creating your project, try again in a few minutes", clsCommunicate.MessageType.error);
            }
        }
        protected void btnSignIn_Click(object sender, EventArgs e)
        {
            string username, password;

            username = txtUsername.Text;
            password = txtPass.Text;

            var msg = authclass.AuthUser(username, password);
            var uID = msg.uid;

            if (!uID.Equals("-1"))
            {
                if (checkRemember.Checked)
                {
                    Response.Cookies["secureVGC"].Expires    = DateTime.Now.AddDays(30);
                    Response.Cookies["secureMemcld"].Expires = DateTime.Now.AddDays(30);
                }
                else
                {
                    Response.Cookies["secureVGC"].Expires    = DateTime.Now.AddDays(-1);
                    Response.Cookies["secureMemcld"].Expires = DateTime.Now.AddDays(-1);
                }
                Response.Cookies["secureVGC"].Value    = authclass.EncryptString(txtUsername.Text.Trim());
                Response.Cookies["secureMemcld"].Value = authclass.EncryptString(txtPass.Text);


                var dt = userclass.GetUserAccDetails(uID);

                if (dt.Rows[0].Field <string>("Role") == "Admin")
                {
                    Response.Redirect("~/Pages/admin/admin-dashboard.aspx");
                }
                else if (dt.Rows[0].Field <string>("Role") == "Lecturer")
                {
                    Response.Redirect("~/Pages/lecturer/lecturer-dashboard.aspx");
                }
                else if (dt.Rows[0].Field <string>("Role") == "Student")
                {
                    Response.Redirect("~/Pages/student/student-dashboard.aspx");
                }
            }
            else
            {
                communicateclass.ShowMessage(this, "Username/Password combination is incorrect", clsCommunicate.MessageType.error);
            }
        }
        protected string DisplayProjects(string id, string name, string creator, string likes, string comments, string views, string description, string htmlLines, string jssLines, string cssLines, DateTime date)
        {
            var    stream       = new StreamReader(Server.MapPath("~/Pages/student/sampleproject.txt"));
            string projectblock = stream.ReadToEnd();



            projectblock = projectblock.Replace("#projectPP#", null);
            projectblock = projectblock.Replace("#projectName#", name);
            projectblock = projectblock.Replace("#projectCreator#", creator);
            projectblock = projectblock.Replace("#projectCreatedDate#", date.ToString("D"));
            projectblock = projectblock.Replace("#projectHTMLLines#", htmlLines);
            projectblock = projectblock.Replace("#projectCssLines#", cssLines);
            projectblock = projectblock.Replace("#projectJsLines#", jssLines);
            projectblock = projectblock.Replace("#projectLikes#", likes);
            projectblock = projectblock.Replace("#projectComments#", comments);
            projectblock = projectblock.Replace("#projectViews#", views);
            projectblock = projectblock.Replace("#projectDescription#", description);
            projectblock = projectblock.Replace("#projectID#", authclass.EncryptString(id));

            return(projectblock);
        }