public List <Models.QuestionModel> GetInitizlizedList(SubjectTypes subjectType) { var questionsList = new List <Models.QuestionModel>(); foreach (var question in GetQustions(subjectType)) { string answerText = string.Empty; for (int i = 0; i < question.Variants.Count; i++) { if (question.Variants.Count > 1 && i != question.Variants.Count - 1) { answerText += $"{question.Variants[i]};{Environment.NewLine}"; } else { answerText += $"{question.Variants[i]}."; } } var questionModel = new Models.QuestionModel { QuestionText = question.Text, AnswerText = answerText, QuestionImage = question.ImageSrc }; questionsList.Add(questionModel); } return(questionsList); }
private bool mValidateDelete(int iDMedia) { pMessage.Clear(); bool isValid = true; MediaSubjects mediaSubject = new MediaSubjects(); mediaSubject.LoadByIDMedia(iDMedia); mediaSubject.Sort = MediaSubjects.ColumnNames.IDMediaSubjectType; if (mediaSubject.RowCount > 0) { isValid = false; pMessage.Add(Farschidus.Translator.AppTranslate["mediaManaging.default.message.subjectMediaRelation"], Farschidus.Web.UI.Message.MessageTypes.Warning); Subjects subject = new Subjects(); SubjectTypes subjectType = new SubjectTypes(); MediaSubjectTypes mediaSubjectType = new MediaSubjectTypes(); BLL.Hardcodes.Tables hcTables = new BLL.Hardcodes.Tables(); string moduleName = string.Empty; string usageType = string.Empty; do { subject.LoadByPrimaryKey(mediaSubject.pIDSubject); subjectType.LoadByPrimaryKey(subject.pIDSubjectType); mediaSubjectType.LoadByPrimaryKey(mediaSubject.pIDMediaSubjectType); moduleName = hcTables.SubjectTypes.Find(item => item.ID.ToString() == ((byte)((SubjectTypes.Enum)Enum.Parse(typeof(SubjectTypes.Enum), subjectType.pTitle, true))).ToString()).Title; usageType = hcTables.MediaSubjectTypes.Find(item => item.ID.ToString() == ((byte)((MediaSubjectTypes.Enum)Enum.Parse(typeof(MediaSubjectTypes.Enum), mediaSubjectType.pTitle, true))).ToString()).Title; pMessage.Add(string.Format("{0}, {1}: {2}", moduleName, mediaSubject.Subjects.pTitle, usageType), Farschidus.Web.UI.Message.MessageTypes.Information); }while (mediaSubject.MoveNext()); } return(isValid); }
public AuditSubjectData( SubjectTypes subjectType, string subjectIdentifier, string subjectMetadata, string groupIdentifier, string host, string remoteIp, string resourceName, string userAgent, string traceIdentifier, string appVersion) { SubjectType = subjectType; SubjectIdentifier = subjectIdentifier; SubjectMetadata = subjectMetadata; GroupIdentifier = groupIdentifier; Host = host; RemoteIp = remoteIp; ResourceName = resourceName; UserAgent = userAgent; TraceIdentifier = traceIdentifier; AppVersion = appVersion; }
public ActionResult DeleteConfirmed(int id) { SubjectTypes subjectTypes = db.SubjectTypes.Find(id); db.SubjectTypes.Remove(subjectTypes); db.SaveChanges(); return(RedirectToAction("Index")); }
public IEnumerable <ParseQuestionModel> GetQustions(SubjectTypes subjectType) { var assembly = typeof(Initializer).GetTypeInfo().Assembly; Stream stream = assembly.GetManifestResourceStream(GetDestinationPath(subjectType)); QuestionReaderService readerService = new QuestionReaderService(stream); IEnumerable <ParseQuestionModel> questions = readerService.GetInputData(); return(questions); }
public ActionResult Edit([Bind(Include = "Id,Name,Priority,SchoolsId")] SubjectTypes subjectTypes) { if (ModelState.IsValid) { db.Entry(subjectTypes).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.SchoolsId = new SelectList(db.Schools, "Id", "AspNetUsersId", subjectTypes.SchoolsId); return(View(subjectTypes)); }
private string GetDestinationPath(SubjectTypes subjectType) { switch (subjectType) { case SubjectTypes.FundamentalSE: return("Answers.DbInitilizers.FundamentalSE.json"); case SubjectTypes.DataBases: return("Answers.DbInitilizers.DataBases.json"); case SubjectTypes.ArchitectureSE: return("Answers.DbInitilizers.ArchitectureSE.json"); } return(string.Empty); }
// GET: SubjectTypes/Details/5 public ActionResult Details(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } SubjectTypes subjectTypes = db.SubjectTypes.Find(id); if (subjectTypes == null) { return(HttpNotFound()); } return(View(subjectTypes)); }
// GET: SubjectTypes/Edit/5 public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } SubjectTypes subjectTypes = db.SubjectTypes.Find(id); if (subjectTypes == null) { return(HttpNotFound()); } ViewBag.SchoolsId = new SelectList(db.Schools, "Id", "AspNetUsersId", subjectTypes.SchoolsId); return(View(subjectTypes)); }
/// <summary> /// Creates SubjectTypes for records In the prefilled DataReader, And puts them into a HashTable /// </summary> /// <param name="dr">The DataReader prefilled With the SubjectTypes records</param> /// <returns>The Hashtable containing SubjectTypes objects And their ID As key.</returns> protected static Hashtable ConvertReaderToHashTable(SqlDataReader dr) { Hashtable result = new Hashtable(); while (dr.Read()) { SubjectTypes mySubjectTypes = new SubjectTypes(); mySubjectTypes.m_intSubjectTypeID = dr.GetSqlInt32(0); mySubjectTypes.m_strDescription = dr.GetSqlString(1); mySubjectTypes.m_intOrder = dr.GetSqlInt32(2); result.Add(mySubjectTypes.SubjectTypeID, mySubjectTypes); } return(result); }
public void Update() { IsCommandEnable = false; if (FocusedElement is SubjectCanvas) { SelectedSubject = ((SubjectCanvas)FocusedElement).View; SelectedSubjectType = SubjectTypes.Single(x => x.Type == SelectedSubject.type); AllSubjectViews = new ObservableCollection <SubjectView>(_MainView.LoadedDiagram.Subjects .Where(x => x.type == SelectedSubject.type).ToList()); if (SelectedSubject?.Name == "") { SelectedSubject = null; } } else if (FocusedElement is ReferenceCanvas) { var element = (ReferenceCanvas)FocusedElement; _SubjectCanvases = (_MainView.Elements.Where(x => x is SubjectCanvas) .Select(y => (SubjectCanvas)y).ToList()); SubjectViews = new ObservableCollection <SubjectView> (_SubjectCanvases.Select(x => x.View).ToList()); SelectedRefType = ReferenceTypes .Where(x => x.Type == element.View.type).Single(); SelectedStart = element.Subject.View; SelectedEnd = element.Target.View; } IsCommandEnable = true; _MainView.UpdateCanvas(); }
public ActionResult Create([Bind(Include = "Id,Name,Priority,SchoolsId")] SubjectTypes subjectTypes) { if (ModelState.IsValid) { db.SubjectTypes.Add(subjectTypes); db.SaveChanges(); return(RedirectToAction("Index")); } List <Schools> list = new List <Schools>(); var user = User.Identity.GetUserId(); list = (from b in db.Schools where b.AspNetUsersId.Equals(user) select b).ToList(); // .Where(s => s.SchoolsId == list.First().Id).ToList() ViewBag.SchoolsId = new SelectList(list, "Id", "AspNetUsersId", subjectTypes.SchoolsId); return(View(subjectTypes)); }
public static List <SubjectTypes> GetSubjectTypeListByCourseStream(int CourseID, string StreamID) { try { DataTable SubjectAllByQualStreamTable = SubjectTypeDataAccess.GetInstance.GetSubjectTypeListByCourseStream(CourseID, StreamID); List <SubjectTypes> SubjectTypeList = new List <SubjectTypes>(); foreach (DataRow dr in SubjectAllByQualStreamTable.Rows) { SubjectTypes TheSubjectType = new SubjectTypes(); TheSubjectType.SubjectTypeID = int.Parse(dr["SubjectTypeID"].ToString()); TheSubjectType.SubjectTypeName = (dr["SubjectTypeName"].ToString()); TheSubjectType.QualID = int.Parse(dr["QualID"].ToString()); TheSubjectType.StreamID = (dr["StreamID"].ToString()); SubjectTypeList.Add(TheSubjectType); } return(SubjectTypeList); } catch (Exception ex) { throw (new Exception(MethodBase.GetCurrentMethod().DeclaringType.ToString() + "." + (new System.Diagnostics.StackFrame()).GetMethod().Name, ex)); } }