/// <summary> /// this is data transfer object for department. /// Converting from presentation layer department object to business layer department object /// </summary> /// <param name="department"></param> /// <returns></returns> private static SLDepartment.Department DTO_to_SL(PLDepartment department) { SLDepartment.Department SLDepartment = new SLDepartment.Department(); SLDepartment.id = department.ID; SLDepartment.deptName = department.deptName; SLDepartment.chairID = department.chair_id; return(SLDepartment); }
/// <summary> /// update existing department info /// </summary> /// <param name="s"></param> public static void UpdateDepartment(PLDepartment s) { SLDepartment.Department newDepartment = DTO_to_SL(s); SLDepartment.ISLDepartment SLDepartment = new SLDepartment.SLDepartmentClient(); string[] errors = new string[0]; SLDepartment.UpdateDepartmentRequest request = new SLDepartment.UpdateDepartmentRequest(newDepartment, errors); SLDepartment.UpdateDepartment(request); }
/// <summary> /// This is the data transfer object for department. /// Converting business layer department object to presentation layer department object /// </summary> /// <param name="department"></param> /// <returns></returns> private static PLDepartment DTO_to_PL(SLDepartment.Department department) { PLDepartment PLDepartment = new PLDepartment(); PLDepartment.ID = department.id; PLDepartment.deptName = department.deptName; PLDepartment.chair_id = department.chairID; return(PLDepartment); }
/// <summary> /// Get department detail /// </summary> /// <param name="id"></param> /// <returns></returns> public static PLDepartment GetDepartmentDetail(string deptName) { SLDepartment.ISLDepartment SLDepartment = new SLDepartment.SLDepartmentClient(); string[] errors = new string[0]; SLDepartment.GetDepartmentDetailRequest request = new SLDepartment.GetDepartmentDetailRequest(deptName, errors); SLDepartment.GetDepartmentDetailResponse response = SLDepartment.GetDepartmentDetail(request); SLDepartment.Department newDepartment = response.GetDepartmentDetailResult; //System.Diagnostics.Debug.WriteLine("newDepartment value: " + newDepartment.ToString()); System.Diagnostics.Debug.WriteLine("response: " + response.GetDepartmentDetailResult); // this is the data transfer object code... return(DTO_to_PL(newDepartment)); }