public DtoGenerator(ClassesList descriptions, ICodeGenerator codeGenerator, IConfiguration config) { if (descriptions == null) { throw new ArgumentNullException(nameof(descriptions)); } if (descriptions.Classes == null) { throw new ArgumentNullException(nameof(descriptions.Classes)); } if (codeGenerator == null) { throw new ArgumentNullException(nameof(codeGenerator)); } if (config == null) { throw new ArgumentNullException(nameof(config)); } this.descriptions = descriptions; this.codeGenerator = codeGenerator; this.config = config; maxTaskCount = config.MaxTaskCount; nameSpace = config.Namespace; complete = new CountdownEvent(descriptions.Classes.Length); waitingClasses = new Queue <ClassTemplate>(); currentTaskCount = 0; }
public CreateExamViewModel() { try { Response <List <QualificationModel> > response = qualificationManager.GetAllQualifications(); List <QualificationModel> data = response.Data; foreach (var qualif in data) { QualifsList.Add(qualif.Code); } Response <List <ClassSimpleModel> > responseClass = userManager.GetAllClasses(); List <ClassSimpleModel> dataClass = responseClass.Data; foreach (var className in dataClass) { ClassesList.Add(className.ClassName); } } catch (Exception exception) { NotifyMessageViewVisibility.ShowMessageView("Błąd!", exception.Message); } }
public sealed override void RefreshData() { // get classes var currentSchool = GetCurrentSchool(); var classes = ClassesRealm.GetAll(x => x.School == currentSchool).ToList(); var classesContainer = new List <ViewModels.Controls.PrettyListViewItems.ClassDate>(); var currentDate = SelectedDate; for (var i = 0; i < 7; i++) { // increase current date by one day currentDate = currentDate.AddDays(1); // loop through all classes foreach (var classModel in classes) { // if class falls on the current date, add it to the list with the current date if (classModel.Day == currentDate.DayOfWeek.ToString()) { var classDate = currentDate.UtcDateTime.Date; var canceledClassesRealm = new Domain.Services.Realms.CanceledClasses(); var canceledClass = canceledClassesRealm.GetRealmResults() .Where(x => x.Class == classModel) .FirstOrDefault(x => x.Date == classDate); var canceledRecordExists = canceledClass != null; var isCanceled = canceledRecordExists && canceledClass.IsCanceled; classesContainer.Add(new ViewModels.Controls.PrettyListViewItems.ClassDate(classModel, currentDate, isCanceled)); } } } ClassesList.Clear(); ClassesList.AddRange(classesContainer); }
public ActionResult ClassList() { Session["LecID"] = Session["LecID"]; String LecID = Session["LecID"].ToString(); LecID = LecID.ToUpper(); string connectionString = @"Data Source=msi;Initial Catalog=SEFASSIGNMENT;Integrated Security=True;Connect Timeout=30;Encrypt=False;TrustServerCertificate=False;ApplicationIntent=ReadWrite;MultiSubnetFailover=False"; System.Data.SqlClient.SqlConnection sqlConnection = new System.Data.SqlClient.SqlConnection(connectionString); sqlConnection.Open(); System.Data.SqlClient.SqlCommand sqlCommand = new System.Data.SqlClient.SqlCommand("SELECT CLASS_ID FROM [SEFASSIGNMENT].[dbo].[Class] WHERE CLASS.LEC_ID='" + LecID + "'"); sqlCommand.Connection = sqlConnection; SqlDataReader myreader = sqlCommand.ExecuteReader(); List <String> ClassIDList = new List <String>(); while (myreader.Read()) { ClassIDList.Add(myreader[0].ToString()); } myreader.Close(); sqlCommand = new System.Data.SqlClient.SqlCommand("SELECT CLASS_NAME FROM [SEFASSIGNMENT].[dbo].[Class] WHERE CLASS.LEC_ID='" + LecID + "'"); sqlCommand.Connection = sqlConnection; SqlDataReader newmyreader = sqlCommand.ExecuteReader(); List <String> ClassNameList = new List <String>(); while (newmyreader.Read()) { ClassNameList.Add(newmyreader[0].ToString()); } sqlConnection.Close(); List <ClassList> Class = new List <ClassList>(); for (int i = 0; i < ClassIDList.Count; i++) { Class.Add(new ClassList() { ClassID = ClassIDList[i], ClassName = ClassNameList[i], IsCheck = false }); } ClassesList CL = new ClassesList(); CL.ViewClassList = Class; return(View(CL)); }
//Get data private void GetData() { try { var doc = new HtmlDocument(); URL = ConfigurationManager.AppSettings["BaseURL"] + this.ClubID; doc.LoadHtml(ReadData(URL)); var table = doc.GetElementbyId("tblSchedule"); foreach (var tr in table.SelectSingleNode("tbody").SelectNodes("tr")) { string time = tr.SelectSingleNode("th").SelectSingleNode("h5").InnerText; string className = string.Empty; string classDescriptionuri = string.Empty; string classDescription = string.Empty; int currDayInt = 0; foreach (var td in tr.SelectNodes("td")) { string currDay = Days[currDayInt]; if (td.HasChildNodes) { className = td.InnerText; classDescription = className.Split('(')[0].Trim(); try { classDescriptionuri = td.SelectSingleNode(".//strong//a").GetAttributeValue("href", "Class Description Link not found"); } catch (NullReferenceException) { classDescriptionuri = td.SelectSingleNode(".//a").GetAttributeValue("href", "Class Description Link not found"); } if (!ClassDescriptionsURIs.Contains(classDescriptionuri)) { ClassDescriptionsURIs.Add(classDescriptionuri); } } else { className = "No Class"; classDescriptionuri = "No Description URI"; } ClassesList.Add(new Class(time, currDay, className, classDescriptionuri, classDescription)); currDayInt += 1; } //Store unique times if (!Times.Contains(time)) { Times.Add(time); } } } catch (Exception e) { throw new Exception(e.Message); } }
public sealed override void RefreshData() { var currentSchool = GetCurrentSchool(); var classes = ClassesRealm.GetAll(x => x.School == currentSchool).ToList(); var classesContainer = new List <ViewModels.Controls.PrettyListViewItems.Class>(); foreach (var classModel in classes) { classesContainer.Add(new ViewModels.Controls.PrettyListViewItems.Class(classModel)); } ClassesList.Clear(); ClassesList.AddRange(classesContainer); }
public void AddClass(Class c) { if (ClassById.ContainsKey(c.ID)) { throw new InvalidOperationException(String.Format("Class with ID={0} already exists", c.ID)); } if (ClassByCompactId.ContainsKey(c.CompactID)) { throw new InvalidOperationException(String.Format("Class with CompactID={0} already exists", c.ID)); } ClassById[c.ID] = c; ClassByCompactId[c.CompactID] = c; ClassesList.Add(c); c.Schema = this; }
public ActionResult ClassList(ClassesList cl, string action) { if (action.Equals("home")) { return(RedirectToAction("HomeLec", "HomeLec")); } else if (action.Equals("back")) { String currentstep = TempData["step"].ToString(); if (currentstep.Equals("rankingboard")) { return(RedirectToAction("HomeLec", "HomeLec")); } else { return(RedirectToAction("ManageClass")); } } else if (action.Equals("submit")) { StringBuilder sb = new StringBuilder(); int counter = 0; foreach (var item in cl.ViewClassList) { if (item.IsCheck) { sb.Append(item.ClassID); counter++; } } String content = sb.ToString(); if (counter > 1) { TempData["AlertMessage"] = "Please only insert one boxes! Returning to main menu."; return(RedirectToAction("ManageClass")); } TempData["Class"] = content; Session["Class"] = content; String currentstep = TempData["step"].ToString(); if (currentstep.Equals("generate")) { return(RedirectToAction("StudentList")); } else if (currentstep.Equals("remove")) { return(RedirectToAction("RemoveStudent")); } else if (currentstep.Equals("attendance")) { return(RedirectToAction("PuzzleList")); } else if (currentstep.Equals("rankingboard")) { return(RedirectToAction("CreateRanking")); } } return(View()); }