private void GetRecruitmentTaskList(EmployeeRequirementSheetDAL recruitmentDAL)
        {
            // Ngay can nhan su <= NOW + 15 + 1
            List <int> delegatedItemIDs = this.DelegationList.Where(d => d.ListUrl == EmployeeRequirementSheetsList.Url).Select(d => d.ListItemID).ToList();
            var        delegationQuery  = _filterTaskManager.BuildApprovedByDelegationQuery(_currentUserInfoId, EmployeeRequirementSheetsList.Fields.PendingAtField, "Lookup", delegatedItemIDs);

            var query = $@"<Where>
                            <And>
                                <And>
                                    {delegationQuery}
                                    <Eq>
                                        <FieldRef Name='{ApprovalFields.WFStatus}' />
                                        <Value Type='Text'>{StringConstant.ApprovalStatus.InProgress}</Value>
                                    </Eq>
                                </And>
                                <Or>
                                    <Eq>
                                        <FieldRef Name='{CommonSPListField.CommonReqDueDateField}' />
                                        <Value IncludeTimeValue='FALSE' Type='DateTime'>{DateTime.Now.AddDays(16).ToString(StringConstant.DateFormatForCAML)}</Value>
                                    </Eq>
                                    <Or>
                                        <Eq>
                                            <FieldRef Name='{CommonSPListField.CommonReqDueDateField}' />
                                            <Value IncludeTimeValue='FALSE' Type='DateTime'>{DateTime.Now.AddDays(17).ToString(StringConstant.DateFormatForCAML)}</Value>
                                        </Eq>
                                        <And>
                                            <Geq>
                                                <FieldRef Name='{CommonSPListField.CommonReqDueDateField}' />
                                                <Value IncludeTimeValue='FALSE' Type='DateTime'>{DateTime.Now.ToString(StringConstant.DateFormatForCAML)}</Value>
                                            </Geq>
                                            <Lt>
                                                <FieldRef Name='{CommonSPListField.CommonReqDueDateField}' />
                                                <Value IncludeTimeValue='FALSE' Type='DateTime'>{DateTime.Now.AddDays(16).ToString(StringConstant.DateFormatForCAML)}</Value>
                                            </Lt>
                                        </And>
                                    </Or>
                                </Or>
                            </And>
                        </Where>";

            if (this.CountOnly)
            {
                TotalCount += recruitmentDAL.CountByQuery(query);
            }
            else
            {
                var recruitmentManagementList = recruitmentDAL.GetByQuery(query);
                if (recruitmentManagementList != null && recruitmentManagementList.Count > 0)
                {
                    foreach (var recruitmentManagement in recruitmentManagementList)
                    {
                        var filterTask = new FilterTask(recruitmentManagement);
                        filterTask.ApprovalStatusId = ApprovalStatusId;
                        FilterTaskList.Add(filterTask);
                    }
                }
            }
        }
Exemplo n.º 2
0
        /// <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);
        }
        protected override void OnInit(EventArgs e)
        {
            try
            {
                // Set current list url.
                this.listUrl = EmployeeRequirementSheetsList.Url;
                this.employeeRequirementSheetDAL = new EmployeeRequirementSheetDAL(SPContext.Current.Web.Url);
                this.recruitmentTeamDAL          = new RecruitmentTeamDAL(SPContext.Current.Web.Url);

                base.OnInit(e);
            }
            catch (Exception ex)
            {
                ULSLogging.LogError(ex);
                ULSLogging.LogMessageToFile($"-- Error occurs on RecruitmentListUserControl: {ex.Message}");
            }
        }
        /// <summary>
        /// LoadListOfTemplates
        /// </summary>
        private void LoadListOfTemplates()
        {
            try
            {
                string queryString = string.Format(@"<Where>
                                                        <And>
                                                            <Eq>
                                                                <FieldRef Name='{0}' LookupId='True' />
                                                                <Value Type='Lookup'>{1}</Value>
                                                            </Eq>
                                                            <Eq>
                                                                <FieldRef Name='{2}' />
                                                                <Value Type='Boolean'>{3}</Value>
                                                            </Eq>
                                                        </And>
                                                       </Where>
                                                        <OrderBy>
	                                                        <FieldRef Name='Title' Ascending='TRUE'/>
                                                        </OrderBy>",
                                                   EmployeeRequirementSheetsList.Fields.CommonDepartmentField, this.ApprovalBaseManagerObject.CurrentEmployee.Department.LookupId,
                                                   EmployeeRequirementSheetsList.Fields.IsTemplate, "1");
                EmployeeRequirementSheetDAL employeeRequirementSheetDAL = new EmployeeRequirementSheetDAL(this.SiteUrl);
                var templates = employeeRequirementSheetDAL.GetByQuery(queryString);
                this.ddlTemplate.DataSource = templates;
                this.ddlTemplate.DataBind();

                ListItem noneListItem = new ListItem();
                noneListItem.Value = NoneTemplateValue;
                if (this.IsVietnameseLanguage)
                {
                    noneListItem.Text = "(Không có)";
                }
                else
                {
                    noneListItem.Text = "(None)";
                }
                ddlTemplate.Items.Insert(0, noneListItem);
            }
            catch (Exception ex)
            {
                ULSLogging.LogError(ex);
                ULSLogging.LogMessageToFile($"-- Error occurs on RecruitmentFormUserControl: {ex.Message}");
            }
        }
