private void ChangedGrade() { if (_load) { int id = 0; if (cbGrade.SelectedValue != null) { int.TryParse(cbGrade.SelectedValue.ToString(), out id); } if (id == 0) { return; } GradeList gradeList = GradeList.getInstance(); Grade grade = gradeList.getItem(id); DataTable dt = _car.info.ToDataTable(); DataTable dt2 = grade.ToDataTable(); foreach (DataRow row in dt2.Rows) { dt.Rows.Add(row.ItemArray); } dgvCarInfo.DataSource = dt; } }
public static String getAverageGradeByMajor(String majorId, String semester, String year) { decimal grade = 0; String cString = System.Configuration.ConfigurationManager.ConnectionStrings["DBConnect"].ConnectionString; string getGradeString; getGradeString = "SELECT [dbo].[getGradeAvgByCourse] ( " + majorId + " ,'%" + year + "%' ,'%" + semester + "%')"; using (SqlConnection connection = new SqlConnection(cString)) { SqlCommand command = new SqlCommand(getGradeString, connection); connection.Open(); using (var reader = command.ExecuteReader()) { while (reader.Read()) { if (!reader.IsDBNull(0)) { grade = reader.GetDecimal(0); } else { grade = -1; } } } connection.Close(); } return(GradeList.convertPointsToGrade((double)grade)); }
public IActionResult Index() { //This is the average via simple average lambda double averageGrade = GradeList.Average(x => x.NumberGrade); //Simple Group by into anonymous type for aggregate var groupedGrades = GradeList .GroupBy(x => x.LetterGrade) .Select(g => new { g.Key, Count = g.Count() }) .ToList() .OrderBy(o => o.Key); var aggregateGrades = new Dictionary <string, int>(); foreach (var g in groupedGrades) { aggregateGrades.Add(g.Key, g.Count); } ViewBag.AverageGrade = averageGrade; ViewBag.GroupList = aggregateGrades; return(View(GradeList)); }
private void ModifyTeamMnBtn_Click(object sender, EventArgs e) { YouAreHere(ModifyTeamMnBtn); SelectedCourseLabel.Hide(); CoursesList.Hide(); SelectCourseBtn.Hide(); ProjectGroupBox.Hide(); ProjectList.Hide(); GradeList.Hide(); GradeGroupBox.Hide(); TeamList.Anchor = (AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Top); TeamGroupBox.Show(); TeamList.Show(); TeamGroupBox.Location = new Point(550, 12); TeamList.Location = new Point(150, 12); RefreshList(); ClearAllBoxes(); EnableViewLists(); ChangeBtnNames(); }
public ActionResult DeleteConfirmed(int id) { GradeList gradeList = db.GradeList.Find(id); db.GradeList.Remove(gradeList); db.SaveChanges(); return(RedirectToAction("Index")); }
public override void Save() { ID = Convert.ToInt32(_provider.Insert("Grade", ID, Name, EPower, EVol, MaxLoad, NoLoad, EngineType.ID, Model.ID)); GradeList gradeList = GradeList.getInstance(); gradeList.Add(this); }
public ProfessorForm() { InitializeComponent(); //Project List:A list that displays the professor's projects ProjectList.Bounds = new Rectangle(new Point(150, 12), new Size(250, 500)); ProjectList.View = View.Details; ProjectList.FullRowSelect = true; ProjectList.GridLines = true; ProjectList.Sorting = SortOrder.Ascending; ProjectList.Columns.Add("Project Name", -2, HorizontalAlignment.Left); ProjectList.Columns.Add("Max Grade", -2, HorizontalAlignment.Left); //========================================================================== //Students List: A list that displays each teams infos StudentsList.Bounds = new Rectangle(new Point(150, 12), new Size(375, 500)); StudentsList.View = View.Details; StudentsList.FullRowSelect = true; StudentsList.GridLines = true; StudentsList.Sorting = SortOrder.Ascending; StudentsList.Columns.Add("Team", -2, HorizontalAlignment.Left); StudentsList.Columns.Add("Registration Number", -2, HorizontalAlignment.Left); StudentsList.Columns.Add("Email", -2, HorizontalAlignment.Left); //============================================================================= //Grade List: A list that displays the team with its project an the grade GradeList.Bounds = new Rectangle(new Point(150, 12), new Size(275, 500)); GradeList.View = View.Details; GradeList.FullRowSelect = true; GradeList.GridLines = true; GradeList.Sorting = SortOrder.Ascending; GradeList.Columns.Add("Team", -2, HorizontalAlignment.Left); GradeList.Columns.Add("Project", -2, HorizontalAlignment.Left); GradeList.Columns.Add("Grade", -2, HorizontalAlignment.Left); //============================================================================== TeamGroupBox.Text = ""; ProjectGroupBox.Text = ""; GradeGroupBox.Text = ""; TeamGroupBox.Bounds = new Rectangle(new Point(550, 12), new Size(320, 320)); TeamGroupBox.Show(); StudentsList.Show(); GradeList.Hide(); GradeGroupBox.Hide(); AssignToWhomLabel.Hide(); AssignProjectBtn.Hide(); ProjectGroupBox.Hide(); ProjectList.Hide(); }
private void RefreshGrade() { int i = cmbGrade.SelectedIndex; var grades = new GradeList(); grades.FillByDefault(); cmbGrade.ItemsSource = grades; cmbGrade.SelectedIndex = i; }
public ActionResult Edit([Bind(Include = "GradeListID,Name")] GradeList gradeList) { if (ModelState.IsValid) { db.Entry(gradeList).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(gradeList)); }
private void loadGrade() { int idModel = 0; GradeList grades = GradeList.getInstance(); int.TryParse(cbModel.SelectedValue.ToString(), out idModel); _dgv.DataSource = grades.ToDataTable(idModel); _dgv.Columns["id"].Visible = false; }
public ActionResult Create([Bind(Include = "GradeListID,Name")] GradeList gradeList) { if (ModelState.IsValid) { db.GradeList.Add(gradeList); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(gradeList)); }
public CadetListData(IEnumerable<Cadet> cadets, IEnumerable<Section> sections, IEnumerable<Grade> grades) { cadets = cadets.OrderBy(c => c.Nom).ThenBy(c => c.Prenom).ThenBy(c => c.Grade == null ? int.MaxValue : c.Grade.Ordre); Cadets = new CadetList(cadets); Grades = new GradeList(grades); Sections = new List<SectionListItem>(); foreach (Section section in sections) { Sections.Add(new SectionListItem(section)); } }
public override GradeStatistics ComputeStatistics() { Console.WriteLine("Inside of ThrowAway"); float lowest = float.MaxValue; foreach (float grades in GradeList) { lowest = Math.Min(grades, lowest); } GradeList.Remove(lowest); return(base.ComputeStatistics()); }
private bool ExtractInitData(string s) { string[] delim = { "var initData = {};", "initData.globalLocale =" }; string[] delim2 = { "initData." }; string[] delim3 = { " = " }; char[] delim4 = { ' ', ';', '\n', ' '}; string[] s1 = s.Split(delim, StringSplitOptions.None); if (s1.Length < 3) { return(false); } string s2 = s1[1]; string[] datum = s2.Split(delim2, StringSplitOptions.RemoveEmptyEntries); string product = datum[1].Split(delim3, StringSplitOptions.None)[1]; string meta = datum[2].Split(delim3, StringSplitOptions.None)[1]; string grade = datum[3].Split(delim3, StringSplitOptions.None)[1]; product = product.TrimEnd(delim4); meta = meta.TrimEnd(delim4); grade = grade.TrimEnd(delim4); _product = JsonConvert.DeserializeObject <Product>(product); _meta = JsonConvert.DeserializeObject <Meta>(meta); _grades = JsonConvert.DeserializeObject <Grade[]>(grade); GradeList.Clear(); BlockList.Clear(); Grade defaultGrade = new Grade(); defaultGrade.gradeId = 0; defaultGrade.name = "전체"; Meta.Draw.BlockInfo defaultBlock = new Meta.Draw.BlockInfo(); defaultBlock.blockId = 0; defaultBlock.blockName = "전체"; GradeList.Add(defaultGrade); BlockList.Add(defaultBlock); foreach (Grade item in _grades) { GradeList.Add(item); } foreach (Meta.Draw.BlockInfo item in _meta.draw.blockInfo) { BlockList.Add(item); } return(true); }
public IActionResult Index() { Students students = new Students(); students.AverageGrade = GradeList.Select(x => x.NumberGrade).Average(); students.StudentGradeDetail = GradeList.GroupBy(x => x.LetterGrade).Select(g => new StudentGradeDetail() { LetterGrade = g.Key, NumberOfStudents = g.Count() }).OrderBy(x => x.LetterGrade).ToList(); students.ListOfStudents = GradeList; return(View(students)); }
private void ModifyProjectMnBtn_Click(object sender, EventArgs e) { StudentsList.Hide(); TeamGroupBox.Hide(); AssignToWhomLabel.Hide(); AssignProjectBtn.Hide(); GradeList.Hide(); GradeGroupBox.Hide(); ProjectList.Show(); ProjectGroupBox.Show(); ProjectGroupBox.Location = new Point(450, 12); }
public ActionResult Grades() { /* check if user had logged in */ if (Session["ID"] == null || Session["password"] == null || Session["type"] == null) { return(RedirectToAction("Login", "Login")); } /* check if user is student type */ else if (!Session["type"].Equals("Student")) { return(RedirectToAction("Home", Session["type"].ToString())); } /* get student grades */ using (GradesDal gradesDb = new GradesDal()) { var id = Session["ID"].ToString(); /* get student courses he took moed B */ var Bgrades = (from row in gradesDb.Grades where row.ID.Equals(id) && row.moed == "B" select row).ToList(); /* get moed B course id */ var moedBCourses = (from row in gradesDb.Grades where row.ID.Equals(id) && row.moed == "B" select row.courseId).ToList(); /* get all moad A grades from courses student didnt take moed B */ var Agrades = (from row in gradesDb.Grades where row.ID.Equals(id) && row.moed == "A" && !moedBCourses.Contains(row.courseId) select row).ToList(); /* create grade list model */ GradeList studenGrades = new GradeList(); studenGrades.grades = new List <Grade>(); foreach (Grade x in Bgrades) { studenGrades.grades.Add(x); } foreach (Grade x in Agrades) { studenGrades.grades.Add(x); } return(View(studenGrades)); } }
private void ChooseCourseMnBtn_Click(object sender, EventArgs e) { YouAreHere(ChooseCourseMnBtn); ProjectGroupBox.Hide(); ProjectList.Hide(); GradeList.Hide(); GradeGroupBox.Hide(); TeamGroupBox.Hide(); TeamList.Hide(); SelectedCourseLabel.Show(); CoursesList.Show(); SelectCourseBtn.Show(); }
// GET: GradeLists/Delete/5 public ActionResult Delete(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } GradeList gradeList = db.GradeList.Find(id); if (gradeList == null) { return(HttpNotFound()); } return(View(gradeList)); }
/// <summary> /// How many students received each letter grade /// </summary> /// <returns></returns> private List <StudentGradeVM> GetStudentsEachLetterGrade() { var anony = GradeList.GroupBy(gl => gl.LetterGrade).Select(g => new { LetterGrade = g.Key, Count = g.Count() }).OrderBy(o => o.LetterGrade); List <StudentGradeVM> listvm = new List <StudentGradeVM>(); foreach (var zz in anony.ToList()) { listvm.Add(new StudentGradeVM { LetterGrade = zz.LetterGrade, Count = zz.Count }); } return(listvm); }
/// <summary> /// A list of students ordered by their number grade descending (Grade - FirstName LastName) /// </summary> /// <returns></returns> private List <StudentGradeVM> GetStudentsNumberGradeDesc() { var anony = GradeList.OrderByDescending(g => g.NumberGrade).ThenByDescending(g => g.FirstName).ThenByDescending(g => g.LastName).Select(b => new { b.NumberGrade, b.FirstName, b.LastName }); List <StudentGradeVM> listvm = new List <StudentGradeVM>(); foreach (var zz in anony.ToList()) { listvm.Add(new StudentGradeVM { NumberGrade = zz.NumberGrade, FirstName = zz.FirstName, LastName = zz.LastName }); } return(listvm); }
private void btnDel_Click(object sender, EventArgs e) { GradeList grades = GradeList.getInstance(); int idGrade = 0; foreach (DataGridViewCell cell in _dgv.SelectedCells) { int.TryParse(_dgv.Rows[cell.RowIndex].Cells[0].Value.ToString(), out idGrade); grades.Delete(idGrade); } loadGrade(); }
public void loadLists(MerkatoDbContext context) { SelectListItem all = new SelectListItem() { Text = "(All)", Value = "0" }; ClientList = context.Client.Select(p => new SelectListItem() { Text = p.ClientName, Value = p.Id.ToString() }).ToList(); OutletList = context.Outlet.Select(p => new SelectListItem() { Text = p.Name, Value = p.Id.ToString() }).ToList(); GenderList = context.Gender.Select(p => new SelectListItem() { Text = p.Name, Value = p.Id.ToString() }).ToList(); GenderList.Add(all); SkillsList = context.SkillsProficiency.Select(p => new SelectListItem() { Text = p.Name, Value = p.Id.ToString() }).ToList(); SkillsList.Add(all); LanguageList = context.LanguageProficiency.Select(p => new SelectListItem() { Text = p.Name, Value = p.Id.ToString() }).ToList(); LanguageList.Add(all); GradeList = context.AgentGrade.Select(p => new SelectListItem() { Text = p.Name, Value = p.Id.ToString() }).ToList(); GradeList.Add(all); var query = (from PM in context.ProductMechanism join M in context.Mechanism on PM.MechanismId equals M.Id select new { ProductMechanism = PM, Mechanism = M }) .Select(p => new MechanismModel { Name = p.Mechanism.Name, Id = p.ProductMechanism.MechanismId }).ToList(); MechanismList = query.Select(p => new SelectListItem() { Text = p.Name, Value = p.Id.ToString() }).ToList(); }
private void AssignProjectMnBtn_Click(object sender, EventArgs e) { ProjectGroupBox.Hide(); TeamGroupBox.Hide(); GradeList.Hide(); GradeGroupBox.Hide(); StudentsList.Anchor = (AnchorStyles.Bottom | AnchorStyles.Right | AnchorStyles.Top); AssignToWhomLabel.Show(); AssignProjectBtn.Show(); ProjectList.Show(); StudentsList.Show(); StudentsList.Location = new Point(635, 12); AssignProjectBtn.Location = new Point(467, 100); AssignToWhomLabel.Location = new Point(407, 50); }
private void ModifyTeamMnBtn_Click(object sender, EventArgs e) { ProjectGroupBox.Hide(); ProjectList.Hide(); GradeList.Hide(); AssignToWhomLabel.Hide(); AssignProjectBtn.Hide(); GradeGroupBox.Hide(); StudentsList.Anchor = (AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Top); TeamGroupBox.Show(); StudentsList.Show(); TeamGroupBox.Location = new Point(550, 12); StudentsList.Location = new Point(150, 12); }
private void loadGrade() { if (_load) { int idModel = 0; if (cbModel.SelectedValue != null) { int.TryParse(cbModel.SelectedValue.ToString(), out idModel); } GradeList grades = GradeList.getInstance(); cbGrade.DataSource = grades.ToDataTable(idModel); cbGrade.DisplayMember = "Название"; cbGrade.ValueMember = "id"; } }
/// <summary> /// Checks if entered course and group exist /// </summary> /// <param name="s">C.G</param> /// <returns></returns> static bool IsCourseGroup(long id, string s) { var lst = s.Split('.'); if (lst.Length != 2 || lst[0] == String.Empty || lst[1] == String.Empty) { logger.Info($"ID: {id}, IsCourseGroup(\"{s}\") - Ошибка ввода!"); return(false); } var(course, group) = (-1, -1); bool IsCourse = int.TryParse(lst[0], out course); bool IsGroup = int.TryParse(lst[1], out group); if (!IsCourse || !IsGroup) { logger.Info($"ID: {id}, IsCourseGroup(\"{s}\") - Ошибка парсинга!"); return(false); } try { int groupid = 0; switch (UserList[id].Info) { case User.UserInfo.bachelor: groupid = GradeList.Find(y => y.degree == "bachelor" && y.num == course).Groups.Find(y => y.num == group).id; break; case User.UserInfo.graduate: groupid = GradeList.Find(y => y.degree == "postgraduate" && y.num == course).Groups.Find(y => y.num == group).id; break; case User.UserInfo.master: groupid = GradeList.Find(y => y.degree == "master" && y.num == course).Groups.Find(y => y.num == group).id; break; } UserList[id].groupid = groupid; return(true); } catch (NullReferenceException e) { logger.Info(e, $"ID: {id}, IsCourseGroup(\"{s}\") - Исключение!"); return(false); } }
private void _dgv_CellMouseDoubleClick(object sender, DataGridViewCellMouseEventArgs e) { if ((e.ColumnIndex < 0) || (e.RowIndex < 0)) { return; } int idGrade = Convert.ToInt32(_dgv.Rows[e.RowIndex].Cells[0].Value); GradeList grades = GradeList.getInstance(); Grade grade = grades.getItem(idGrade); Grade_AddEdit aeG = new Grade_AddEdit(grade); if (aeG.ShowDialog() == System.Windows.Forms.DialogResult.OK) { loadGrade(); } }
public void CreateAllBiowareTest() { // Create a new Human character. Character objCharacter = new Character(); objCharacter.LoadMetatype(Guid.Parse("e28e7075-f635-4c02-937c-e4fc61c51602")); TreeNode objNode = new TreeNode(); List<Weapon> lstWeapons = new List<Weapon>(); List<TreeNode> lstTreeNodes = new List<TreeNode>(); GradeList objGradeList = new GradeList(); objGradeList.LoadList(Improvement.ImprovementSource.Bioware); XmlDocument objXmlDocument = XmlManager.Instance.Load("bioware.xml"); foreach (XmlNode objXmlNode in objXmlDocument.SelectNodes("/chummer/biowares/bioware")) { Cyberware objCyberware = new Cyberware(objCharacter); objCyberware.Create(objXmlNode, objCharacter, objGradeList.GetGrade("Standard"), Improvement.ImprovementSource.Bioware, 1, objNode, lstWeapons, lstTreeNodes); } }
private void frmSelectCyberwareSuite_Load(object sender, EventArgs e) { foreach (Label objLabel in Controls.OfType <Label>()) { if (objLabel.Text.StartsWith('[')) { objLabel.Text = string.Empty; } } if (_objCharacter.DEPEnabled) { return; } XmlNodeList objXmlSuiteList = _objXmlDocument.SelectNodes("/chummer/suites/suite"); GradeList lstGrades = null; if (_objSource == Improvement.ImprovementSource.Bioware) { GlobalOptions.BiowareGrades.LoadList(Improvement.ImprovementSource.Bioware, _objCharacter.Options); lstGrades = GlobalOptions.BiowareGrades; } else { GlobalOptions.CyberwareGrades.LoadList(Improvement.ImprovementSource.Cyberware, _objCharacter.Options); lstGrades = GlobalOptions.CyberwareGrades; } foreach (XmlNode objXmlSuite in objXmlSuiteList) { string strGrade = objXmlSuite["grade"]?.InnerText ?? string.Empty; if (string.IsNullOrEmpty(strGrade) && (!lstGrades.Any(x => x.Name == strGrade) || _objCharacter.Improvements.Any(x => ((_objSource == Improvement.ImprovementSource.Cyberware && x.ImproveType == Improvement.ImprovementType.DisableBiowareGrade) || (_objSource == Improvement.ImprovementSource.Bioware && x.ImproveType == Improvement.ImprovementType.DisableCyberwareGrade)) && strGrade.Contains(x.ImprovedName) && x.Enabled))) { continue; } lstCyberware.Items.Add(objXmlSuite["name"].InnerText); } }
public void ShowInvoice() { _excelDoc = openDocumentExcel("Накладная"); _excelDoc.setValue(7, 2, _car.info.Owner); _excelDoc.setValue(16, 82, _invoice.Number); _excelDoc.setValue(16, 98, _invoice.Date.ToShortDateString()); string fullNameAuto = string.Concat("Автомобиль ", _car.Mark.Name, " ", _car.info.Model, ", ", _car.Grz); _excelDoc.setValue(22, 10, fullNameAuto); _excelDoc.setValue(22, 53, _car.dateGet.ToShortDateString()); var grades = GradeList.getInstance(); var grade = grades.getItem(Convert.ToInt32(_car.GradeID)); var ptsList = PTSList.getInstance(); var pts = ptsList.getItem(_car); var fullDetailAuto = string.Concat("VIN ", _car.vin, ", Двигатель ", _car.eNumber, ", № кузова ", _car.bodyNumber, ", Год выпуска ", _car.Year, " г., Паспорт ", pts.Number, " от ", pts.Date.ToShortDateString(), ", мощность двигателя ", grade.EPower, " л.с."); _excelDoc.setValue(47, 2, fullDetailAuto); Driver driver1 = _driverList.getItem(Convert.ToInt32(_invoice.DriverFromID)); Driver driver2 = _driverList.getItem(Convert.ToInt32(_invoice.DriverToID)); _excelDoc.setValue(9, 10, driver1.Dept); _excelDoc.setValue(56, 11, driver1.Position); _excelDoc.setValue(56, 63, driver1.GetName(NameType.Full)); _excelDoc.setValue(11, 13, driver2.Dept); _excelDoc.setValue(60, 11, driver2.Position); _excelDoc.setValue(60, 63, driver2.GetName(NameType.Full)); _excelDoc.Show(); }
private void GradeProjectsMnBtn_Click(object sender, EventArgs e) { YouAreHere(GradeProjectsMnBtn); SelectedCourseLabel.Hide(); CoursesList.Hide(); SelectCourseBtn.Hide(); ProjectList.Hide(); ProjectGroupBox.Hide(); TeamGroupBox.Hide(); TeamList.Hide(); GradeGroupBox.Show(); GradeList.Show(); GradeGroupBox.Location = new Point(450, 12); RefreshList(); ClearAllBoxes(); EnableViewLists(); ChangeBtnNames(); }
public List<Grade> GradeEditOrder(GradeList gradeList) { List<Grade> results = new List<Grade>(); foreach (GradeListItem gradeModel in gradeList) { Grade grade = GradeGetByID(gradeModel.GradeID); if (grade == null) continue; grade.Ordre = gradeModel.Ordre; results.Add(grade); } return results; }