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(); }
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(); }
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 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(); }
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(); }
public void loadAvailableExam() { DAL mydal=new DAL(conn); DataSet ds=new DataSet(); ds=mydal.ExecuteProcedure("spShowExam"); gvActiveExam.DataSource = ds.Tables[0]; gvActiveExam.DataBind(); }
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"); }
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(""); }
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; }
private void LoadNumberOfStudentByProgram(string SortColumn) { DAL myDal = new DAL(conn); myDal.AddParam("@Direction", GetDirection()); GvNumberOfStudentByProgram.DataSource = myDal.ExecuteProcedure("spGetNumberOfStudentByProgram"); GvNumberOfStudentByProgram.DataBind(); }
private DataSet PostMessage() { DAL d = new DAL("Data Source=localhost;Initial Catalog=dbSD13GroupProject;Integrated Security=True"); d.AddParam("@DatePosted", DatePosted); d.AddParam("@PostedByUserId", PostedByUserId); d.AddParam("@MessageBody", MessageBody); d.AddParam("@ThreadId", ThreadId); return d.ExecuteProcedure("spNewMessage"); }
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(); } }
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(); }
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(); }
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(); }
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(); }
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"); }
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")); }
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); }
//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(); } }
protected void btnSubmit_Click(object sender, EventArgs e) { if (Page.IsValid) { if (ddTypeofQuestions.SelectedItem.Text == "Multiple Questions/Fill the Blanks") { DAL mydal = new DAL(conn); mydal.AddParam("@QuizTitle", TxtQuizTitle.Text); mydal.AddParam("@ProgramId", ddProgram.SelectedValue); mydal.AddParam("@DifficultyId", ddDifficulty.SelectedValue); mydal.AddParam("@TimeInMinute", Convert.ToDateTime(txtTimeinMinutes.Text)); mydal.AddParam("@TypeOfQuestionsId", ddTypeofQuestions.SelectedValue); mydal.AddParam("@Question", txtQuestion.Text); mydal.AddParam("@CorrectAnswer", txtCorrectAnswer.Text); mydal.AddParam("@Marks", txtMarks.Text); mydal.AddParam("@Answer0", txtAns1.Text); mydal.AddParam("@Answer1", txtAns2.Text); mydal.AddParam("@Answer2", txtAns3.Text); mydal.AddParam("@Answer3", txtAns4.Text); mydal.ExecuteProcedure("spInsertQuestionMultiChoice"); } else { if (RdoAnswer.SelectedItem != null) { DAL mydal = new DAL(conn); mydal.AddParam("@QuizTitle", TxtQuizTitle.Text); mydal.AddParam("@ProgramId", ddProgram.SelectedValue); mydal.AddParam("@DifficultyId", ddDifficulty.SelectedValue); mydal.AddParam("@TimeInMinute", Convert.ToDateTime(txtTimeinMinutes.Text)); mydal.AddParam("@TypeOfQuestionsId", ddTypeofQuestions.SelectedValue); mydal.AddParam("@Question", txtQuestion.Text); // mydal.AddParam("@CorrectAnswer", txtCorrectAnswer.Text); mydal.AddParam("@Mark", txtMarks.Text); mydal.AddParam("@CorrectAnswer", RdoAnswer.SelectedIndex); // mydal.AddParam("@Answer2", RdoAnswer.); mydal.ExecuteProcedure("spInsertQuestionTrueFalse"); } else { } } } }
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; } }