/// <summary> /// Returnerer info om ét specifikt Uddannelsessted ud fra id. /// </summary> /// <param name="id">Uddannelsessted ID</param> /// <returns> /// Ét Uddannelsessted. Uddannelsesstedet returneres som et jSon objekt, /// som indeholder felterne : EducationID og EducationName. /// Eller et json Objekt med felterne ErrorNumber og ErrorText hvor ErrorNumber har en værdi /// mindre end 0. Se en oversigt over return koder i ReturnCodesAndStrings /// eller klik her /// </returns> // GET api/<controller>/5 public Object Get(int id) { object jSon_Object = new object(); Education Education_Object = new Education(); Education_Object = db.Educations.Find(id); if (null != Education_Object) { var ListItem = new { EducationID = Education_Object.EducationID, EducationName = Education_Object.EducationName }; jSon_Object = ListItem; } else { var ListItem = new { ErrorCode = Const.ObjectNotFound, ErrorText = Const.FindReturnString(Const.ObjectNotFound) }; jSon_Object = ListItem; } return(jSon_Object); }
/// <summary> /// Returnerer info om specifikke Uddannelseslinjer på ét specifikt Uddannelsessted udfra Uddannelsessted ID /// </summary> /// <param name="id">Uddannelsessted ID</param> /// <returns> /// Returnerer Uddannelseslinje navn og Uddannelsessted navn udfra Uddannelseslinje ID /// </returns> /// /// <returns> /// Én liste af Uddannelseslinjer på ét Uddannelsessted. Listen returneres /// som en liste af jSon objekter, hvor hver enkelt jSon element indeholder felterne : /// EducationLineID, EducationLineName og EducationName. /// Eller et json Objekt med felterne ErrorNumber og ErrorText hvor ErrorNumber har en værdi /// mindre end 0. Se en oversigt over return koder i ReturnCodesAndStrings /// eller klik her : <see cref="ReturnCodeAndReturnString"/> /// </returns> // GET api/<controller>/5 public List <Object> Get(int id) { List <object> jSonList = new List <object>(); List <EducationLine> EducationLine_List = new List <EducationLine>(); EducationLine_List = db.EducationLines.Where(e => e.EducationID == id).ToList(); if (EducationLine_List.Count > 0) { foreach (EducationLine EducationLine_Object in EducationLine_List) { var ListItem = new { EducationLineID = EducationLine_Object.EducationLineID, EducationLineName = EducationLine_Object.EducationLineName, EducationName = EducationLine_Object.Education.EducationName }; jSonList.Add(ListItem); } } else { var ListItem = new { ErrorCode = Const.ObjectNotFound, ErrorText = Const.FindReturnString(Const.ObjectNotFound) }; jSonList.Add(ListItem); } return(jSonList); }
/// <summary> /// Returnerer info om alle Brugerfiler gemt af en bruger specificeret ved UserName /// og Password. /// </summary> /// <param name="Password">Password for nuværende bruger.</param> /// <param name="UserName">Brugernavn for nuværende bruger.</param> /// <returns> /// Liste af Brugerfiler. Listen returneres som en liste af jSon objekter, /// hvor hver enkelt jSon element indeholder felterne : UserFileID, UserFileUrl og UserFileAtt. /// Eller et json Objekt med felterne ErrorNumber og ErrorText hvor ErrorNumber har en værdi /// mindre end 0. Se en oversigt over return koder i ReturnCodesAndStrings /// eller klik her : <see cref="ReturnCodeAndReturnString"/> /// </returns> // GET api/<controller> public List <Object> Get(string UserName, string Password) { List <object> jSonList = new List <object>(); int UserID = 0; UserID = UserInfo.FindUserInDatabase(UserName, Password); if (Const.UserNotFound < UserID) { List <UserFile> UserFileList = new List <UserFile>(); UserFileList = db.UserFiles.Where(u => u.UserInfoID == UserID).ToList(); foreach (UserFile UserFile_Object in UserFileList) { var ListItem = new { UserFileID = UserFile_Object.UserFileID, UserFileUrl = UserFile_Object.UserFileUrl, UserFileAtt = UserFile_Object.userFileAlt }; jSonList.Add(ListItem); } } else { var ListItem = new { ErrorNumber = Const.UserNotFound, ErrorText = Const.FindReturnString(Const.UserNotFound) }; jSonList.Add(ListItem); } return(jSonList); }
/// <summary> /// Returnerer info om ét specifikt F*g/Kursus udfra id. /// </summary> /// <param name="id">F*g/Kursus ID</param> /// <returns> /// Ét Kursus/F*g. Kurset/Faget returneres som et jSon element, som indeholder /// felterne : CourseID og CourseName. /// Eller et json Objekt med felterne ErrorNumber og ErrorText hvor ErrorNumber har en værdi /// mindre end 0. Se en oversigt over return koder i ReturnCodesAndStrings /// eller klik her : <see cref="ReturnCodeAndReturnString"/> /// </returns> // GET api/<controller>/5 public object Get(int id) { object jSon_Object = new object(); Course Course_Object = new Course(); Course_Object = db.Courses.Find(id); if (null != Course_Object) { var ListItem = new { CourseID = Course_Object.CourseID, CourseName = Course_Object.CourseName }; jSon_Object = ListItem; } else { var ListItem = new { ErrorCode = Const.ObjectNotFound, ErrorText = Const.FindReturnString(Const.ObjectNotFound) }; jSon_Object = ListItem; } return(jSon_Object); }
/// <summary> /// Returnerer info om alle F*g/Kursus forløb på alle Uddannelsesforløb gemt af en bruger specificeret /// ved UserName og Password. /// </summary> /// <param name="Password">Password for nuværende bruger.</param> /// <param name="UserName">Brugernavn for nuværende bruger.</param> /// <returns> /// Liste af F*g/Kursus forløb. Listen returneres som en liste af jSon objekter, /// hvor hver enkelt jSon element indeholder felterne : User_Education_Character_Course_CollectionID, /// CourseID, CourseName, WhichCharacterScaleIDCourse, WhichCharacterScaleNameCourse, /// CharacterValueCourse, AbsencePercentageCourse, EducationLine, EducationName, /// EducationStartTime, EducationEndTime, CharacterValueEducation og /// AbsencePercentageForEducation. Flere af de nævnte "ID felter", kan have /// en værdi på -10 (InformationNotProvided), hvis disse felter ikke er udfyldt af /// brugeren. Er det et tekst felt, vil feltet have værdien : "Information er ikke gemt" /// Ved fejl vil der returneres et json Objekt med felterne ErrorNumber og ErrorText, /// hvor ErrorNumber har en værdi mindre end 0. Se en oversigt over return koder i ReturnCodesAndStrings /// eller klik her : <see cref="ReturnCodeAndReturnString"/> /// </returns> // GET api/<controller> public List <Object> Get(string UserName, string Password) { List <object> jSonList = new List <object>(); List <User_Education_Character_Course_Collection> User_Education_Character_Course_Collection_List = new List <User_Education_Character_Course_Collection>(); int UserID = 0; UserID = UserInfo.FindUserInDatabase(UserName, Password); if (0 < UserID) { User_Education_Character_Course_Collection_List = db.User_Education_Character_Course_Collections.Where(u => u.User_Education_Time_Collection.UserInfoID == UserID).ToList(); foreach (User_Education_Character_Course_Collection User_Education_Character_Course_Collection_Object in User_Education_Character_Course_Collection_List) { var ListItemCourseCharacter = new { User_Education_Character_Course_CollectionID = User_Education_Character_Course_Collection_Object.User_Education_Character_Course_CollectionID, CourseID = User_Education_Character_Course_Collection_Object.CourseID, CourseName = User_Education_Character_Course_Collection_Object.Course.CourseName, WhichCharacterScaleIDCourse = (null != User_Education_Character_Course_Collection_Object.WhichCharacterScaleID) ? User_Education_Character_Course_Collection_Object.WhichCharacterScaleID : Const.InformationNotProvided, WhichCharacterScaleNameCourse = (null != User_Education_Character_Course_Collection_Object.WhichCharacterScaleID) ? User_Education_Character_Course_Collection_Object.WhichCharacterScale.WhichCharacterScaleName : Const.FindReturnString(Const.InformationNotProvided), CharacterValueCourse = (null != User_Education_Character_Course_Collection_Object.CharacterValueCourse) ? User_Education_Character_Course_Collection_Object.CharacterValueCourse : Const.InformationNotProvided, AbsencePercentageCourse = (null != User_Education_Character_Course_Collection_Object.AbsencePercentageCourse) ? User_Education_Character_Course_Collection_Object.AbsencePercentageCourse : Const.InformationNotProvided, EducationLine = User_Education_Character_Course_Collection_Object.User_Education_Time_Collection.EducationLine.EducationLineName, EducationName = User_Education_Character_Course_Collection_Object.User_Education_Time_Collection.EducationLine.Education.EducationName, EducationStartTime = User_Education_Character_Course_Collection_Object.User_Education_Time_Collection.StartDate, EducationEndTime = User_Education_Character_Course_Collection_Object.User_Education_Time_Collection.EndDate, CharacterValueEducation = (null != User_Education_Character_Course_Collection_Object.User_Education_Time_Collection.CharacterValueEducation) ? User_Education_Character_Course_Collection_Object.User_Education_Time_Collection.CharacterValueEducation : Const.InformationNotProvided, AbsencePercentageForEducation = (null != User_Education_Character_Course_Collection_Object.User_Education_Time_Collection.AbsencePercentageEducation) ? User_Education_Character_Course_Collection_Object.User_Education_Time_Collection.AbsencePercentageEducation : Const.InformationNotProvided }; jSonList.Add(ListItemCourseCharacter); } } else { var ListItem = new { ErrorCode = Const.UserNotFound, ErrorText = Const.FindReturnString(Const.UserNotFound) }; jSonList.Add(ListItem); } return(jSonList); }
/// <summary> /// Returnerer info om én Brugerfil udfra id gemt af en bruger specificeret ved UserName /// og Password. /// </summary> /// <param name="id">Integer der specificerer id på kontaktformular.</param> /// <param name="Password">Password for nuværende bruger.</param> /// <param name="UserName">Brugernavn for nuværende bruger.</param> /// <returns> /// Én Brugerfil. Brugerfilen returneres som et jSon objekt, som indeholder /// felterne : UserFileID, UserFileUrl og UserFileAtt. /// Eller et json Objekt med felterne ErrorNumber og ErrorText hvor ErrorNumber har en værdi /// mindre end 0, hvis noget gik galt. Se en oversigt over return koder i ReturnCodesAndStrings /// eller klik her : <see cref="ReturnCodeAndReturnString"/> /// </returns> // GET api/<controller>/5 public object Get(int id, string UserName, string Password) { object jSon_Object = new object(); UserFile UserFile_Object = new UserFile(); int UserID = 0; UserID = UserInfo.FindUserInDatabase(UserName, Password); if (Const.UserNotFound < UserID) { UserFile_Object = db.UserFiles.Find(id); if (null != UserFile_Object) { if (UserID == UserFile_Object.UserInfoID) { var ListItem = new { UserFileID = UserFile_Object.UserFileID, UserFileUrl = UserFile_Object.UserFileUrl, UserFileAtt = UserFile_Object.userFileAlt }; jSon_Object = ListItem; } else { var ListItem = new { ErrorCode = Const.ObjectNotSavedByCurrentUserOriginally, ErrorText = Const.FindReturnString(Const.ObjectNotSavedByCurrentUserOriginally) }; jSon_Object = ListItem; } } else { var ListItem = new { ErrorCode = Const.ObjectNotFound, ErrorText = Const.FindReturnString(Const.ObjectNotFound) }; jSon_Object = ListItem; } } else { var ListItem = new { ErrorCode = Const.UserNotFound, ErrorText = Const.FindReturnString(Const.UserNotFound) }; jSon_Object = ListItem; } return(jSon_Object); }
/// <summary> /// Returnerer info om alle Kontaktformularer gemt af en bruger specificeret ved UserName /// og Password. /// </summary> /// <param name="Password">Password for nuværende bruger.</param> /// <param name="UserName">Brugernavn for nuværende bruger.</param> /// <returns> /// Liste af Kontaktformularer. Listen returneres som en liste af jSon objekter, /// hvor hver enkelt jSon element indeholder felterne : ContactFormID, ContactNameFrom, /// ContactNameEmail, ContactText, ContactNamePhoneNumber, ContactSubject og /// ContactEmailRecipient. /// Flere af de nævnte felter "ID felter", kan have en værdi på -10 (InformationNotProvided), /// hvis disse felter ikke er udfyldt af brugeren. Er det et tekst felt, vil feltet have værdien : /// "Information er ikke gemt". /// Ved fejl vil der returneres et json Objekt med felterne ErrorNumber og ErrorText, /// hvor ErrorNumber har en værdi mindre end 0. Se en oversigt over return koder i ReturnCodesAndStrings /// eller klik her : <see cref="ReturnCodeAndReturnString"/>. /// </returns> // GET api/<controller> public List <Object> Get(string UserName, string Password) { List <object> jSonList = new List <object>(); int UserID = 0; UserID = UserInfo.FindUserInDatabase(UserName, Password); if (Const.UserNotFound < UserID) { List <ContactForm> ContactFormList = new List <ContactForm>(); ContactFormList = db.ContactForms.Where(u => u.UserInfoID == UserID).ToList(); foreach (ContactForm ContactForm_Object in ContactFormList) { var ListItem = new { ContactFormID = ContactForm_Object.ContactFormID, ContactNameFrom = ContactForm_Object.ContactNameFrom, ContactNameEmail = ContactForm_Object.ContactNameEmail, ContactText = ContactForm_Object.ContactText, ContactNamePhoneNumber = (null != ContactForm_Object.ContactNamePhoneNumber) ? ContactForm_Object.ContactNamePhoneNumber : Const.FindReturnString(Const.InformationNotProvided), ContactSubject = (null != ContactForm_Object.ContactSubject) ? ContactForm_Object.ContactSubject : Const.FindReturnString(Const.InformationNotProvided), ContactEmailRecipient = (null != ContactForm_Object.ContactEmailRecipient) ? ContactForm_Object.ContactEmailRecipient : Const.FindReturnString(Const.InformationNotProvided) }; jSonList.Add(ListItem); } } else { var ListItem = new { ErrorNumber = Const.UserNotFound, ErrorText = Const.FindReturnString(Const.UserNotFound) }; jSonList.Add(ListItem); } return(jSonList); }
/// <summary> /// Returnerer info om én Kontaktformular udfra id gemt af en bruger /// specificeret ved UserName og Password. /// </summary> /// <param name="id">Integer der specificerer id på kontaktformular.</param> /// <param name="Password">Password for nuværende bruger.</param> /// <param name="UserName">Brugernavn for nuværende bruger.</param> /// <returns> /// Én Kontaktformular. Kontaktformularen returneres som et jSon objekt, /// som indeholder felterne : ContactFormID, ContactNameFrom, ContactNameEmail og /// ContactText, ContactNamePhoneNumber, ContactSubject og ContactEmailRecipient. /// Flere af de nævnte felter "ID felter", kan have en værdi på -10 (InformationNotProvided), /// hvis disse felter ikke er udfyldt af brugeren. Er det et tekst felt, vil feltet have værdien : /// "Information er ikke gemt". /// Ved fejl vil der returneres et json Objekt med felterne ErrorNumber og ErrorText, /// hvor ErrorNumber har en værdi mindre end 0. Se en oversigt over return koder i ReturnCodesAndStrings /// eller klik her : <see cref="ReturnCodeAndReturnString"/>. /// </returns> // GET api/<controller>/5 public object Get(int id, string UserName, string Password) { object jSon_Object = new object(); ContactForm ContactForm_Object = new ContactForm(); int UserID = 0; UserID = UserInfo.FindUserInDatabase(UserName, Password); if (Const.UserNotFound < UserID) { ContactForm_Object = db.ContactForms.Find(id); if (null != ContactForm_Object) { if (UserID == ContactForm_Object.UserInfoID) { var ListItem = new { ContactFormID = ContactForm_Object.ContactFormID, ContactNameFrom = ContactForm_Object.ContactNameFrom, ContactNameEmail = ContactForm_Object.ContactNameEmail, ContactText = ContactForm_Object.ContactText, ContactNamePhoneNumber = (null != ContactForm_Object.ContactNamePhoneNumber) ? ContactForm_Object.ContactNamePhoneNumber : Const.FindReturnString(Const.InformationNotProvided), ContactSubject = (null != ContactForm_Object.ContactSubject) ? ContactForm_Object.ContactSubject : Const.FindReturnString(Const.InformationNotProvided), ContactEmailRecipient = (null != ContactForm_Object.ContactEmailRecipient) ? ContactForm_Object.ContactEmailRecipient : Const.FindReturnString(Const.InformationNotProvided) }; jSon_Object = ListItem; } else { var ListItem = new { ErrorCode = Const.ObjectNotSavedByCurrentUserOriginally, ErrorText = Const.FindReturnString(Const.ObjectNotSavedByCurrentUserOriginally) }; jSon_Object = ListItem; } } else { var ListItem = new { ErrorCode = Const.ObjectNotFound, ErrorText = Const.FindReturnString(Const.ObjectNotFound) }; jSon_Object = ListItem; } } else { var ListItem = new { ErrorCode = Const.UserNotFound, ErrorText = Const.FindReturnString(Const.UserNotFound) }; jSon_Object = ListItem; } return(jSon_Object); }
/// <summary> /// Returnerer info om ét F*g/Kursus på ét specifikt Uddannelsesforløb udfra ID gemt af en bruger /// specificeret ved UserName og Password. /// </summary> /// <param name="id">Integer der specificerer id på Bruger-F*g/Kursus samling.</param> /// <param name="Password">Password for nuværende bruger.</param> /// <param name="UserName">Brugernavn for nuværende bruger.</param> /// <returns>Ét F*g/Kursus forløb. F*g/Kursus forløbet returneres som et jSon objekt, /// som indeholder felterne : User_Education_Character_Course_CollectionID, /// CourseID, CourseName, WhichCharacterScaleIDCourse, WhichCharacterScaleNameCourse, /// CharacterValueCourse, AbsencePercentageCourse, EducationLine, EducationName, /// EducationStartTime, EducationEndTime, CharacterValueEducation og /// AbsencePercentageForEducation. Flere af de nævnte felter "ID felter", kan have /// en værdi på -10 (InformationNotProvided), hvis disse felter ikke er udfyldt af /// brugeren. Er det et tekst felt, vil feltet have værdien : "Information er ikke gemt" /// Ved fejl vil der returneres et json Objekt med felterne ErrorNumber og ErrorText, /// hvor ErrorNumber har en værdi mindre end 0. Se en oversigt over return koder i ReturnCodesAndStrings /// eller klik her : <see cref="ReturnCodeAndReturnString"/> /// </returns> // GET api/<controller>/5 public object Get(int id, string UserName, string Password) { object jSon_Object = new object(); User_Education_Character_Course_Collection User_Education_Character_Course_Collection_Object = new User_Education_Character_Course_Collection(); int UserID = 0; UserID = UserInfo.FindUserInDatabase(UserName, Password); if (Const.UserNotFound < UserID) { User_Education_Character_Course_Collection_Object = db.User_Education_Character_Course_Collections.Find(id); if (null != User_Education_Character_Course_Collection_Object) { if (UserID == User_Education_Character_Course_Collection_Object.User_Education_Time_Collection.UserInfoID) { var ListItemCourseCharacter = new { User_Education_Character_Course_CollectionID = User_Education_Character_Course_Collection_Object.User_Education_Character_Course_CollectionID, CourseID = User_Education_Character_Course_Collection_Object.CourseID, CourseName = User_Education_Character_Course_Collection_Object.Course.CourseName, WhichCharacterScaleIDCourse = (null != User_Education_Character_Course_Collection_Object.WhichCharacterScaleID) ? User_Education_Character_Course_Collection_Object.WhichCharacterScaleID : Const.InformationNotProvided, WhichCharacterScaleNameCourse = (null != User_Education_Character_Course_Collection_Object.WhichCharacterScaleID) ? User_Education_Character_Course_Collection_Object.WhichCharacterScale.WhichCharacterScaleName : Const.FindReturnString(Const.InformationNotProvided), CharacterValueCourse = (null != User_Education_Character_Course_Collection_Object.CharacterValueCourse) ? User_Education_Character_Course_Collection_Object.CharacterValueCourse : Const.InformationNotProvided, AbsencePercentageCourse = (null != User_Education_Character_Course_Collection_Object.AbsencePercentageCourse) ? User_Education_Character_Course_Collection_Object.AbsencePercentageCourse : Const.InformationNotProvided, EducationLine = User_Education_Character_Course_Collection_Object.User_Education_Time_Collection.EducationLine.EducationLineName, EducationName = User_Education_Character_Course_Collection_Object.User_Education_Time_Collection.EducationLine.Education.EducationName, EducationStartTime = User_Education_Character_Course_Collection_Object.User_Education_Time_Collection.StartDate, EducationEndTime = User_Education_Character_Course_Collection_Object.User_Education_Time_Collection.EndDate, CharacterValueEducation = (null != User_Education_Character_Course_Collection_Object.User_Education_Time_Collection.CharacterValueEducation) ? User_Education_Character_Course_Collection_Object.User_Education_Time_Collection.CharacterValueEducation : Const.InformationNotProvided, AbsencePercentageForEducation = (null != User_Education_Character_Course_Collection_Object.User_Education_Time_Collection.AbsencePercentageEducation) ? User_Education_Character_Course_Collection_Object.User_Education_Time_Collection.AbsencePercentageEducation : Const.InformationNotProvided }; jSon_Object = ListItemCourseCharacter; } else { var ListItem = new { ErrorCode = Const.ObjectNotSavedByCurrentUserOriginally, ErrorText = Const.FindReturnString(Const.ObjectNotSavedByCurrentUserOriginally) }; jSon_Object = ListItem; } } else { var ListItem = new { ErrorCode = Const.ObjectNotFound, ErrorText = Const.FindReturnString(Const.ObjectNotFound) }; jSon_Object = ListItem; } } else { var ListItem = new { ErrorCode = Const.UserNotFound, ErrorText = Const.FindReturnString(Const.UserNotFound) }; jSon_Object = ListItem; } return(jSon_Object); }
/// <summary> /// Returnerer info om alle Uddannelsesforløb gemt af en bruger specificeret ved UserName /// og Password. /// </summary> /// <param name="Password">Password for nuværende bruger.</param> /// <param name="UserName">Brugernavn for nuværende bruger.</param> /// <returns> /// Liste af Uddannelsesforløb. Listen returneres som en liste af jSon objekter, /// hvor hver enkelt jSon element indeholder felterne : User_Education_Time_CollectionID, /// UserInfoID, UserName, EducationName, EducationLineName, /// CharacterValueCourse, AbsencePercentageCourse, EducationLine, EducationName, /// WhichCharacterScaleIDEducation, WhichCharacterScaleNameEducation, /// CharacterValueEducation, EducationStartTime, EducationEndTime, CharacterValueEducation, /// AbsencePercentageForEducation og CourseCharacterList. Feltet CourseCharacterList indeholder /// en liste af Liste af F*g/Kursus forløb knyttet til de enkelte uddannelsesforløb. For en /// beskrivelse af feltet CourseCharacterList henvises til UserEducationCourseCharacter eller klik /// her : <see cref="UserEducationCourseCharacterController"/>. /// Flere af de nævnte felter "ID felter", kan have en værdi på -10 (InformationNotProvided), /// hvis disse felter ikke er udfyldt af brugeren. Er det et tekst felt, vil feltet have værdien : /// "Information er ikke gemt". /// Ved fejl vil der returneres et json Objekt med felterne ErrorNumber og ErrorText, /// hvor ErrorNumber har en værdi mindre end 0. Se en oversigt over return koder i ReturnCodesAndStrings /// eller klik her : <see cref="ReturnCodeAndReturnString"/>. /// </returns> // GET api/<controller> public List <Object> Get(string UserName, string Password) { List <object> jSonList = new List <object>(); List <User_Education_Time_Collection> User_Education_Time_List = new List <User_Education_Time_Collection>(); int UserID = 0; UserID = UserInfo.FindUserInDatabase(UserName, Password); if (0 < UserID) { User_Education_Time_List = db.User_Education_Time_Collections.Where(u => u.UserInfoID == UserID).ToList(); foreach (User_Education_Time_Collection User_Education_Time_Object in User_Education_Time_List) { var ListItem = new { User_Education_Time_CollectionID = User_Education_Time_Object.User_Education_Time_CollectionID, UserInfoID = User_Education_Time_Object.UserInfoID, UserName = User_Education_Time_Object.UserInfo.UserName, EducationName = User_Education_Time_Object.EducationLine.Education.EducationName, EducationLineName = User_Education_Time_Object.EducationLine.EducationLineName, WhichCharacterScaleIDEducation = (null != User_Education_Time_Object.WhichCharacterScaleID) ? User_Education_Time_Object.WhichCharacterScaleID : Const.InformationNotProvided, WhichCharacterScaleNameEducation = (null != User_Education_Time_Object.WhichCharacterScaleID) ? User_Education_Time_Object.WhichCharacterScale.WhichCharacterScaleName : Const.FindReturnString(Const.InformationNotProvided), CharacterValueEducation = (null != User_Education_Time_Object.CharacterValueEducation) ? User_Education_Time_Object.CharacterValueEducation : Const.InformationNotProvided, EducationStartTime = User_Education_Time_Object.StartDate.ToShortDateString(), EducationStopTime = User_Education_Time_Object.EndDate.ToShortDateString(), AbsencePercentageForEducation = (null != User_Education_Time_Object.AbsencePercentageEducation) ? User_Education_Time_Object.AbsencePercentageEducation : Const.InformationNotProvided, CourseCharacterList = new List <VM_User_Education_Character_Course_Collection>() }; foreach (User_Education_Character_Course_Collection User_Education_Character_Course_Collection_Object in User_Education_Time_Object.User_Education_Character_Course_Collection) { VM_User_Education_Character_Course_Collection VM_User_Education_Character_Course_Collection_Object = new VM_User_Education_Character_Course_Collection(); VM_User_Education_Character_Course_Collection_Object.User_Education_Character_Course_Collection_Object = new User_Education_Character_Course_Collection(); VM_User_Education_Character_Course_Collection_Object.User_Education_Character_Course_Collection_Object.User_Education_Character_Course_CollectionID = User_Education_Character_Course_Collection_Object.User_Education_Character_Course_CollectionID; VM_User_Education_Character_Course_Collection_Object.User_Education_Character_Course_Collection_Object.User_Education_Time_CollectionID = User_Education_Character_Course_Collection_Object.User_Education_Time_CollectionID; VM_User_Education_Character_Course_Collection_Object.User_Education_Character_Course_Collection_Object.CourseID = User_Education_Character_Course_Collection_Object.CourseID; VM_User_Education_Character_Course_Collection_Object.CourseName = User_Education_Character_Course_Collection_Object.Course.CourseName; VM_User_Education_Character_Course_Collection_Object.User_Education_Character_Course_Collection_Object.WhichCharacterScaleID = (null != User_Education_Character_Course_Collection_Object.WhichCharacterScaleID) ? User_Education_Character_Course_Collection_Object.WhichCharacterScaleID : Const.InformationNotProvided; VM_User_Education_Character_Course_Collection_Object.WhichCharacterScaleName = (null != User_Education_Character_Course_Collection_Object.WhichCharacterScaleID) ? User_Education_Character_Course_Collection_Object.WhichCharacterScale.WhichCharacterScaleName : Const.FindReturnString(Const.InformationNotProvided); VM_User_Education_Character_Course_Collection_Object.User_Education_Character_Course_Collection_Object.CharacterValueCourse = (null != User_Education_Time_Object.CharacterValueEducation) ? User_Education_Time_Object.CharacterValueEducation : Const.InformationNotProvided; VM_User_Education_Character_Course_Collection_Object.User_Education_Character_Course_Collection_Object.AbsencePercentageCourse = (null != User_Education_Character_Course_Collection_Object.AbsencePercentageCourse) ? User_Education_Character_Course_Collection_Object.AbsencePercentageCourse : Const.InformationNotProvided; ListItem.CourseCharacterList.Add(VM_User_Education_Character_Course_Collection_Object); //ListItem.CourseCharacterList.Add(User_Education_Character_Course_Collection_Object); // Hvis man bruger linjen herover, som vil det være nemmeste, får man jSon self referencing fejl !!! } jSonList.Add(ListItem); } } else { var ListItem = new { ErrorCode = Const.UserNotFound, ErrorText = Const.FindReturnString(Const.UserNotFound) }; jSonList.Add(ListItem); } return(jSonList); }
/// <summary> /// Returnerer info om ét Uddannelsesforløb udfra id gemt af en bruger specificeret ved UserName /// og Password. /// </summary> /// <param name="id">Integer der specificerer id på Bruger-Uddannnelsesforløb samling.</param> /// <param name="Password">Password for nuværende bruger.</param> /// <param name="UserName">Brugernavn for nuværende bruger.</param> /// <returns>Ét Uddannelsesforløb.Uddannelsesforløbet returneres som et jSon objekt, /// som indeholder felterne : User_Education_Time_CollectionID, /// UserInfoID, UserName, EducationName, EducationLineName, /// CharacterValueCourse, AbsencePercentageCourse, EducationLine, EducationName, /// WhichCharacterScaleIDEducation, WhichCharacterScaleNameEducation, /// CharacterValueEducation, EducationStartTime, EducationEndTime, CharacterValueEducation, /// AbsencePercentageForEducation og CourseCharacterList. Feltet CourseCharacterList indeholder /// en liste af Liste af F*g/Kursus forløb knyttet til de enkelte uddannelsesforløb. For en /// beskrivelse af feltet CourseCharacterList henvises til UserEducationCourseCharacter eller klik /// her : <see cref="UserEducationCourseCharacterController"/>. /// Flere af de nævnte felter "ID felter", kan have en værdi på -10 (InformationNotProvided), /// hvis disse felter ikke er udfyldt af brugeren. Er det et tekst felt, vil feltet have værdien : /// "Information er ikke gemt". /// Ved fejl vil der returneres et json Objekt med felterne ErrorNumber og ErrorText, /// hvor ErrorNumber har en værdi mindre end 0. Se en oversigt over return koder i ReturnCodesAndStrings /// eller klik her : <see cref="ReturnCodeAndReturnString"/>. /// </returns> // GET api/<controller>/5 public object Get(int id, string UserName, string Password) { object jSon_Object = new object(); User_Education_Time_Collection User_Education_Time_Object = new User_Education_Time_Collection(); int UserID = 0; UserID = UserInfo.FindUserInDatabase(UserName, Password); if (0 < UserID) { if (null != db.User_Education_Time_Collections.FirstOrDefault(u => u.User_Education_Time_CollectionID == id)) { if (null != db.User_Education_Time_Collections.FirstOrDefault(u => u.UserInfoID == UserID && u.User_Education_Time_CollectionID == id)) { User_Education_Time_Object = db.User_Education_Time_Collections.First(u => u.UserInfoID == UserID && u.User_Education_Time_CollectionID == id); var ListItem = new { User_Education_Time_CollectionID = User_Education_Time_Object.User_Education_Time_CollectionID, UserInfoID = User_Education_Time_Object.UserInfoID, UserName = User_Education_Time_Object.UserInfo.UserName, EducationName = User_Education_Time_Object.EducationLine.Education.EducationName, EducationLine = User_Education_Time_Object.EducationLine.EducationLineName, WhichCharacterScaleIDEducation = (null != User_Education_Time_Object.WhichCharacterScaleID) ? User_Education_Time_Object.WhichCharacterScaleID : Const.InformationNotProvided, WhichCharacterScaleNameEducation = (null != User_Education_Time_Object.WhichCharacterScaleID) ? User_Education_Time_Object.WhichCharacterScale.WhichCharacterScaleName : Const.FindReturnString(Const.InformationNotProvided), CharacterValueEducation = (null != User_Education_Time_Object.CharacterValueEducation) ? User_Education_Time_Object.CharacterValueEducation : Const.InformationNotProvided, EducationStartTime = User_Education_Time_Object.StartDate.ToShortDateString(), EducationStopTime = User_Education_Time_Object.EndDate.ToShortDateString(), AbsencePercentageForEducation = (null != User_Education_Time_Object.AbsencePercentageEducation) ? User_Education_Time_Object.AbsencePercentageEducation : Const.InformationNotProvided, CourseCharacterList = new List <VM_User_Education_Character_Course_Collection>() }; foreach (User_Education_Character_Course_Collection User_Education_Character_Course_Collection_Object in User_Education_Time_Object.User_Education_Character_Course_Collection) { VM_User_Education_Character_Course_Collection VM_User_Education_Character_Course_Collection_Object = new VM_User_Education_Character_Course_Collection(); VM_User_Education_Character_Course_Collection_Object.User_Education_Character_Course_Collection_Object = new User_Education_Character_Course_Collection(); VM_User_Education_Character_Course_Collection_Object.User_Education_Character_Course_Collection_Object.User_Education_Character_Course_CollectionID = User_Education_Character_Course_Collection_Object.User_Education_Character_Course_CollectionID; VM_User_Education_Character_Course_Collection_Object.User_Education_Character_Course_Collection_Object.User_Education_Time_CollectionID = User_Education_Character_Course_Collection_Object.User_Education_Time_CollectionID; VM_User_Education_Character_Course_Collection_Object.User_Education_Character_Course_Collection_Object.CourseID = User_Education_Character_Course_Collection_Object.CourseID; VM_User_Education_Character_Course_Collection_Object.CourseName = User_Education_Character_Course_Collection_Object.Course.CourseName; VM_User_Education_Character_Course_Collection_Object.User_Education_Character_Course_Collection_Object.WhichCharacterScaleID = (null != User_Education_Character_Course_Collection_Object.WhichCharacterScaleID) ? User_Education_Character_Course_Collection_Object.WhichCharacterScaleID : Const.InformationNotProvided; VM_User_Education_Character_Course_Collection_Object.WhichCharacterScaleName = (null != User_Education_Character_Course_Collection_Object.WhichCharacterScaleID) ? User_Education_Character_Course_Collection_Object.WhichCharacterScale.WhichCharacterScaleName : "Ikke Oplyst !!!"; VM_User_Education_Character_Course_Collection_Object.User_Education_Character_Course_Collection_Object.CharacterValueCourse = (null != User_Education_Time_Object.CharacterValueEducation) ? User_Education_Time_Object.CharacterValueEducation : Const.InformationNotProvided; VM_User_Education_Character_Course_Collection_Object.User_Education_Character_Course_Collection_Object.AbsencePercentageCourse = (null != User_Education_Character_Course_Collection_Object.AbsencePercentageCourse) ? User_Education_Character_Course_Collection_Object.AbsencePercentageCourse : Const.InformationNotProvided; ListItem.CourseCharacterList.Add(VM_User_Education_Character_Course_Collection_Object); } jSon_Object = ListItem; } else { var ListItem = new { ErrorCode = Const.ObjectNotSavedByCurrentUserOriginally, ErrorText = Const.FindReturnString(Const.ObjectNotSavedByCurrentUserOriginally) }; jSon_Object = ListItem; } } else { var ListItem = new { ErrorCode = Const.ObjectNotFound, ErrorText = Const.FindReturnString(Const.ObjectNotFound) }; jSon_Object = ListItem; } } else { var ListItem = new { ErrorCode = Const.UserNotFound, ErrorText = Const.FindReturnString(Const.UserNotFound) }; jSon_Object = ListItem; } return(jSon_Object); }