private void LoadStudentEachProgram()
 {
     Security mySecurity = new Security();
          DAL myDal = new DAL(conn);
          GVStudentEachProgram.DataSource = myDal.ExecuteProcedure("spGetStudentEachProgram");
          GVStudentEachProgram.DataBind();
 }
 private void LoadQutionNumberByExam()
 {
     Security mySecurity = new Security();
     DAL myDal = new DAL(conn);
     GVNumberofQutionbyExam.DataSource = myDal.ExecuteProcedure("spGetQutionNumberbyExam");
     GVNumberofQutionbyExam.DataBind();
 }
예제 #3
0
        protected void btnRegister_Click(object sender, EventArgs e)
        {
            if (Page.IsValid)
            {
                string conn = ConfigurationManager.ConnectionStrings["Connection"].ConnectionString;
                DAL myDal = new DAL(conn);
                DataSet dsRegister = new DataSet();
                myDal.AddParam("@FullName", txtFullName.Text);
                myDal.AddParam("@Email", txtEmail.Text);
                myDal.AddParam("@Password", txtPassword.Text);
                dsRegister = myDal.ExecuteProcedure("spCreateUser");

                if (dsRegister.Tables[0].Rows[0]["Message"].ToString() == "Error")
                {
                    lblMessage.Text = "Error account has already been created";
                    lblMessage.ForeColor = System.Drawing.Color.Red;

                }
                else
                {
                    lblMessage.Text = "User Created, Please go to Log In to continue";
                    //ConfirmationEmail();
                    //lblEmail.Text = "A confirmation email has been sent to your email address";
                }
            }
        }
        protected void BtnACtive_Click(object sender, EventArgs e)
        {
            DAL mydal = new DAL(conn);
            DataSet ds = new DataSet();
            DateTime start = Convert.ToDateTime(txtStartDate.Text);
            DateTime end = Convert.ToDateTime(txtEndDate.Text);
            //   DateTime starttime = Convert.ToDateTime(txtStartTime.Text);
            //// BASED ON txtStartTime.Text somehow
            int hours = Int32.Parse(dd1startH.SelectedValue);
            int minutes = Int32.Parse(dd1startM.SelectedValue);
            start = start.AddHours(hours).AddMinutes(minutes);

            int Ehours = Int32.Parse(dd2EndH.SelectedValue);
            int Eminutes = Int32.Parse(dd2EndM.SelectedValue);
            end = end.AddHours(Ehours).AddMinutes(Eminutes);

            mydal.AddParam("@StartTime", start);
            mydal.AddParam("@EndTime", end);
            mydal.AddParam("@QuizId", ddQuiz.SelectedValue);
            mydal.AddParam("@SessionId", ddSession.SelectedValue);
            ds = mydal.ExecuteProcedure("spActiveExam");
            string result = ds.Tables[0].Rows[0]["Result"].ToString();
            if (result == "Success")
            {
                lblMsg.Text = "Exam Actived";
            }
            else
            {
                lblMsg.Text = "something Wrong .Try Later!!";
            }
        }
 public void loadgvUserBookedRooms()
 {
     DAL d = new DAL(conn);
     d.AddParam("@UserID", mySecurity.UserID);
     gvUserBookedRooms.DataSource = d.ExecuteProcedure("spGetBookingsForUser");
     gvUserBookedRooms.DataBind();
 }
예제 #6
0
        public Security(string Email, String Password)
        {
            DataSet ds = new DataSet();

                DAL myDal = new DAL(ConfigurationManager.ConnectionStrings["Exam"].ConnectionString);
                myDal.ClearParams();
                myDal.AddParam("@Email", Email + ConfigurationManager.AppSettings["EmailDomainName"]);
                myDal.AddParam("@Password", Password);
                ds = myDal.ExecuteProcedure("UserspLogin");

                if (ds.Tables[0].Rows.Count == 0)
                {
                    SecurityLevel = 0;
                    Firstname = "Invalid Login";
                    Userid = -1;

                }
                else
                {
                    SecurityLevel = Convert.ToInt32(ds.Tables[0].Rows[0]["SecurityLevel"].ToString());
                    Firstname = "Welcome " + ds.Tables[0].Rows[0]["FirstName"].ToString() + "!";
                    Userid = Convert.ToInt32(ds.Tables[0].Rows[0]["Userid"].ToString());
                }
                HttpContext.Current.Session["Firstname"] = Firstname;
                HttpContext.Current.Session["SecurityLevel"] = SecurityLevel;
                HttpContext.Current.Session["Userid"] = Userid;
        }
 protected void ddtest_SelectedIndexChanged(object sender, EventArgs e)
 {
     DAL myDal = new DAL(conn);
     myDal.AddParam("@QuizId",ddtest.SelectedValue);
     GVQuizResponseByUser.DataSource = myDal.ExecuteProcedure("spGetAllQuizReponsesByQuizId");
     GVQuizResponseByUser.DataBind();
 }
