public OvertimeService()
        {
            var webUrl = SPContext.Current.Web.Url;

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

            _employeeInfoDAL             = new EmployeeInfoDAL(url);
            _departmentDAL               = new DepartmentDAL(url);
            _overtimeManagementDAL       = new OverTimeManagementDAL(url);
            _overtimeManagementDetailDAL = new OverTimeManagementDetailDAL(url);
            _employeePositionDAL         = new EmployeePositionDAL(url);
        }
Exemplo n.º 3
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.º 4
0
 public OvertimeRepository(string siteURL)
 {
     _overtimeDAL       = new OverTimeManagementDAL(siteURL);
     _overtimeDetailDAL = new OverTimeManagementDetailDAL(siteURL);
 }