Exemplo n.º 1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                siteUrl = SPContext.Current.Site.Url;
                _notOvertimeManagementDAL = new NotOvertimeManagementDAL(siteUrl);

                int    currentUserId = SPContext.Current.Web.CurrentUser.ID;
                string itemIdParam   = this.Page.Request.Params.Get("itemId");

                XElement filterElement           = null;
                Biz.Models.Delegation delegation = null;

                if (!string.IsNullOrEmpty(itemIdParam))
                {
                    delegation = _notOvertimeManagementDAL.GetDelegatedTaskInfo(itemIdParam);
                }

                if (delegation != null)
                {
                    filterElement = BuildViewFilterStringForDelegation(delegation);
                }
                else
                {
                    filterElement = BuildViewFilterString(currentUserId);
                }

                InitialViewGUID(filterElement);
            }
            catch (Exception ex)
            {
                ULSLogging.Log(new SPDiagnosticsCategory("STADA - LeaveOfAbsenceApprovalControl - InitData", TraceSeverity.Unexpected, EventSeverity.Error), TraceSeverity.Unexpected, string.Format(CultureInfo.InvariantCulture, "{0}:{1}", ex.Message, ex.StackTrace));
            }
        }
Exemplo n.º 2
0
        private void InitialViewGUID()
        {
            var url = SPContext.Current.Web.Url;

            overTimeManagementDAL = new NotOvertimeManagementDAL(url);
            var guidViews = overTimeManagementDAL.GetViewGuildID().Where(x => x.BaseViewID == baseViewID).FirstOrDefault();

            NotOverTimeDepartmentControl.ViewGuid = NotOverTimeDepartmentControl.ViewGuid = guidViews == null ? "" : guidViews.ID.ToString();

            UserHelper   userHelper          = new UserHelper();
            EmployeeInfo currentEmployeeInfo = userHelper.GetCurrentLoginUser();

            CheckCurrentUser(url, currentEmployeeInfo.Department != null ? currentEmployeeInfo.Department.LookupId : 0);

            bool     isAdminDepartment = UserPermission.IsAdminDepartment;
            string   selectedDepId     = this.Page.Request.Params.Get("AdminDeptId");
            XElement filterElement     = BuildViewString(isAdminDepartment, selectedDepId, currentEmployeeInfo.FactoryLocation.LookupId);

            XElement xmlViewDef   = XElement.Parse(NotOverTimeDepartmentControl.XmlDefinition);
            XElement whereElement = xmlViewDef.Descendants("Where").FirstOrDefault();

            if (whereElement != null)
            {
                if (whereElement.HasElements)
                {
                    whereElement.RemoveNodes();
                }
                whereElement.Add(filterElement);
                NotOverTimeDepartmentControl.XmlDefinition = xmlViewDef.ToString();
            }
        }
        public OvertimeService()
        {
            var webUrl = SPContext.Current.Web.Url;

            _overTimeManagementDAL       = new OverTimeManagementDAL(webUrl);
            _overTimeManagementDetailDAL = new OverTimeManagementDetailDAL(webUrl);
            _notOvertimeManagementDal    = new NotOvertimeManagementDAL(webUrl);
            _employeeInfoDAL             = new EmployeeInfoDAL(webUrl);
        }
        private void initialViewGUID()
        {
            var url = SPContext.Current.Web.Url;

            overTimeManagementDAL = new NotOvertimeManagementDAL(url);
            var guidViews = overTimeManagementDAL.GetViewGuildID().Where(x => x.BaseViewID == baseViewID).FirstOrDefault();

            NotOverTimeRequestControl.ViewGuid = guidViews == null ? "" : guidViews.ID.ToString();
        }
Exemplo n.º 5
0
 public EmailService()
 {
     WebUrl                    = SPContext.Current.Web.Url;
     _emailTemplateDAL         = new EmailTemplateDAL(WebUrl);
     _employeeDAL              = new EmployeeInfoDAL(WebUrl);
     _changeShiftManagementDAL = new ChangeShiftManagementDAL(WebUrl);
     _notOvertimeMangementDAL  = new NotOvertimeManagementDAL(WebUrl);
     _shiftTimeDAL             = new ShiftTimeDAL(WebUrl);
     _sendMailActivity         = new SendEmailActivity();
 }
Exemplo n.º 6
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);
        }
