public void SetGridToJobs() { ShowAllFilterBoxes(); Column0Label.Content = "Co Name: "; Column1Label.Content = "Rating: "; Column2Label.Content = "Position: "; SQLConnections sql = new SQLConnections(); List <Jobs> jobs = sql.GetAllJobs(); List <ColumnData> columnDataJobs = new List <ColumnData>(); foreach (var item in jobs) { ColumnData data = new ColumnData { Column1 = item.CompanyName, Column2 = item.CEOName, Column3 = item.Rating, Column4 = item.Comments, Column5 = "Update", Column6 = "Delete" }; columnDataJobs.Add(data); } ResultBox.ItemsSource = columnDataJobs; }
public IActionResult CreateSessionId() { Random rnd = new Random(); int newSessionId = rnd.Next(10000000, 99999999); bool resStatus = false; try { resStatus = SQLConnections.CreateSessionId(newSessionId); } catch { Console.WriteLine("Error creating session id"); } if (resStatus) { // sucessfully created that session return(Ok(new SessionId() { sessionId = newSessionId, })); } // unable to create that session return(BadRequest()); }
public void SetGridToLocations() { ShowAllFilterBoxes(); Column0Label.Content = "City: "; Column1Label.Content = "State: "; Column2Label.Content = "Rating: "; SQLConnections sql = new SQLConnections(); List <Location> locations = sql.GetAllLocations(); List <ColumnData> columnDataLocations = new List <ColumnData>(); foreach (var item in locations) { ColumnData data = new ColumnData { Column1 = item.City, Column2 = item.State, Column3 = item.RatingConverted, Column4 = item.Notes, Column5 = "Update", Column6 = "Delete" }; columnDataLocations.Add(data); } ResultBox.ItemsSource = columnDataLocations; }
public void SetGridToPositions() { ShowAllFilterBoxes(); Column0Label.Content = "Position: "; Column1Label.Visibility = Visibility.Hidden; Column2Label.Visibility = Visibility.Hidden; Column1TextBox.Visibility = Visibility.Hidden; Column2TextBox.Visibility = Visibility.Hidden; Column0Label.Content = "Position: "; SQLConnections sql = new SQLConnections(); List <Position> positions = sql.GetAllPositions(); List <ColumnData> columnDataPositions = new List <ColumnData>(); foreach (var item in positions) { ColumnData data = new ColumnData { Column1 = item.JobTitle, Column2 = null, Column3 = null, Column4 = null, Column5 = "Update", Column6 = "Delete" }; columnDataPositions.Add(data); } ResultBox.ItemsSource = columnDataPositions; }
private void FillAllPositions() { SQLConnections sql = new SQLConnections(); var x = sql.GetAllPositions(); AllPositions = x; }
public MainTeacherForm(string id, string sqlconnstring) { InitializeComponent(); SQLConnections.Init(sqlconnstring); MainForm = this; // Group buttons this.buttons = new List <ButtonBase>(); this.buttons.Add(btnExam); this.buttons.Add(btnClass); this.buttons.Add(btnReport); this.setBold(btnExam); this.TeacherID = id; this.Teacher = SQLConnections.QueryTeacher(id); // Change title this.Text = Teacher.ID + " - GV " + Teacher.Name; // Change ExamUserControl this.examUC.labelCurrentExams.Text = SQLConnections.QueryCurrentExamAmount(id) + ""; // Load Classes this.LoadClasses(); }
public ExamChangeForm(string examID) : base() { InitializeComponent(); this.loaded = false; this.saved = false; // Default values this.GenerateDefautValues(); // Generate news if (examID == null) { this.CurrentExam = new Exam(MainTeacherForm.MainForm.TeacherID); this.canEdit = true; } else { this.CurrentExam = SQLConnections.QueryExam(examID, true); this.canEdit = this.CurrentExam.CanEdit(); if (!this.canEdit) { this.saved = true; MessageBox.Show("Vì kỳ thi đã bắt đầu, không thể chỉnh sửa kỳ thi. Chỉ có thể xem và tải đề về", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information); MakeUneditable(); } } this.sourceExam = clone(this.CurrentExam); // Set this.GenerateExamValue(); //... this.OnCheckedChanged(null, null); }
private void Click_SubmitButton(object sender, RoutedEventArgs e) { //get combobox var comboBoxState = boxState as ComboBox; //set selected value to string string stateSelected = comboBoxState.SelectedItem as string; try { locationModel.NewLocation = new Location() { City = txtCity.Text, CityRating = int.Parse(txtRating.Text), Notes = txtNotes.Text, }; var stateID = statesModel.AllStates.Where(x => x.State == stateSelected); foreach (var item in stateID) { locationModel.NewLocation.StateId = item.StateID; } } catch (FormatException) { MessageBox.Show("The rating must be a single, valid number", "Error", MessageBoxButton.OK); return; } if (string.IsNullOrEmpty(txtCity.Text) || string.IsNullOrEmpty(txtRating.Text) || stateSelected is null) { MessageBox.Show("You must have City, State, and Rating all filled out in order to submit", "Error", MessageBoxButton.OK, MessageBoxImage.Error); return; } SQLConnections sqlConnection = new SQLConnections(); sqlConnection.AddLocation(locationModel.NewLocation); MessageBoxResult result = MessageBox.Show("Location added!", "Success", MessageBoxButton.OKCancel, MessageBoxImage.None); if (result == MessageBoxResult.OK) { //clear text boxes canceledMessage.Visibility = Visibility.Hidden; txtCity.Clear(); boxState.SelectedItem = null; txtRating.Clear(); txtNotes.Clear(); boxState.SelectedItem = null; } else { sqlConnection.DeleteLastLocationRecord(); canceledMessage.Visibility = Visibility.Visible; } }
public ViewJobs() { InitializeComponent(); SQLConnections sqlConnection = new SQLConnections(); List <string> items = new List <string>(); items = sqlConnection.FillComboBoxFromDatabase("SELECT CompanyName FROM Jobs ORDER BY CompanyID DESC"); lbDisplayJobs.ItemsSource = items; }
public void boxState_Loaded(object sender, RoutedEventArgs e) { SQLConnections sqlConnection = new SQLConnections(); var comboBox = boxState as ComboBox; states = sqlConnection.FillComboBoxFromDatabase("SELECT State FROM [dbo].[States]"); comboBox.ItemsSource = states; }
private void SetGridToAll() { Column0Label.Content = "Keyword: "; Column1Label.Visibility = Visibility.Hidden; Column2Label.Visibility = Visibility.Hidden; Column1TextBox.Visibility = Visibility.Hidden; Column2TextBox.Visibility = Visibility.Hidden; SQLConnections sql = new SQLConnections(); List <Jobs> jobsAll = sql.GetAllJobs(); List <Location> locationsAll = sql.GetAllLocations(); List <Position> positionsAll = sql.GetAllPositions(); List <ColumnData> columnDataAll = new List <ColumnData>(); foreach (var item in jobsAll) { ColumnData data = new ColumnData { Column1 = "Job", Column2 = item.CompanyName, Column3 = item.CEOName, Column4 = item.Rating, Column5 = "Update", Column6 = "Delete" }; columnDataAll.Add(data); } foreach (var item in locationsAll) { ColumnData data = new ColumnData { Column1 = "Location", Column2 = item.City, Column3 = item.State, Column4 = item.RatingConverted, Column5 = "Update", Column6 = "Delete" }; columnDataAll.Add(data); } foreach (var item in positionsAll) { ColumnData data = new ColumnData { Column1 = "Position", Column2 = item.JobTitle, Column3 = null, Column4 = null, Column5 = "Update", Column6 = "Delete" }; columnDataAll.Add(data); } ResultBox.ItemsSource = columnDataAll; }
private void LocationBox_Loaded(object sender, EventArgs e) { SQLConnections sqlConnection = new SQLConnections(); var comboBox = sender as ComboBox; List <string> positions = new List <string>(); positions = sqlConnection.FillComboBoxFromDatabase("SELECT City FROM [dbo].[Location]"); positions.Add("Add Location"); comboBox.ItemsSource = positions; }
private void AddPosition_Clicked(object sender, RoutedEventArgs e) { SQLConnections sqlConnections = new SQLConnections(); string newPosition = NewPosition.Text; sqlConnections.AddPosition(newPosition); int position = sqlConnections.FindPositionID(newPosition); this.Close(); //@@identityscope }
public void GenerateValues() { // Query Exams this.availableExams = SQLConnections.QueryExams(teacherID, true, false); this.dgvExams.Rows.Clear(); foreach (var exam in this.availableExams) { this.dgvExams.Rows.Add(exam.ID, exam.ClassID, exam.ExamOrder); } }
public SQLSecuritySettings(SQLServerExplorer sse) { string[] SQLServers = sse.Servers; SQLConnections sqlConnections = sse.SQLConnections; // // Required for Windows Form Designer support // InitializeComponent(); this.Height = 188; lblWarning.Visible = true; rdb_Integrated.Visible = false; rdb_Mixed.Visible = false; groupBox1.Visible = false; label2.Visible = false; label3.Visible = false; txt_PWD.Visible = false; txt_UID.Visible = false; label4.Top = 30; comboBox1.Top = 32; comboBox1.Enabled = false; btn_OK.Top = 88; btn_Cancel.Top = 119; lblWarning.Top = 88; _SQLConnections = sqlConnections; chkSavePwd.Visible = false; rdb_Integrated.Checked = true; rdb_Mixed.Checked = false; txt_ServerName.SelectedIndexChanged += new EventHandler(txt_ServerName_SelectedIndexChanged); txt_ServerName.Enabled = true; if (SQLServers != null) { txt_ServerName.Items.AddRange(SQLServers); } else { txt_ServerName.Enabled = true; txt_ServerName.Focus(); } string servername = string.Empty; if (typeof(ServerTreeNode).IsInstanceOfType(sse.SelectedTreeNode)) { servername = sse.SelectedTreeNode.Text; } if (typeof(DBTreeNode).IsInstanceOfType(sse.SelectedTreeNode)) { servername = sse.SelectedTreeNode.Parent.Text; } txt_ServerName.Text = servername; }
private void OnExamChange(object sender, EventArgs e) { foreach (var exam in availableExams) { if (exam.ID.Equals(this.cbExams.SelectedItem.ToString())) { this.currentExam = exam; this.currentResults = SQLConnections.QueryResults(this.currentExam.ID, true); GenerateValues(); break; } } }
private void EditorSelector_Clicked(object sender, MouseButtonEventArgs e) { var panel = sender as Grid; string panelName = panel.Name; switch (panelName) { case "jobInfoChangedGrid": HideAllEditingPlanes(); SetJobBoxesToReadWrite(); companyNameBox.IsReadOnly = false; break; case "locationInfoChangedGrid": HideAllEditingPlanes(); SetLocationBoxesToReadWrite(); break; case "recruiterInfoChangedGrid": HideAllEditingPlanes(); MessageBoxResult result; if (IsRecruiterInitialized == false) { result = MessageBox.Show("This job was not created with a recruiter. Would you like to add one?", "Recruiter", MessageBoxButton.YesNo, MessageBoxImage.Question); if (result == MessageBoxResult.Yes) { Recruiter recruiter = new Recruiter() { RecruiterName = "", PhoneNumber = "", LinkedInLink = "", Email = "" }; SQLConnections sql = new SQLConnections(); int newRecruiterID = sql.AddRecruiterGetID(recruiter); sql.UpdateJobWithRecruiterID(newRecruiterID, jobsModel.SelectedJob.CompanyId); jobsModel = new JobsModel(); jobsModel.SelectedJob = jobsModel.AllJobs.Where(x => x.CompanyId == SelectedJobID).FirstOrDefault(); IsRecruiterInitialized = true; } else { ShowAllEditingPlanes(); return; } } SetRecruiterBoxesToReadWrite(); break; } }
private void LoadClasses() { this.classUC.flpClassList.Controls.Clear(); List <Class> list = SQLConnections.QueryClasses(this.TeacherID); foreach (Class cls in list) { var template = Utils.Clone <ClassButtonTemplate>(new ClassButtonTemplate()); template.labelID.Text = cls.ID; template.labelName.Text = cls.Name; template.ClassObject = cls; this.classUC.flpClassList.Controls.Add(template); } }
private void Click_SubmitButton(object sender, RoutedEventArgs e) { //get combobox var comboBoxState = boxState as ComboBox; //set selected value to string string stateSelected = comboBoxState.SelectedItem as string; //get int value for stateID int stateIDValue = GetStateID(stateSelected); try { LocationInfo.City = txtCity.Text; LocationInfo.StateID = stateIDValue; LocationInfo.Rating = int.Parse(txtRating.Text); LocationInfo.Notes = txtNotes.Text; } catch (FormatException) { MessageBox.Show("Rating must be a number", "Error", MessageBoxButton.OK, MessageBoxImage.None); return; } if (string.IsNullOrEmpty(txtCity.Text) || string.IsNullOrEmpty(txtNotes.Text) || string.IsNullOrEmpty(txtRating.Text) || stateSelected is null) { MessageBox.Show("You must have City, State, and Rating all filled out in order to submit", "Error", MessageBoxButton.OK, MessageBoxImage.Error); return; } SQLConnections sqlConnection = new SQLConnections(); sqlConnection.AddLocation(); MessageBoxResult result = MessageBox.Show("Location added!", "Success", MessageBoxButton.OKCancel, MessageBoxImage.None); if (result == MessageBoxResult.OK) { //clear text boxes canceledMessage.Visibility = Visibility.Hidden; txtCity.Clear(); boxState.SelectedItem = null; txtRating.Clear(); txtNotes.Clear(); boxState.SelectedItem = null; } else { sqlConnection.DeleteLastLocationRecord(); canceledMessage.Visibility = Visibility.Visible; } }
public ReportClassSelect(DateTime start, DateTime end) { InitializeComponent(); this.teacherID = MainTeacherForm.MainForm.TeacherID; this.start = start; this.end = end; // Load avaiable subjects this.avaialableClasses = SQLConnections.QueryClasses(teacherID); // Load combobox foreach (var cls in this.avaialableClasses) { this.cbSubjects.Items.Add(cls.ID + " - " + cls.Name); } }
public ReportSubjectSelect(DateTime start, DateTime end) { InitializeComponent(); this.teacherID = MainTeacherForm.MainForm.TeacherID; this.start = start; this.end = end; // Load avaiable subjects this.avaialableSubjects = SQLConnections.QuerySubjects(teacherID); // Load combobox foreach (var sj in this.avaialableSubjects) { this.cbSubjects.Items.Add(sj.ID.ToUpper() + " - " + sj.Name); } }
public ExamQuestionsSelectForm(string teacherID, ExamChangeForm examForm) { InitializeComponent(); this.teacherID = teacherID; this.examForm = examForm; // Query exams exams = SQLConnections.QueryExams(teacherID, true, false); // Add to dgv dgvExams.Rows.Clear(); foreach (var exam in exams) { dgvExams.Rows.Add(exam.ID, exam.ClassID, exam.ExamOrder, exam.Questions.Count); } }
private void OnButtonCreateClick(object sender, EventArgs e) { int index = this.cbSubjects.SelectedIndex; if (index < 0 || index >= avaialableClasses.Count) { return; } var cls = avaialableClasses[index]; var report = new ClassReport(); SQLConnections.FillResultReportsByClass(this.teacherID, cls.ID, this.start, this.end, report); this.Close(); new ClassReportForm(report).ShowDialog(); }
public ClassForm(Class cls) { InitializeComponent(); this.cls = cls; // Query exams this.availableExams = SQLConnections.QueryExams(cls, false); // Set combobox var items = new Object[availableExams.Count()]; int i = 0; foreach (var exam in availableExams) { items[i] = exam.ID; i++; } this.cbExams.DataSource = items; }
protected void btnLogin_Click(object sender, ImageClickEventArgs e) { // txtUserName.Text string sLogin = string.Empty; string sPswd = string.Empty; sLogin = txtUserName.Text; sPswd = txtPassword.Text; string sConString = string.Empty; // sConString = @"Data Source=sqldevf\sqldevf; initial catalog=FNETIntern01; user id=FNETUser; password=fnetdev;"; SQLConnections sqlcnn = new SQLConnections(); sConString = sqlcnn.GetSqlConnectionString(); DataTable dt = new DataTable(); using (SqlConnection cn = new SqlConnection(sConString)) { using (SqlCommand cm = new SqlCommand("USP_PB_GET_USER", cn)) { cn.Open(); cm.CommandType = CommandType.StoredProcedure; cm.Parameters.Add("@LOGIN", SqlDbType.NVarChar, 25).Value = sLogin; cm.Parameters.Add("@PSWD", SqlDbType.NVarChar, 25).Value = sPswd; using (SqlDataAdapter da = new SqlDataAdapter(cm)) { da.SelectCommand = cm; da.Fill(dt); if (dt.Rows.Count > 0) { string sUserId = string.Empty; sUserId = dt.Rows[0]["ID"].ToString(); string sRole = dt.Rows[0]["ROLES"].ToString(); Session["UserName"] = dt.Rows[0]["USER_FN"].ToString(); Response.Redirect("search.aspx?user_id=" + sUserId + "&role=" + sRole); } else { lblErrMsg.Visible = true; lblErrMsg.Text = "Invalid User Name or Password."; } } } } }
private void OnBtnSaveClick(object sender, EventArgs e) { // Check if (!checkValid()) { return; } // Set this.setValues(); // Check edit this.CheckEdit(); // Save if (SQLConnections.SaveExam(this.CurrentExam)) { this.saved = true; MessageBox.Show("Lưu kỳ thi thành công!", "Thành công", MessageBoxButtons.OK); this.Close(); } }
public IActionResult CheckSessionId([FromBody] SessionId sessionInfo) { bool resStatus = false; try { resStatus = SQLConnections.CheckSessionId(sessionInfo.sessionId); } catch { Console.WriteLine("Error finding session id"); } if (resStatus) { // sucessfully created that session return(Ok(sessionInfo)); } // unable to find that session return(NotFound()); }
public void UpdateChoices() { if (currentResults == null) { return; } int i = this.dgvResults.CurrentCell.RowIndex; if (i < 0 || i >= this.currentResults.Count) { return; } var result = this.currentResults[i]; List <Choice> choices = SQLConnections.QueryChoices(result.ID, true); this.dgvChoices.Rows.Clear(); foreach (var choice in choices) { this.dgvChoices.Rows.Add(choice.Question, choice.IsTrue ? "Đúng" : "Sai", choice.Answer); } }
private void SearchButton_Clicked(object sender, RoutedEventArgs e) { SQLConnections sql = new SQLConnections(); switch (FilterBox.Text) { case "All": break; case "Jobs": break; case "Locations": break; case "Positions": break; } }
public void GenerateDefautValues() { // Generate combobox this.cbTAHour.Items.Clear(); for (int i = 0; i <= 99; i++) { this.cbTAHour.Items.Add(i); } this.cbTAMinute.Items.Clear(); for (int i = 0; i <= 59; i++) { this.cbTAMinute.Items.Add(i); } this.cbTASecond.Items.Clear(); for (int i = 0; i <= 59; i++) { this.cbTASecond.Items.Add(i); } this.cbLimitTimes.Items.Clear(); for (int i = 1; i <= 99; i++) { this.cbLimitTimes.Items.Add(i); } this.cbQuestionAmount.Items.Clear(); for (int i = 1; i <= 999; i++) { this.cbQuestionAmount.Items.Add(i); } this.cbSTDay.Items.Clear(); this.cbEDDay.Items.Clear(); for (int i = 1; i <= 31; i++) { this.cbSTDay.Items.Add(i); this.cbEDDay.Items.Add(i); } this.cbSTMonth.Items.Clear(); this.cbSTMonth.Items.Clear(); for (int i = 1; i <= 12; i++) { this.cbSTMonth.Items.Add(i); this.cbEDMonth.Items.Add(i); } int currentYear = DateTime.Now.Year; this.cbSTYear.Items.Clear(); this.cbEDYear.Items.Clear(); for (int i = currentYear; i <= currentYear + 100; i++) { this.cbSTYear.Items.Add(i); this.cbEDYear.Items.Add(i); } // Answers this.rtbAnswers = new List <RichTextBox>() { rtbAnswer1, rtbAnswer2, rtbAnswer3, rtbAnswer4, rtbAnswer5 }; this.btnIsTrues = new List <RadioButton>() { btnIsTrue1, btnIsTrue2, btnIsTrue3, btnIsTrue4, btnIsTrue5 }; this.answerDefaults = new Dictionary <RichTextBox, string>(); answerDefaults.Add(rtbAnswer1, "Điền câu trả lời thứ nhất"); answerDefaults.Add(rtbAnswer2, "Điền câu trả lời thứ hai"); answerDefaults.Add(rtbAnswer3, "Điền câu trả lời thứ ba (Không bắt buộc)"); answerDefaults.Add(rtbAnswer4, "Điền câu trả lời thứ nhất (Không bắt buộc)"); answerDefaults.Add(rtbAnswer5, "Điền câu trả lời thứ nhất (Không bắt buộc)"); // QA this.allQA = new List <RichTextBox> (); this.allQA.Add(rtbQuestion); foreach (var rtba in rtbAnswers) { this.allQA.Add(rtba); } // Defaults this.rtbQuestion.Text = questionDefault; foreach (KeyValuePair <RichTextBox, string> e in answerDefaults) { e.Key.Text = e.Value; } // Class this.availableClasses = SQLConnections.QueryClasses(MainTeacherForm.MainForm.TeacherID); cbClass.Items.Clear(); foreach (var cls in this.availableClasses) { cbClass.Items.Add(cls.ID + " " + cls.Name); } // Order this.cbOrder.Text = ""; // Questions this.dgvQuestions.Rows.Clear(); }