예제 #8
0
        protected void BtnSubmit_Click(object sender, EventArgs e)
        {
            try
            {
                string clientID = (string)Session["ClientID"];
                foreach (ItemSales item in listOfSales.Sales)
                {
                    DAL_Project.DAL d = new DAL_Project.DAL(@"Data Source=localhost;Initial Catalog=dbDeidreFinalAssign;Integrated Security=SSPI");
                    d.AddParam("@ClientID", clientID);
                    d.AddParam("@Item", item.item);
                    d.AddParam("@TotalSale", item.SubTotalPrice.ToString());
                    d.AddParam("@Quantity", item.Quantity.ToString());
                    d.ExecuteProcedure("spItemSalesOrder");
                }

            }
            catch (Exception ex)
            {
                lblError.Text = "Opps, Something went wrong. Please try again later! " + ex.Message;
            }

            pnlCheckOut.Visible = false;
            btnFinalCheckOut.Visible = false;
            pnlSuccess.Visible = true;
            SendEmailMessage();
        }
예제 #9
0
 public void loadAvailableExam()
 {
     DAL mydal=new DAL(conn);
     DataSet ds=new DataSet();
     ds=mydal.ExecuteProcedure("spShowExam");
     gvActiveExam.DataSource = ds.Tables[0];
     gvActiveExam.DataBind();
 }
예제 #10
0
 public void SaveToDatabase(string clientId, string Item, string SubTotalPrice, string Quantity)
 {
     DAL_Project.DAL dal = new DAL_Project.DAL("Data Source=localhost;Initial Catalog=dbDeidreFinalAssign;Integrated Security=SSPI");
     dal.AddParam("@ClientID", clientId);
     dal.AddParam("@Item", Item);
     dal.AddParam("@TotalSale", SubTotalPrice);
     dal.AddParam("@Quantity", Quantity);
     dal.ExecuteProcedure("spItemSalesOrder");
 }
예제 #11
0
 public string insertQuizInformation()
 {
     Security S = new Security();
     DAL mydal = new DAL(conn);
     mydal.AddParam("@UserId", S.Userid);
     mydal.AddParam("@QuizId", (int)Session["QuizId"]);
       DataSet ds=  mydal.ExecuteProcedure("spInsertQuizInformation");
       return ds.Tables[0].Rows[0]["newQuizResponseId"].ToString();
 }
 protected void btnStart_Click(object sender, EventArgs e)
 {
     DAL mydal = new DAL(conn);
     DataSet ds= mydal.ExecuteProcedure("spActiveExam");
     DateTime starttime =Convert.ToDateTime(ds.Tables[0].Rows[0]["Date"].ToString());
     int StartTime = Convert.ToInt32(ds.Tables[0].Rows[0]["StartTime"].ToString());
     int EndTime = Convert.ToInt32(ds.Tables[0].Rows[0]["EndTime"].ToString());
     Response.Redirect("");
 }
        private void LoadNumberOfStudentByProgram(string SortColumn)
        {
            DAL myDal = new DAL(conn);

            myDal.AddParam("@Direction", GetDirection());

            GvNumberOfStudentByProgram.DataSource = myDal.ExecuteProcedure("spGetNumberOfStudentByProgram");

            GvNumberOfStudentByProgram.DataBind();
        }
        protected void btnSave_Click(object sender, EventArgs e)
        {
            DAL mydal = new DAL(conn);
            mydal.AddParam("@GUID", Request["uid"]);
            mydal.AddParam("@Password", txtPassword.Text);
            mydal.ExecuteProcedure("spChangePassword");

            lblMessage.Text = "New password saved";
            Response.Redirect("Home.aspx");
        }
 public void LoadAvailableExamforlogedInUser()
 {
     Security s = new Security();
     DAL mydal = new DAL(conn);
     mydal.AddParam("@UserId",s.Userid);
     DataSet ds = mydal.ExecuteProcedure("spGetActiveQuizByUser");
     string QuizName = ds.Tables[0].Rows[0]["QuizTitle"].ToString();
     lblShowQuiz.Text = QuizName;
     Session["QuizName"] = QuizName;
 }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                DAL d = new DAL("Data Source=localhost;Initial Catalog=dbSD13GroupProject;Integrated Security=True");

                rptMessageBoard.DataSource = d.ExecuteProcedure("spGetProducts");
                rptMessageBoard.DataBind();
            }
        }
