private void InitObjects()
 {
     this.employeeInfoDAL = new EmployeeInfoDAL(this.SiteUrl);
     this.InitCurrentEmployeeInfoObject();
     this.employeePositionDAL            = new EmployeePositionDAL(this.SiteUrl);
     this.delegationModulesDAL           = new DelegationModulesDAL(this.SiteUrl);
     this.delegationEmployeePositionsDAL = new DelegationEmployeePositionsDAL(this.SiteUrl);
     this.delegationsOfNewTaskDAL        = new DelegationsOfNewTaskDAL(this.SiteUrl);
     this.delegationsDAL = new DelegationsDAL(this.SiteUrl);
     this.departmentDAL  = new DepartmentDAL(this.SiteUrl);
 }
Example #2
0
        private void InitModule(string listUrl)
        {
            DelegationModulesDAL delegationModulesDAL = new DelegationModulesDAL(SPContext.Current.Web.Url);

            var delegationModule = delegationModulesDAL.GetByListUrl(listUrl);

            if (delegationModule != null)
            {
                this.ModuleId = delegationModule.ID;
            }
        }
Example #3
0
        private void InitModuleName(string listUrl)
        {
            DelegationModulesDAL delegationModulesDAL = new DelegationModulesDAL(this.CurrentWeb.Url);

            var delegationModule = delegationModulesDAL.GetByListUrl(listUrl);

            if (delegationModule != null)
            {
                this.ModuleName           = delegationModule.ModuleName;
                this.VietnameseModuleName = delegationModule.VietnameseModuleName;
            }
        }
Example #4
0
 public CommonService()
 {
     _webUrl = SPContext.Current.Web.Url;
     _delegationModulesDAL = new DelegationModulesDAL(_webUrl);
     _delegationDAL        = new DelegationsDAL(_webUrl);
     _employeeInfoDAL      = new EmployeeInfoDAL(_webUrl);
     _listDAL = new List <IFilterTaskManager>();
     // Init DAL for Visitor
     _listDAL.Add(new ShiftManagementDAL(_webUrl));
     _listDAL.Add(new ChangeShiftManagementDAL(_webUrl));
     _listDAL.Add(new OverTimeManagementDAL(_webUrl));
     _listDAL.Add(new NotOvertimeManagementDAL(_webUrl));
     _listDAL.Add(new LeaveManagementDAL(_webUrl));
     _listDAL.Add(new VehicleManagementDAL(_webUrl));
     _listDAL.Add(new FreightManagementDAL(_webUrl));
     _listDAL.Add(new BusinessTripManagementDAL(_webUrl));
     _listDAL.Add(new RequestsDAL(_webUrl));
     _listDAL.Add(new EmployeeRequirementSheetDAL(_webUrl));
     _listDAL.Add(new RequestForDiplomaSupplyDAL(_webUrl));
 }
Example #5
0
        private void MigrateDelegation(bool isOverride, List <string> moduleNames, int departmentId)
        {
            DelegationModulesDAL delegationModulesDAL = new DelegationModulesDAL(SPContext.Current.Web.Url);

            var employeeDelegationList = new List <Delegation>();

            StringBuilder sbItem = new StringBuilder();

            foreach (var moduleName in moduleNames)
            {
                sbItem.Append($@"<Value Type='Text'>{moduleName}</Value>");
            }
            var delegationQuery = $@"
                                    <Where>
                                        <And>
                                            <Eq>
                                                <FieldRef Name='Department' LookupId='TRUE'/>
                                                <Value Type='Lookup'>{departmentId}</Value>
                                            </Eq>
                                            <In>
                                                <FieldRef Name='ModuleName' />
                                                <Values>
                                                    {sbItem.ToString()}
                                                </Values>                        
                                            </In>
                                        </And>
                                    </Where>";

            List <Delegation> delegationList = _delegationDAL.GetByQuery(delegationQuery);

            var toEmployeeList = delegationList.SelectMany(d => d.ToEmployee);
            var toEmployeeIds  = toEmployeeList.Select(e => e.LookupId).Distinct().ToList();

            foreach (var employeeId in toEmployeeIds)
            {
                employeeDelegationList.AddRange(_delegationDAL.GetDelegationApprovalListByModule(SPContext.Current.Web, employeeId, sbItem.ToString()));
            }

            foreach (var delegation in employeeDelegationList)
            {
                foreach (var assignedTo in delegation.ToEmployee)
                {
                    var taskListModel = new FilterTaskModel();
                    taskListModel.ItemId          = delegation.ListItemID;
                    taskListModel.ItemApprovalUrl = delegation.ListItemApprovalUrl;
                    taskListModel.Description     = delegation.ListItemDescription;
                    taskListModel.CreatedDateTime = delegation.Created;
                    taskListModel.DueDateTime     = RetrieveRequestDueDate(delegation.ListUrl, delegation.ListItemID); // Get DueDate
                    taskListModel.AssignedToId    = assignedTo.LookupId;
                    taskListModel.RequesterId     = delegation.Requester.LookupId;
                    taskListModel.DepartmentId    = delegation.Department.LookupId;
                    var delegationModule = delegationModulesDAL.GetByListUrl(delegation.ListUrl);
                    if (delegationModule != null)
                    {
                        taskListModel.ModuleId = delegationModule.ID;
                    }
                    taskListModel.ApprovalStatusId = 1; // In - Progress

                    CreateListItem(taskListModel, TO_DO_LIST_NAME, isOverride);
                }
            }
        }