private void button1_Click(object sender, EventArgs e) { if (textBox1.Text == "" || textBox2.Text == "" || textBox3.Text == "" || textBox4.Text == "") { MessageBox.Show("Enter Valid Data"); } else { DBEF te = new DBEF(); Question q = new Question(); q.ChapterId = ((KeyValuePair <string, string>)comboBox3.SelectedItem).Key; q.OptionA = textBox1.Text; q.OptionB = textBox2.Text; q.OptionC = textBox3.Text; q.OptionD = textBox4.Text; q.Correct = comboBox4.SelectedItem.ToString(); q.Statment = richTextBox1.Text; q.Id = "QU" + q.ChapterId + DateTime.Now.GetHashCode().ToString().Substring(4); te.Questions.Add(q); te.SaveChanges(); textBox1.Text = textBox2.Text = textBox3.Text = textBox4.Text = richTextBox1.Text = ""; MessageBox.Show("New Question Added"); } }
private void button1_Click(object sender, EventArgs e) { string key = ((KeyValuePair <string, string>)comboBox3.SelectedItem).Key; DBEF te = new DBEF(); this.quiz_questions = te.Questions.Where(x => x.ChapterId == key).ToList(); var chepter = te.Chapters.Where(x => x.Id == key).FirstOrDefault(); var subject = te.Subjects.Where(x => x.Id == chepter.SubjectId).FirstOrDefault(); var stdd = te.Standards.Where(x => x.Id == subject.StandardId).First(); this.chp = chepter.Chp_Name; this.std = "" + (stdd.std_number); this.sub = subject.Sub_Name; tableLayoutPanel2.Visible = false; panel.Visible = true; QNO.Text = "1"; QuestionDesc.Text = this.quiz_questions[this.currunt_count].Statment; radioButton1.Text = this.quiz_questions[this.currunt_count].OptionA; radioButton2.Text = this.quiz_questions[this.currunt_count].OptionB; radioButton3.Text = this.quiz_questions[this.currunt_count].OptionC; radioButton4.Text = this.quiz_questions[this.currunt_count].OptionD; label9.Text = (quiz_questions.Count - currunt_count - 1) + "/" + (quiz_questions.Count); result.Text = ""; }
private void button1_Click(object sender, EventArgs e) { DBEF te = new DBEF(); var email = uname.Text; var password = pswd.Text; var learner = te.Learners.Where(x => x.Email == email && x.Password == password).FirstOrDefault(); if (learner != null) { Profile prf = new Profile(); LoginInfo.UserID = email; LoginInfo.learner = learner; if (LoginInfo.learner.F_Name == "ADMIN") { Admin a = new Admin(); a.Show(); this.Hide(); } else { prf.Show(); this.Hide(); } } else { MessageBox.Show("Please enter Correct Username and Password"); } }
private void Form1_Load(object sender, EventArgs e) { DBEF te = new DBEF(); List <Learner> tll = new List <Learner>(); List <Standard> stdll = new List <Standard>(); tll = te.Learners.ToList(); stdll = te.Standards.ToList(); // dataGridView1.DataSource = stdll; // dataGridView2.DataSource = tll; }
private void register_Click_1(object sender, EventArgs e) { DBEF saarthi = new DBEF(); var fnm = fname.Text; var lnm = lname.Text; var mnm = mname.Text; var eml = email.Text; var pswd = password.Text; var cpswd = confpassword.Text; if (pswd != cpswd) { MessageBox.Show("Password and Confirm Password is not match Kindly Check!!"); } else if (pictureBox1.Image == null) { MessageBox.Show("Please Select an image"); } else { var learner = saarthi.Learners.Where(x => x.Email == eml).FirstOrDefault(); if (learner != null) { MessageBox.Show("This Email Id is Already Registerd Login With it!!!"); } else { Learner l = new Learner(); l.Email = eml; l.F_Name = fnm; l.L_Name = lnm; l.M_Name = mnm; l.Password = pswd; l.LearnerId = "L" + DateTime.Now.Year + "" + DateTime.Now.GetHashCode().ToString().Substring(4); if (pictureBox1.Image != null) { l.PhotoURL = @"C:\Users\RADADIYA KRINISH\Desktop\Krinish\Myproject\Myproject\Saarthi_E-learning\Saarthi\Saarthi\AppData\profilePic\" + l.LearnerId + ".bmp"; pictureBox1.Image.Save(l.PhotoURL, System.Drawing.Imaging.ImageFormat.Bmp); saarthi.Learners.Add(l); saarthi.SaveChanges(); //label8.Text = "Congratulations!!! You are registerd Please Login.."; MessageBox.Show("Congratulations!!! You are registerd Please Login.."); } else { MessageBox.Show("Please enter Yoyr Profile Pic"); } } } }
private void result_Load(object sender, EventArgs e) { pictureBox1.Image = Image.FromFile(LoginInfo.learner.PhotoURL); label4.Text = LoginInfo.learner.LearnerId; label5.Text = "" + LoginInfo.learner.F_Name + " " + LoginInfo.learner.M_Name + " " + LoginInfo.learner.L_Name; label7.Text = LoginInfo.learner.Email; DBEF te = new DBEF(); var results = te.Results.Where(x => x.LearnerId == LoginInfo.learner.LearnerId).ToList(); this.results = results; if (results.Count == 0) { chpter.Text = ""; standard.Text = ""; subject.Text = ""; total.Text = ""; Obtained.Text = ""; quizon.Text = ""; performence.Text = ""; label8.Text = "Whenever You make any submission Hear All Results will mention"; button3.Enabled = false; button2.Enabled = true; label9.Text = "0"; } else { chpter.Text = results[this.current_count].chepter; standard.Text = results[this.current_count].std; subject.Text = results[this.current_count].Subject; total.Text = "" + results[this.current_count].Total; Obtained.Text = "" + results[this.current_count].Obtained; quizon.Text = results[this.current_count].QuizOn.ToString(); Double per = results[this.current_count].Obtained / 1.00F; per /= results[this.current_count].Total; per *= 100; performence.Text = Convert.ToString(per) + "%"; if (this.current_count == results.Count - 1) { button3.Enabled = false; } if (this.current_count == 0) { button2.Enabled = false; } label9.Text = "" + (this.results.Count - this.current_count - 1) + "/" + this.results.Count; } }
private void comboBox1_SelectedIndexChanged(object sender, EventArgs e) { DBEF te = new DBEF(); var stdQparameter = comboBox1.SelectedValue.ToString(); var subList = te.Subjects.Where(x => x.StandardId == stdQparameter); Dictionary <string, string> comboSource = new Dictionary <string, string>(); foreach (var item in subList) { comboSource.Add(item.Id, item.Sub_Name); } comboBox2.DataSource = new BindingSource(comboSource, null); comboBox2.DisplayMember = "Value"; comboBox2.ValueMember = "Key"; }
private void button2_Click(object sender, EventArgs e) { Result r = new Result(); r.Total = this.quiz_questions.Count; r.Obtained = this.answer; r.chepter = this.chp; r.std = this.std; r.Subject = this.sub; r.LearnerId = LoginInfo.learner.LearnerId; r.QuizOn = DateTime.Now; r.Id = "QUIZ" + DateTime.Now.Date + "" + DateTime.Now.GetHashCode().ToString().Substring(4); DBEF te = new DBEF(); te.Results.Add(r); te.SaveChanges(); panel.Visible = false; tableLayoutPanel2.Visible = true; result.Text = "Your Score is " + r.Obtained + "/" + r.Total; }
private void comboBox2_SelectedIndexChanged(object sender, EventArgs e) { string key = ((KeyValuePair <string, string>)comboBox2.SelectedItem).Key; string value = ((KeyValuePair <string, string>)comboBox2.SelectedItem).Value; if (comboBox2.SelectedIndex == 0) { } DBEF te = new DBEF(); var subQparameter = key; var ChpList = te.Chapters.Where(x => x.SubjectId == subQparameter); Dictionary <string, string> combo2Source = new Dictionary <string, string>(); foreach (var item in ChpList) { combo2Source.Add(item.Id, item.Chp_Name); } comboBox3.DataSource = new BindingSource(combo2Source, null); comboBox3.DisplayMember = "Value"; comboBox3.ValueMember = "Key"; }
private void label1_Click(object sender, EventArgs e) { DBEF te = new DBEF(); var stdQparameter = "std" + 1; List <Subject> subList = te.Subjects.Where(x => x.StandardId == stdQparameter).ToList(); }