예제 #17
0
 public void LoadDDSession()
 {
     DAL mydal = new DAL(conn);
     DataSet ds = new DataSet();
     ds = mydal.ExecuteProcedure("spSelectSession");
     ddSession.DataSource = ds.Tables[0];
     ddSession.DataTextField = "SessionCode";
     ddSession.DataValueField = "SessionId";
     ddSession.DataBind();
 }
예제 #18
0
 public void LoadDDDifficulty()
 {
     DAL mydal = new DAL(conn);
     DataSet ds = new DataSet();
     ds = mydal.ExecuteProcedure("spSelectDifficulty");
     ddDifficulty.DataSource = ds.Tables[0];
     ddDifficulty.DataTextField = "difficultyName";
     ddDifficulty.DataValueField = "DifficultyId";
     ddDifficulty.DataBind();
 }
예제 #19
0
 public void LoadDDProgram()
 {
     DAL mydal = new DAL(conn);
     DataSet ds = new DataSet();
     ds = mydal.ExecuteProcedure("spSelectProgram");
     ddProgram.DataSource = ds.Tables[0];
     ddProgram.DataTextField = "ProgramName";
     ddProgram.DataValueField = "ProgramId";
     ddProgram.DataBind();
 }
예제 #20
0
 public void loadQuizTitle()
 {
     DAL mydal = new DAL(conn);
     DataSet ds = new DataSet();
     ds = mydal.ExecuteProcedure("spSelectQuiz");
     ddQuiz.DataSource = ds.Tables[0];
     ddQuiz.DataTextField = "QuizTitle";
     ddQuiz.DataValueField = "QuizId";
     ddQuiz.DataBind();
 }
예제 #21
0
 public void LoadDDTypeOfQuestions()
 {
     DAL mydal = new DAL(conn);
     DataSet ds = new DataSet();
     ds = mydal.ExecuteProcedure("spSelectTypeofQusetions");
     ddTypeofQuestions.DataSource = ds.Tables[0];
     ddTypeofQuestions.DataTextField = "TypeName";
     ddTypeofQuestions.DataValueField = "TypeOfQuestionsId";
     ddTypeofQuestions.DataBind();
     ddTypeofQuestions.Items.Insert(0, new ListItem("Choose an option"));
 }
 private void LoadQuiz()
 {
     DAL mydal = new DAL(conn);
     DataSet ds = new DataSet();
     ds = mydal.ExecuteProcedure("spGetQuiz");
     ddtest.DataSource = ds.Tables[0];
     ddtest.DataTextField = "QuizTitle";
     ddtest.DataValueField = "QuizId";
     ddtest.DataBind();
     ddtest.Items.Insert(0, new ListItem("Select a Quiz"));
 }
예제 #23
0
        private DataSet SendToDatabase()
        {
            DAL d = new DAL("Data Source=localhost;Initial Catalog=dbSD13GroupProject;Integrated Security=True");
            d.AddParam("@TopicId", TopicId);
            d.AddParam("@ThreadTitle", ThreadSubject);
            d.AddParam("@UserId", PostedByUserId);
            d.AddParam("@CurrentTime", DatePosted);
            d.AddParam("@MessageBody", MessageBody);

            return d.ExecuteProcedure("spNewThread");
        }
예제 #24
0
        protected void btnUpdate_Click(object sender, EventArgs e)
        {
            DAL myDal = new DAL();
            myDal.AddParam("UserName", txtUsername.Text);
            string sProc;
            
            sProc = "spUpdateUser";
            myDal.AddParam("UserID", txtUserID.Text);
            myDal.ExecuteProcedure(sProc);

            LoadUsers();
        }
        protected void btnRecoverPassword_Click(object sender, EventArgs e)
        {
            DAL mydal = new DAL(conn);
            mydal.AddParam("Email", txtEmail.Text + emailDomain);
            DataSet ds = new DataSet();
            ds = mydal.ExecuteProcedure("spResetPassword");

            string theEmail = ds.Tables[0].Rows[0]["Email"].ToString();
            string id = ds.Tables[0].Rows[0]["Uniqueid"].ToString();

            string Email = txtEmail.Text;
            sendpasswordEmail(theEmail, id);
        }
