/// <summary> /// Initialize object for each module. /// </summary> /// <param name="listUrl">The list url of module.</param> /// <returns></returns> private static IDelegationManager InitDALObject(string listUrl) { IDelegationManager moduleDAL = null; moduleDAL = InitDALObject(listUrl, SPContext.Current.Web); return(moduleDAL); }
/// <summary> /// InitDALObject /// </summary> /// <param name="listUrl"></param> /// <param name="currentWeb"></param> /// <returns></returns> private static IDelegationManager InitDALObject(string listUrl, SPWeb currentWeb) { IDelegationManager moduleDAL = null; if (string.Compare(listUrl, ShiftManagementList.ListUrl, true) == 0) { moduleDAL = new ShiftManagementDAL(currentWeb.Url); } else if (string.Compare(listUrl, ChangeShiftList.ListUrl, true) == 0) { moduleDAL = new ChangeShiftManagementDAL(currentWeb.Url); } else if (string.Compare(listUrl, OverTimeManagementList.ListUrl, true) == 0) { moduleDAL = new OverTimeManagementDAL(currentWeb.Url); } else if (string.Compare(listUrl, NotOvertimeList.ListUrl, true) == 0) { moduleDAL = new NotOvertimeManagementDAL(currentWeb.Url); } else if (string.Compare(listUrl, VehicleManagementList.ListUrl, true) == 0) { moduleDAL = new VehicleManagementDAL(currentWeb.Url); } else if (string.Compare(listUrl, LeaveManagementList.ListUrl, true) == 0) { moduleDAL = new LeaveManagementDAL(currentWeb.Url); } else if (string.Compare(listUrl, FreightManagementList.ListUrl, true) == 0) { moduleDAL = new FreightManagementDAL(currentWeb.Url); } else if (string.Compare(listUrl, BusinessTripManagementList.Url, true) == 0) { moduleDAL = new BusinessTripManagementDAL(currentWeb.Url); } else if (string.Compare(listUrl, RequestsList.Url, true) == 0) { moduleDAL = new RequestsDAL(currentWeb.Url); } else if (string.Compare(listUrl, EmployeeRequirementSheetsList.Url, true) == 0) { moduleDAL = new EmployeeRequirementSheetDAL(currentWeb.Url); } else if (string.Compare(listUrl, RequestForDiplomaSuppliesList.Url, true) == 0) { moduleDAL = new RequestForDiplomaSupplyDAL(currentWeb.Url); } else if (string.Compare(listUrl, RequisitionOfMeetingRoomList.Url, true) == 0) { moduleDAL = new RequisitionOfMeetingRoomDAL(currentWeb.Url); } return(moduleDAL); }
/// <summary> /// IsValidTask /// </summary> /// <param name="listUrl"></param> /// <param name="listItemID"></param> /// <param name="currentWeb"></param> /// <returns></returns> public static bool IsValidTask(string listUrl, int listItemID, SPWeb currentWeb) { var res = true; IDelegationManager moduleDAL = null; moduleDAL = InitDALObject(listUrl, currentWeb); if (moduleDAL != null) { res = moduleDAL.IsValidTask(listItemID); } return(res); }
public static LookupItem GetCurrentEmployeeProcessing(string listUrl, SPListItem listItem, SPWeb currentWeb) { LookupItem currentEmployeeProcessing = null; if (listItem == null) { throw new ArgumentNullException("listItem"); } IDelegationManager moduleDAL = InitDALObject(listUrl, currentWeb); if (moduleDAL != null) { currentEmployeeProcessing = moduleDAL.GetCurrentEmployeeProcessing(listItem); } return(currentEmployeeProcessing); }
/// <summary> /// GetDelegationListItem /// </summary> /// <param name="listUrl"></param> /// <param name="listItem"></param> /// <returns></returns> public static Delegation GetDelegationListItem(string listUrl, SPListItem listItem, SPWeb currentWeb) { Delegation delegationListItem = null; if (string.IsNullOrEmpty(listUrl)) { throw new System.ArgumentNullException("listUrl"); } if (listItem == null) { throw new ArgumentNullException("listItem"); } IDelegationManager moduleDAL = InitDALObject(listUrl, currentWeb); if (moduleDAL != null) { delegationListItem = moduleDAL.GetDelegationListItem(listItem, currentWeb); } return(delegationListItem); }
/// <summary> /// Get list of tasks from Employee and Module. /// </summary> /// <param name="fromEmployee">The employee who need to get tasks of them.</param> /// <param name="listUrl">The list of URL corresponding to module. If listUrl is empty, get all modules. Otherwise get for specific module.</param> /// <returns></returns> public static List <Delegation> GetListOfTasks(EmployeeInfo fromEmployee, string listUrl) { List <Delegation> listOfTasks = new List <Delegation>(); if (fromEmployee == null) { throw new System.ArgumentNullException("fromEmployee"); } if (string.IsNullOrEmpty(listUrl)) { throw new System.ArgumentNullException("listUrl"); } IDelegationManager moduleDAL = InitDALObject(listUrl); if (moduleDAL != null) { listOfTasks = moduleDAL.GetListOfTasks(fromEmployee); } return(listOfTasks); }