/// <summary> /// update existing Major /// </summary> /// <param name="s"></param> public static void UpdateMajor(PLMajor m) { SLMajor.Major updateMajor = DTO_to_SL(m); SLMajor.ISLMajor SLMajor = new SLMajor.SLMajorClient(); string[] errors = new string[0]; SLMajor.UpdateMajorRequest request = new SLMajor.UpdateMajorRequest(updateMajor, errors); SLMajor.UpdateMajor(request); }
/// <summary> /// this is data transfer object for Major. /// Converting from presentation layer Major object to business layer Major object /// </summary> /// <param name="s"></param> /// <returns>Major</returns> private static SLMajor.Major DTO_to_SL(PLMajor m) { SLMajor.Major SLMajor = new SLMajor.Major(); SLMajor.id = m.major_id; SLMajor.majorName = m.major_name; SLMajor.deptId = m.dept_id; return(SLMajor); }
/// <summary> /// Insert a new Major /// </summary> /// <param name="m"></param> public static void InsertMajor(PLMajor m) { SLMajor.Major newMajor = DTO_to_SL(m); SLMajor.ISLMajor SLMajor = new SLMajor.SLMajorClient(); string[] errors = new string[0]; SLMajor.InsertMajorRequest request = new SLMajor.InsertMajorRequest(newMajor, errors); SLMajor.InsertMajor(request); }
/// <summary> /// this is data transfer object for Major. /// Converting from presentation layer Major object to business layer Major object /// </summary> /// <param name="student"></param> /// <returns></returns> private static PLMajor DTO_to_PL(SLMajor.Major m) { PLMajor myMajor = new PLMajor(); myMajor.major_id = m.id; myMajor.major_name = m.majorName; myMajor.dept_id = m.deptId; return(myMajor); }
/// <summary> /// Get Major List /// </summary> /// <param name="deptName"></param> /// <returns>List</Scheduled></returns> public static List <PLMajor> GetMajorList() { List <PLMajor> majorList = new List <PLMajor>(); SLMajor.ISLMajor client = new SLMajor.SLMajorClient(); string[] errors = new string[0]; SLMajor.GetMajorListRequest request = new SLMajor.GetMajorListRequest(errors); SLMajor.GetMajorListResponse response = client.GetMajorList(request); SLMajor.Major[] majorsLoaded = response.GetMajorListResult; if (majorsLoaded != null) { foreach (SLMajor.Major s in majorsLoaded) { PLMajor major = DTO_to_PL(s); majorList.Add(major); } } return(majorList); }