예제 #26
0
        //Edits a currently existing message in the database, given that messages ID
        public int EditMessage(int messageId, string messageBody)
        {
            int threadId;

            this.MessageBody = messageBody;

            DAL d = new DAL("Data Source=localhost;Initial Catalog=dbSD13GroupProject;Integrated Security=True");
            d.AddParam("@MessageId", messageId);
            d.AddParam("@NewMessageBody", messageBody);
            d.ExecuteProcedure("spEditCurrentMessage");

            return threadId;
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            string productId = Request.QueryString["productId"];

            if (!IsPostBack)
            {
                DAL d = new DAL("Data Source=localhost;Initial Catalog=dbSD13GroupProject;Integrated Security=True");

                d.AddParam("@ProductId", productId);
                rptMessageBoard.DataSource = d.ExecuteProcedure("spGetTopicsByProductId");
                rptMessageBoard.DataBind();
            }
        }
예제 #28
0
 protected void btnSave_Click(object sender, EventArgs e)
 {
     if (Page.IsValid)
     {
         DAL myDal = new DAL(conn);
         DataSet dsAdd = new DataSet();
         myDal.AddParam("@FullName", txtFullName.Text);
         myDal.AddParam("@Email", txtEmail.Text);
         myDal.AddParam("@Password", txtPassword.Text);
         myDal.AddParam("@SecurityLevel", int.Parse(ddlSecurityLevel.SelectedValue));
         dsAdd = myDal.ExecuteProcedure("spAdminCreateUser");
         LoadUsers();
         pnlRight.Visible = false;
     }
 }
예제 #29
0
 public void GetEndTime()
 {
     DAL mydal = new DAL(conn);
     DataSet ds = mydal.ExecuteProcedure("spShowActiveExam");
     DateTime EndTime = Convert.ToDateTime(ds.Tables[0].Rows[0]["EndTime"].ToString());
     DateTime StartTime = Convert.ToDateTime(ds.Tables[0].Rows[0]["StartTime"].ToString());
     Session["EndTime"] = EndTime;
     Session["StartTime"] = StartTime;
     hiddenSeconds.Value = Math.Round((EndTime - DateTime.Now).TotalSeconds, 0).ToString();
        // UpdateTimer();
     if(int.Parse(hiddenSeconds.Value)<0)
     {
         UpdatePanel1.Visible = false;
     }
 }
예제 #30
0
        protected void btnSignIn_Click(object sender, EventArgs e)
        {
            Session["SignedIn"] = "User";
               DataSet ds = new DataSet();
               DAL_Project.DAL d = new DAL_Project.DAL(@"Data Source=localhost;Initial Catalog=dbDeidreFinalAssign;Integrated Security=SSPI");
               d.AddParam("@UserName", txtUserName.Text);//@UserName will compare value txtUserName.Text
               d.AddParam("@Password", txtPassword.Text);//@Password will compare value txtPassword.Text
               ds = d.ExecuteProcedure("spSignIn");
               lbnStore.Visible = true;
               lbnMembers.Visible = true;

               if (ds.Tables[0].Rows.Count > 0)
               {
                   Session["ClientID"] = ds.Tables[0].Rows[0]["ClientID"].ToString();
                   Session["SecurityLevel"] = ds.Tables[0].Rows[0]["SecurityLevel"].ToString();
                   Session["UserName"] = ds.Tables[0].Rows[0]["UserName"].ToString();
                   Session["Password"] = ds.Tables[0].Rows[0]["UserPassword"].ToString();

                   if (Session["SecurityLevel"].ToString() == "2")
                   {

                       lbnAdmin.Visible = true;
                       ancorLogin.Visible = false;
                       lbnStore.Visible = false;
                       lbnMembers.Visible = false;
                   }

                   if (chxStaySignedIn.Checked)
                   {
                       HttpCookie myCookieAdm = new HttpCookie("StaySignedInClientID");
                       myCookieAdm.Value = Session["ClientID"].ToString();
                       myCookieAdm.Expires = DateTime.Now.AddDays(2);
                       Response.Cookies.Add(myCookieAdm);

                       HttpCookie myCookieReg = new HttpCookie("StaySignedInSecurityLevel");
                       myCookieReg.Value = Session["SecurityLevel"].ToString();
                       myCookieReg.Expires = DateTime.Now.AddDays(2);
                       Response.Cookies.Add(myCookieReg);
                   }
               }

               else
               {
                   lblErrorSignIn.Text = "INCORRECT USERNAME AND PASSWORD!";
               }
               lblYouAre.Text = "Welcome " + txtUserName.Text;
               pnlSignedOut.Visible = true;
        }