Exemplo n.º 5
0
        private void GetRecruitmentTaskList(EmployeeRequirementSheetDAL recruitmentDAL)
        {
            var query = _filterTaskManager.BuildApprovalWorkflowHistoryQuery(EmployeeRequirementSheetsList.ListName, this.ApproverFullName, DateTime.Now);

            if (this.CountOnly)
            {
                TotalCount += recruitmentDAL.CountByQuery(query);
            }
            else
            {
                var recruitmentManagementList = recruitmentDAL.GetByQuery(query);
                if (recruitmentManagementList != null && recruitmentManagementList.Count > 0)
                {
                    foreach (var recruitmentManagement in recruitmentManagementList)
                    {
                        var filterTask = new FilterTask(recruitmentManagement);
                        filterTask.ApprovalStatusId = recruitmentManagement.WFStatus == Status.Approved ? ApprovedStatusId
                            : recruitmentManagement.WFStatus == ApprovalStatus.Rejected ? RejectedStatusId
                            : InProgressStatusId;
                        FilterTaskList.Add(filterTask);
                    }
                }
            }
        }
Exemplo n.º 6
0
 public void Visit(EmployeeRequirementSheetDAL recruitmentDAL)
 {
     GetRecruitmentTaskList(recruitmentDAL);
 }
        public override void Validate()
        {
            try
            {
                base.Validate();

                int departmentId = 0;
                int.TryParse(ddlDepartment.SelectedValue, out departmentId);
                if (departmentId < 1)
                {
                    IsValid = false;
                    hdErrorMessage.Value = ResourceHelper.GetLocalizedString("RecruitmentForm_ErrorMessage_UnSelectedDepartment", StringConstant.ResourcesFileWebPages, CultureInfo.CurrentUICulture.LCID);
                    return;
                }

                if (cbSavingTemplate.Checked)
                {
                    var selectedTemplateId = ddlTemplate.SelectedValue;
                    if (string.Compare(selectedTemplateId, NoneTemplateValue, true) == 0)
                    {
                        string templateName = txtTemplateName.Text;
                        if (string.IsNullOrEmpty(templateName) || string.IsNullOrWhiteSpace(templateName))
                        {
                            IsValid = false;
                            hdErrorMessage.Value = ResourceHelper.GetLocalizedString("RecruitmentForm_ErrorMessage_EmptyTemplateName", StringConstant.ResourcesFileWebPages, CultureInfo.CurrentUICulture.LCID);
                            return;
                        }
                        else
                        {
                            string queryString = string.Format(@"<Where>
                                                        <And>
                                                            <Eq>
                                                                <FieldRef Name='{0}' />
                                                                <Value Type='Text'>{1}</Value>
                                                            </Eq>
                                                            <Eq>
                                                                <FieldRef Name='{2}' />
                                                                <Value Type='Boolean'>{3}</Value>
                                                            </Eq>
                                                        </And>
                                                       </Where>",
                                                               EmployeeRequirementSheetsList.Fields.Title, templateName,
                                                               EmployeeRequirementSheetsList.Fields.IsTemplate, "1");
                            EmployeeRequirementSheetDAL employeeRequirementSheetDAL = new EmployeeRequirementSheetDAL(this.SiteUrl);
                            var templates = employeeRequirementSheetDAL.GetByQuery(queryString);
                            if (templates != null && templates.Count > 0)
                            {
                                IsValid = false;
                                hdErrorMessage.Value = ResourceHelper.GetLocalizedString("RecruitmentForm_ErrorMessage_ExistedTemplateName", StringConstant.ResourcesFileWebPages, CultureInfo.CurrentUICulture.LCID);
                                return;
                            }
                        }
                    }
                }

                string position = txtPosition.Text;
                if (string.IsNullOrEmpty(position) || string.IsNullOrWhiteSpace(position))
                {
                    IsValid = false;
                    hdErrorMessage.Value = ResourceHelper.GetLocalizedString("RecruitmentForm_ErrorMessage_EmptyPosition", StringConstant.ResourcesFileWebPages, CultureInfo.CurrentUICulture.LCID);
                    return;
                }

                string quantity = txtQuantity.Text;
                if (string.IsNullOrEmpty(quantity) || string.IsNullOrWhiteSpace(quantity))
                {
                    IsValid = false;
                    hdErrorMessage.Value = ResourceHelper.GetLocalizedString("RecruitmentForm_ErrorMessage_Quantity_Empty", StringConstant.ResourcesFileWebPages, CultureInfo.CurrentUICulture.LCID);
                    return;
                }

                int numQuantity = 0;
                int.TryParse(quantity, out numQuantity);
                if (numQuantity < 1)
                {
                    IsValid = false;
                    hdErrorMessage.Value = ResourceHelper.GetLocalizedString("RecruitmentForm_ErrorMessage_Quantity_InValid", StringConstant.ResourcesFileWebPages, CultureInfo.CurrentUICulture.LCID);
                    return;
                }

                string reasonForRecruitment = txtReasonForRecruitment.Text;
                if (string.IsNullOrEmpty(reasonForRecruitment) || string.IsNullOrWhiteSpace(reasonForRecruitment))
                {
                    IsValid = false;
                    hdErrorMessage.Value = ResourceHelper.GetLocalizedString("RecruitmentForm_ErrorMessage_EmptyReasonForRecruitment", StringConstant.ResourcesFileWebPages, CultureInfo.CurrentUICulture.LCID);
                    return;
                }

                string fromAge = txtFromAge.Text;
                if (string.IsNullOrEmpty(fromAge) || string.IsNullOrWhiteSpace(fromAge))
                {
                    IsValid = false;
                    hdErrorMessage.Value = ResourceHelper.GetLocalizedString("RecruitmentForm_ErrorMessage_FromAge_Empty", StringConstant.ResourcesFileWebPages, CultureInfo.CurrentUICulture.LCID);
                    return;
                }

                int numFromAge = 0;
                int.TryParse(fromAge, out numFromAge);
                if (numFromAge < 1 || numFromAge > 100)
                {
                    IsValid = false;
                    hdErrorMessage.Value = ResourceHelper.GetLocalizedString("RecruitmentForm_ErrorMessage_FromAge_InValid", StringConstant.ResourcesFileWebPages, CultureInfo.CurrentUICulture.LCID);
                    return;
                }

                string toAge = txtToAge.Text;
                if (string.IsNullOrEmpty(toAge) || string.IsNullOrWhiteSpace(toAge))
                {
                    IsValid = false;
                    hdErrorMessage.Value = ResourceHelper.GetLocalizedString("RecruitmentForm_ErrorMessage_ToAge_Empty", StringConstant.ResourcesFileWebPages, CultureInfo.CurrentUICulture.LCID);
                    return;
                }

                int numToAge = 0;
                int.TryParse(toAge, out numToAge);
                if (numToAge < 1 || numToAge > 100)
                {
                    IsValid = false;
                    hdErrorMessage.Value = ResourceHelper.GetLocalizedString("RecruitmentForm_ErrorMessage_ToAge_InValid", StringConstant.ResourcesFileWebPages, CultureInfo.CurrentUICulture.LCID);
                    return;
                }

                if ((numToAge != 0) && (numFromAge > numToAge))
                {
                    IsValid = false;
                    hdErrorMessage.Value = ResourceHelper.GetLocalizedString("RecruitmentForm_ErrorMessage_FromAge_LessThan_ToAge", StringConstant.ResourcesFileWebPages, CultureInfo.CurrentUICulture.LCID);
                    return;
                }

                if (dtAvailableTime.IsDateEmpty)
                {
                    IsValid = false;
                    hdErrorMessage.Value = ResourceHelper.GetLocalizedString("RecruitmentForm_ErrorMessage_AvailableTime_Empty", StringConstant.ResourcesFileWebPages, CultureInfo.CurrentUICulture.LCID);
                    return;
                }

                if (!dtAvailableTime.IsValid)
                {
                    IsValid = false;
                    hdErrorMessage.Value = ResourceHelper.GetLocalizedString("RecruitmentForm_ErrorMessage_AvailableTime_Invalid", StringConstant.ResourcesFileWebPages, CultureInfo.CurrentUICulture.LCID);
                    return;
                }

                IsValid = true;
            }
            catch (Exception ex)
            {
                ULSLogging.LogMessageToFile($"-- Error occurs on RecruitmentFormUserControl: {ex.Message}");
                ULSLogging.LogError(ex);
            }
        }
Exemplo n.º 8
0
 public void Visit(EmployeeRequirementSheetDAL recruitmentDAL)
 {
     // Do nothing
 }