Exemplo n.º 7
0
        private void GetNotOvertimeTaskList(NotOvertimeManagementDAL notOvertimeManagementDAL)
        {
            var dueDate = DateTime.Now.AddDays(1);

            var query = $@"<Where>
                                <And>
                                    <Or>
                                        <Eq>
                                            <FieldRef Name='{StringConstant.CommonSPListField.ApprovalStatusField}' />
                                            <Value Type='Text'>Approved</Value>
                                        </Eq>
                                        <Eq>
                                            <FieldRef Name='{StringConstant.CommonSPListField.ApprovalStatusField}' />
                                            <Value Type='Text'>Rejected</Value>
                                        </Eq>
                                    </Or>
                                    <And>
	                                    <Eq>
                                            <FieldRef Name='{StringConstant.NotOvertimeList.DHField}' LookupId='TRUE' />
                                            <Value Type='User'>{_currentUserADId}</Value>
                                        </Eq>
                                        <Eq>
                                            <FieldRef Name='{StringConstant.DefaultSPListField.ModifiedField}' />
                                            <Value IncludeTimeValue='FALSE' Type='DateTime'>{DateTime.Now.ToString(StringConstant.DateFormatForCAML)}</Value>
                                        </Eq>
                                    </And>
                                </And>
                            </Where>";

            if (this.CountOnly)
            {
                TotalCount += notOvertimeManagementDAL.CountByQuery(query);
            }
            else
            {
                var notOvertimeManagementList = notOvertimeManagementDAL.GetByQuery(query);

                if (notOvertimeManagementList != null)
                {
                    foreach (var notOvertimeManagement in notOvertimeManagementList)
                    {
                        var filterTask = new FilterTask(notOvertimeManagement);
                        filterTask.ApprovalStatusId = notOvertimeManagement.ApprovalStatus == "Approved" ? ApprovedStatusId : RejectedStatusId;
                        FilterTaskList.Add(filterTask);
                    }
                }
            }
        }
        private void GetNotOvertimeTaskList(NotOvertimeManagementDAL notOvertimeManagementDAL)
        {
            var dueDate = DateTime.Now.AddDays(1);

            List <int> delegatedItemIDs = this.DelegationList.Where(d => d.ListUrl == NotOvertimeList.ListUrl).Select(d => d.ListItemID).ToList();
            var        delegationQuery  = _filterTaskManager.BuildApprovedByDelegationQuery(_currentUserADId, NotOvertimeList.DHField, "User", delegatedItemIDs);

            var query = $@"<Where>
                                <And>
                                    <And>
	                                    {delegationQuery}
                                        <Or>
                                            <Eq>
                                               <FieldRef Name='{StringConstant.NotOvertimeList.DateField}' />
                                               <Value IncludeTimeValue='FALSE' Type='DateTime'>{DateTime.Now.ToString(StringConstant.DateFormatForCAML)}</Value>
                                            </Eq>
                                            <Eq>
                                               <FieldRef Name='{StringConstant.NotOvertimeList.DateField}' />
                                               <Value IncludeTimeValue='FALSE' Type='DateTime'>{DateTime.Now.AddDays(1).ToString(StringConstant.DateFormatForCAML)}</Value>
                                            </Eq>
                                        </Or>
                                    </And>
	                                <IsNull>
		                                <FieldRef Name='{StringConstant.NotOvertimeList.AprovalStatusField}' />
	                                </IsNull>
                                </And>
                            </Where>";

            if (this.CountOnly)
            {
                TotalCount += notOvertimeManagementDAL.CountByQuery(query);
            }
            else
            {
                var notOvertimeManagementList = notOvertimeManagementDAL.GetByQuery(query);

                if (notOvertimeManagementList != null)
                {
                    foreach (var notOvertimeManagement in notOvertimeManagementList)
                    {
                        var filterTask = new FilterTask(notOvertimeManagement);
                        filterTask.ApprovalStatusId = ApprovalStatusId;
                        FilterTaskList.Add(filterTask);
                    }
                }
            }
        }
Exemplo n.º 9
0
        public override void ItemUpdated(SPItemEventProperties properties)
        {
            base.ItemUpdated(properties);
            try
            {
                int itemID = Convert.ToInt32(properties.ListItemId);
                NotOvertimeManagementDAL    notovertimeDAL = new NotOvertimeManagementDAL(properties.WebUrl);
                OverTimeManagementDetailDAL overTimeManagementDetailDAL = new OverTimeManagementDetailDAL(properties.WebUrl);
                var item = notovertimeDAL.GetByID(itemID);

                string url = string.Empty;
                if (item != null)
                {
                    if (item.ApprovalStatus.Equals("1"))
                    {
                        var notOverTimeRequestEmail           = string.Format("{0}/_vti_bin/Services/Email/EmailService.svc/SendNotOverTimeRequestEmail/{1}/{2}", properties.WebUrl, itemID, "BOD");
                        var delegationNotOverTimeRequestEmail = string.Format("{0}/_vti_bin/Services/Email/EmailService.svc/SendDelegationNotOverTimeRequestEmail/{1}/{2}", properties.WebUrl, itemID, "BOD");
                        SendEmail(notOverTimeRequestEmail);
                        SendEmail(delegationNotOverTimeRequestEmail);
                    }
                    else if (item.ApprovalStatus.Equals("Approved"))
                    {
                        // udpate overtimeDetail
                        var overtimeDetail = overTimeManagementDetailDAL.GetOvertimeEmployeeByDate(item.Requester.LookupId, item.Date).Where(x => x.ApprovalStatus != null && x.ApprovalStatus.LookupValue == "true").SingleOrDefault();
                        if (overtimeDetail != null)
                        {
                            overtimeDetail.Task         = WORKCONTENT;
                            overtimeDetail.SummaryLinks = string.Format(URL, itemID);
                            overTimeManagementDetailDAL.BulkUpdate(new List <OverTimeManagementDetail>()
                            {
                                overtimeDetail
                            });
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                ULSLogging.Log(new SPDiagnosticsCategory("STADA - NotOvertime Event Receiver - ItemUpdated fn",
                                                         TraceSeverity.Unexpected, EventSeverity.Error), TraceSeverity.Unexpected,
                               string.Format(CultureInfo.InvariantCulture, "{0}:{1}", ex.Message, ex.StackTrace));
            }
        }
Exemplo n.º 10
0
 public void Visit(NotOvertimeManagementDAL notOvertimeManagementDAL)
 {
     GetNotOvertimeTaskList(notOvertimeManagementDAL);
 }
 public NotOverTimeManagementService()
 {
     var webUrl = SPContext.Current.Web.Url;
     _notOvertimeManagementDAL = new NotOvertimeManagementDAL(webUrl);
 }
Exemplo n.º 12
0
 public void Visit(NotOvertimeManagementDAL notOvertimeManagementDAL)
 {
     // Do nothing
 }