Example #1
0
        private void HandleNotification(string method, JToken parameters)
        {
            NotificationMethod notificationMethod = null;

            notificationMethods.TryGetValue(method, out notificationMethod);
            if (notificationMethod == null)
            {
                WriteServerLog(String.Format("No notification handler was registered for method \"{0}\"", method));
            }
            else
            {
                NotificationType notificationType = notificationMethod.Type;
                object           objParams        = null;
                if (parameters != null)
                {
                    objParams = parameters.ToObject(notificationType.ParamsType);
                }
                try
                {
                    notificationMethod.HandleNotification(notificationType, objParams);
                }
                catch (Exception e)
                {
                    WriteServerLog(String.Format("Notification handler for {0} failed : {1}", notificationType.GetType().Name, e.Message));
                    ResponseResultOrError error = new ResponseResultOrError()
                    {
                        code = ErrorCodes.InternalError, message = e.Message, data = parameters?.ToString()
                    };
                    Reply(method, error);
                }
            }
        }
Example #2
0
        private void HandleNotification(string method, JToken parameters)
        {
            NotificationMethod notificationMethod = null;

            notificationMethods.TryGetValue(method, out notificationMethod);
            if (notificationMethod == null)
            {
                WriteServerLog(String.Format("No notification handler was registered for method \"{0}\"", method));
            }
            else
            {
                NotificationType notificationType = notificationMethod.Type;
                object           objParams        = null;
                if (parameters != null)
                {
                    objParams = parameters.ToObject(notificationType.ParamsType);
                }
                try
                {
                    notificationMethod.HandleNotification(notificationType, objParams);
                }
                catch (Exception e)
                {
                    WriteServerLog(String.Format("Notification handler for {0} failed : {1}", notificationType.GetType().Name, e.Message));
                }
            }
        }
Example #3
0
        public static void ShowError(NotificationMethod notificationMethod, string p1, string p2, Action onTap = null)
        {
            string caption = p2 == null ? string.Empty : p2;
            string message = p1 == null ? string.Empty : p1;

            Instance.ShowErrorMessage(notificationMethod, message, caption, onTap);
        }
Example #4
0
        public void ChangeNotificationMethod(string username, NotificationMethod method)
        {
            var user           = GetUserEntityByName(username);
            var managerProfile = _unitOfWorks.Repository <ManagerProfile>().GetSingle(user.Id.ToString());

            managerProfile.Method = method;
            _unitOfWorks.Repository <ManagerProfile>().Edit(managerProfile);
        }
Example #5
0
        private async Task PublishViaMethod(Notification notification, NotificationMethod method, int userId)
        {
            NotificationRecipient model = null;

            switch (method)
            {
            case NotificationMethod.Default:
            {
                model = new NotificationRecipient()
                {
                    Method         = method,
                    NotificationId = notification.Id,
                    ToUserId       = userId,
                };
            }
            break;

            case NotificationMethod.Email:
            {
                model = new NotificationRecipient()
                {
                    Method         = method,
                    NotificationId = notification.Id,
                    ToUserId       = userId,
                    WhenDelivered  = DateTime.UtcNow,
                };

                // send email;
                // notification.DeliveryCount++; // delivery successful
            }
            break;

            case NotificationMethod.SMS:
            {
                model = new NotificationRecipient()
                {
                    Method         = method,
                    NotificationId = notification.Id,
                    ToUserId       = userId,
                    WhenDelivered  = DateTime.UtcNow,
                    WhenViewed     = DateTime.UtcNow,
                    WhenDismissed  = DateTime.UtcNow,
                };

                // send text;
                //notification.DeliveryCount++; // delivery successful
            }
            break;
            }

            if (model != null)
            {
                await _db.Recipients.AddAsync(model);

                await _db.SaveChangesAsync();
            }
        }
Example #6
0
        public async Task UpdateMethodSettingsSetAll(int userId, NotificationMethod method)
        {
            var existing = await _db.MethodSettings.Where(s => s.UserId == userId).ToListAsync();

            foreach (var s in existing)
            {
                s.Enabled = s.Method == method;
            }
            await _db.SaveChangesAsync();
        }
        public void Update()
        {
            object value;

            _temperaturelertlevel = (value = _settings.Get(_TEMPERATURE_ALERT_LEVEL_KEY)) != null ? (int)value : _DEFAULT_TEMPERATURE_ALERT_LEVEL;
            _updatetime           = (value = _settings.Get(_UPDATE_TIME_KEY)) != null ? (int)value : _DEFAULT_UPDATE_TIME;
            _notification         = (value = _settings.Get(_NOTIFICATION_KEY)) != null ? (NotificationMethod)value : _DEFAULT_NOTIFICATION;
            _theme             = (value = _settings.Get(_THEME_KEY)) != null ? (Theme)value : _DEFAULT_THEME;
            _soundResourceName = (value = _settings.Get(_SOUND_RESOURCE_NAME_KEY)) as string;
        }
Example #8
0
        private void SetNotificationMethod(NotificationMethod notification)
        {
            switch (notification)
            {
            case NotificationMethod.SoundAndMessage: rbMessageAndSoundNotif.Checked = true; break;

            case NotificationMethod.Message: rbMessageNotif.Checked = true; break;

            case NotificationMethod.None: rbNoNotif.Checked = true; break;
            }
        }
Example #9
0
 public DebtorNominatedContactViewModel ToNominatedContactViewModel()
 {
     return(new DebtorNominatedContactViewModel
     {
         ContactId = ContactId,
         RoleId = RoleId,
         PointContactRole = PointContactRole.ToString(),
         FullName = FullName,
         TelephoneNumber = TelephoneNumber,
         EmailAddress = EmailAddress,
         ConfirmEmailAddress = EmailAddress,
         ContactConfirmationMethod = NotificationMethod.ToString(),
         CommunicationAddress = CommunicationAddress
     });
 }
Example #10
0
        public void TryToSubmit(string amount, NotificationMethod notificationMethod)
        {
            var wait          = new WebDriverWait(_driver, TimeSpan.FromSeconds(45));
            var provinceField = _driver.FindElementWait(By.XPath("//input[contains(@id, 'withdraw-request-amount')]"));

            wait.Until(d => provinceField.Displayed && provinceField.Enabled);

            _amount.SendKeys(amount);
            _remarks.SendKeys(TestDataGenerator.GetRandomString(5));

            var saveButton = _driver.FindElementWait(By.XPath("//button[text()='Save']"));

            _driver.FindElementScroll(By.XPath("//button[text()='Save']"));
            saveButton.Click();
        }
Example #11
0
        private void ShowErrorMessage(NotificationMethod method, string message, string caption, Action notificationTapped)
        {
            switch (method)
            {
            // send toast, or message box if failure
            case NotificationMethod.Toast:
                try { ShowToastError(message, caption, notificationTapped); }
                catch (Exception) { ShowMessageBoxError(message, caption, notificationTapped); }
                break;

            // send message box
            case NotificationMethod.MessageBox:
                ShowMessageBoxError(message, caption, notificationTapped);
                break;
            }
        }
        public INotificationMethod BuildEntity(NotificationMethodDto dto)
        {
            var method = new NotificationMethod(dto.ProviderKey)
            {
                Key         = dto.Key,
                Name        = dto.Name,
                Description = dto.Description,
                ServiceCode = dto.ServiceCode,
                UpdateDate  = dto.UpdateDate,
                CreateDate  = dto.CreateDate
            };

            method.ResetDirtyProperties();

            return(method);
        }
        /// <summary>
        /// Registers a specific Method to a given Notification.
        /// </summary>
        /// <param name="notification">The Notification to be broadcast.</param>
        /// <param name="observer">The observer to be removed.</param>
        public static void DeregisterObserver(Notification notification, Object observer)
        {
            if (dictionary.ContainsKey(notification))
            {
                NotificationMethod removedNotification = null;
                foreach (NotificationMethod nm in dictionary[notification])
                {
                    if (nm.Target == observer)
                    {
                        removedNotification = nm;
                    }
                }

                if (removedNotification != null)
                {
                    dictionary[notification].Remove(removedNotification);
                }
            }
        }
Example #14
0
        /// <summary>
        /// Creates a <see cref="INotificationMethod"/> and saves it to the database
        /// </summary>
        /// <param name="providerKey">The <see cref="IGatewayProviderSettings"/> key</param>
        /// <param name="name">The name of the notification (used in back office)</param>
        /// <param name="serviceCode">The notification service code</param>
        /// <param name="raiseEvents">Optional boolean indicating whether or not to raise events</param>
        /// <returns>An Attempt{<see cref="INotificationMethod"/>}</returns>
        public Attempt <INotificationMethod> CreateNotificationMethodWithKey(Guid providerKey, string name, string serviceCode, bool raiseEvents = true)
        {
            Mandate.ParameterNotNullOrEmpty(name, "name");
            Mandate.ParameterNotNullOrEmpty(serviceCode, "serviceCode");

            var notificationMethod = new NotificationMethod(providerKey)
            {
                Name        = name,
                ServiceCode = serviceCode
            };

            if (raiseEvents)
            {
                if (Creating.IsRaisedEventCancelled(new Events.NewEventArgs <INotificationMethod>(notificationMethod), this))
                {
                    notificationMethod.WasCancelled = true;
                    return(Attempt <INotificationMethod> .Fail(notificationMethod));
                }
            }

            using (new WriteLock(Locker))
            {
                var uow = _uowProvider.GetUnitOfWork();
                using (var repository = _repositoryFactory.CreateNotificationMethodRepository(uow))
                {
                    repository.AddOrUpdate(notificationMethod);
                    uow.Commit();
                }
            }

            if (raiseEvents)
            {
                Created.RaiseEvent(new Events.NewEventArgs <INotificationMethod>(notificationMethod), this);
            }

            return(Attempt <INotificationMethod> .Succeed(notificationMethod));
        }
        /// <summary>
        /// Registers a specific Method to a given Notification.
        /// </summary>
        /// <param name="notification">The Notification to be broadcast.</param>
        /// <param name="method">The method for the notification to call.</param>
        public static void RegisterObserver(Notification notification, NotificationMethod method)
        {
            if (dictionary.ContainsKey(notification))
            {
                #if GAME_DEBUG
                Debug.Log("Adding observing method (" + method + ") to Notification: " + notification);
                #endif

                if (!dictionary[notification].Contains(method))
                {
                    dictionary[notification].Add(method);
                }
            }
            else
            {
                #if GAME_DEBUG
                Debug.Log("Adding Notification (" + notification + ") as new key with for object: " + method.Target);
                #endif

                List <NotificationMethod> list = new List <NotificationMethod>();
                list.Add(method);
                dictionary.Add(notification, list);
            }
        }
Example #16
0
        public PartialViewResult GetNotificationDetailsByKey(int EmployeeID, string Header, int?DetailsId)
        {
            NotificationMethod _NotificationMethod = new NotificationMethod();

            NotificationDetail _NotificationDetail = new NotificationDetail();

            if (Header == "TimeSheet Request")
            {
                var data = _NotificationMethod.GetTimeSheetNotificationByKey(EmployeeID, DetailsId).FirstOrDefault();
                if (data != null)
                {
                    _NotificationDetail.EmployeeId   = data.EmployeeId;
                    _NotificationDetail.HeaderType   = data.HeaderType;
                    _NotificationDetail.Hours        = data.Hours;
                    _NotificationDetail.ProjectName  = data.ProjectName;
                    _NotificationDetail.Day          = data.Day;
                    _NotificationDetail.Date         = data.Date;
                    _NotificationDetail.CustomerName = data.CustomerName;
                    _NotificationDetail.CostCode     = data.CostCode;
                    _NotificationDetail.AssetName    = data.AssetName;
                    var reportTodata      = _db.EmployeeRelations.Where(x => x.IsActive == true && x.UserID == EmployeeID).FirstOrDefault();
                    var aspnetUserDetails = _db.AspNetUsers.Where(x => x.Archived == false && x.Id == EmployeeID).FirstOrDefault();
                    Employee_TimeSheet_Detail TimeSheetDetails = new Employee_TimeSheet_Detail();
                    TimeSheetDetails = _db.Employee_TimeSheet_Detail.Find(DetailsId);
                    if (TimeSheetDetails != null && TimeSheetDetails.ApprovalStatus == "Pending")
                    {
                        _NotificationDetail.AppStatus = TimeSheetDetails.ApprovalStatus;
                    }
                    if (aspnetUserDetails != null && TimeSheetDetails != null)
                    {
                        if (aspnetUserDetails.HRResponsible == SessionProxy.UserId && aspnetUserDetails.HRResponsible != null)
                        {
                            TimeSheetDetails.IsReadHR = true;
                        }
                        if (aspnetUserDetails.AdditionalReportsto == SessionProxy.UserId)
                        {
                            TimeSheetDetails.IsReadAddRep = true;
                        }
                        if (TimeSheetDetails != null && reportTodata.Reportsto == SessionProxy.UserId)
                        {
                            TimeSheetDetails.IsRead = true;
                        }
                        _db.Entry(TimeSheetDetails).State = System.Data.Entity.EntityState.Modified;
                        _db.SaveChanges();
                    }
                }
            }
            if (Header == "Training Request Worker")
            {
                var data = _NotificationMethod.getEmployeeTrainingById(Convert.ToInt32(DetailsId)).FirstOrDefault();
                if (data != null)
                {
                    _NotificationDetail.EmployeeId          = data.EmployeeId;
                    _NotificationDetail.HeaderType          = "Training Request Worker";
                    _NotificationDetail.StartDate           = Convert.ToString(data.StartDate);
                    _NotificationDetail.EndDate             = Convert.ToString(data.EndDate);
                    _NotificationDetail.TrainingDescription = data.Description;

                    EmployeeTraining trainingDetails = new EmployeeTraining();
                    trainingDetails = _db.EmployeeTrainings.Find(DetailsId);
                    trainingDetails.IsReadWorker     = true;
                    _db.Entry(trainingDetails).State = System.Data.Entity.EntityState.Modified;
                    _db.SaveChanges();
                }
            }
            else if (Header == "Skill Added")
            {
                var data = _NotificationMethod.getEmployeeSkillById(Convert.ToInt32(DetailsId)).FirstOrDefault();
                if (data != null)
                {
                    _NotificationDetail.EmployeeId = data.EmployeeId;
                    _NotificationDetail.HeaderType = "Skill Added";
                    if (data.GeneralSkillsName != "" && data.GeneralSkillsName != null)
                    {
                        int GenralSkillName = Convert.ToInt32(data.GeneralSkillsName);
                        _NotificationDetail.generalSkill = _db.SkillSets.Where(x => x.Id == GenralSkillName).FirstOrDefault().Name;
                    }
                    else
                    {
                        _NotificationDetail.generalSkill = null;
                    }
                    if (data.TechnicalSkillsName != "" && data.TechnicalSkillsName != null)
                    {
                        int TechnSkillName = Convert.ToInt32(data.TechnicalSkillsName);
                        _NotificationDetail.technicalskill = _db.SkillSets.Where(x => x.Id == TechnSkillName).FirstOrDefault().Name;
                    }
                    else
                    {
                        _NotificationDetail.technicalskill = null;
                    }
                    _NotificationDetail.StartDate = Convert.ToString(data.CreatedDate);

                    Employee_Skills EmpSkillDetails = new Employee_Skills();
                    EmpSkillDetails                  = _db.Employee_Skills.Find(DetailsId);
                    EmpSkillDetails.IsRead           = true;
                    _db.Entry(EmpSkillDetails).State = System.Data.Entity.EntityState.Modified;
                    _db.SaveChanges();
                }
            }
            else if (Header == "Scheduling Request")
            {
                var data = _NotificationMethod.GetScheduleNotificationByKey(EmployeeID, DetailsId).FirstOrDefault();
                if (data != null)
                {
                    _NotificationDetail.EmployeeId   = data.EmployeeId;
                    _NotificationDetail.HeaderType   = data.HeaderType;
                    _NotificationDetail.Hours        = data.Hours;
                    _NotificationDetail.ProjectName  = data.Project;
                    _NotificationDetail.CustomerName = data.Customer;
                    _NotificationDetail.CostCode     = data.AssetName;
                    _NotificationDetail.StartDate    = data.StartDate;
                    _NotificationDetail.EndDate      = data.EndDate;
                    _NotificationDetail.Duration     = data.duration;
                    _NotificationDetail.AssetName    = data.AssetName;
                    var reportTodata      = _db.EmployeeRelations.Where(x => x.IsActive == true && x.UserID == EmployeeID).FirstOrDefault();
                    var aspnetUserDetails = _db.AspNetUsers.Where(x => x.Archived == false && x.Id == EmployeeID).FirstOrDefault();
                    Employee_ProjectPlanner_Scheduling SchedulingDetails = new Employee_ProjectPlanner_Scheduling();
                    SchedulingDetails = _db.Employee_ProjectPlanner_Scheduling.Find(DetailsId);
                    if (SchedulingDetails != null && SchedulingDetails.ApprovalStatus == "Pending")
                    {
                        _NotificationDetail.AppStatus = SchedulingDetails.ApprovalStatus;
                    }
                    if (aspnetUserDetails != null && SchedulingDetails != null)
                    {
                        if (aspnetUserDetails.HRResponsible == SessionProxy.UserId && aspnetUserDetails.HRResponsible != null)
                        {
                            SchedulingDetails.IsReadHR = true;
                        }
                        if (aspnetUserDetails.AdditionalReportsto == SessionProxy.UserId)
                        {
                            SchedulingDetails.IsReadAddRes = true;
                        }
                        if (SchedulingDetails != null && reportTodata.Reportsto == SessionProxy.UserId)
                        {
                            SchedulingDetails.IsRead = true;
                        }
                        _db.Entry(SchedulingDetails).State = System.Data.Entity.EntityState.Modified;
                        _db.SaveChanges();
                    }
                }
            }
            else if (Header == "Travel Request")
            {
                var data = _NotificationMethod.GetTravelNotificationByKey(EmployeeID, DetailsId).FirstOrDefault();
                if (data != null)
                {
                    _NotificationDetail.EmployeeId   = data.EmployeeId;
                    _NotificationDetail.HeaderType   = data.HeaderType;
                    _NotificationDetail.TravelType   = data.Type;
                    _NotificationDetail.FromCountry  = data.FromCountry;
                    _NotificationDetail.FromTown     = data.FromCity;
                    _NotificationDetail.FromPlace    = data.FromPlace;
                    _NotificationDetail.ToCountry    = data.ToCountry;
                    _NotificationDetail.ToTown       = data.ToCity;
                    _NotificationDetail.Toplace      = data.ToPlace;
                    _NotificationDetail.StartDate    = data.StartDate;
                    _NotificationDetail.EndDate      = data.EndDate;
                    _NotificationDetail.Duration     = data.Duration;
                    _NotificationDetail.Hours        = data.Hour;
                    _NotificationDetail.CustomerName = data.CustomerName;
                    _NotificationDetail.ProjectName  = data.ProjectName;
                    _NotificationDetail.CostCode     = data.CostCode;
                    _NotificationDetail.Function     = "";
                    _NotificationDetail.Link         = "";
                    var reportTodata      = _db.EmployeeRelations.Where(x => x.IsActive == true && x.UserID == EmployeeID).FirstOrDefault();
                    var aspnetUserDetails = _db.AspNetUsers.Where(x => x.Archived == false && x.Id == EmployeeID).FirstOrDefault();

                    Employee_TravelLeave TravelLeaveDetails = new Employee_TravelLeave();
                    TravelLeaveDetails = _db.Employee_TravelLeave.Find(DetailsId);
                    if (TravelLeaveDetails != null && TravelLeaveDetails.ApprovalStatus == "Pending")
                    {
                        _NotificationDetail.AppStatus = TravelLeaveDetails.ApprovalStatus;
                    }
                    if (aspnetUserDetails != null && TravelLeaveDetails != null)
                    {
                        if (aspnetUserDetails.HRResponsible == SessionProxy.UserId && aspnetUserDetails.HRResponsible != null)
                        {
                            TravelLeaveDetails.IsReadHR = true;
                        }
                        if (aspnetUserDetails.AdditionalReportsto == SessionProxy.UserId)
                        {
                            TravelLeaveDetails.IsReadAddReport = true;
                        }
                        if (TravelLeaveDetails != null && reportTodata.Reportsto == SessionProxy.UserId)
                        {
                            TravelLeaveDetails.IsRead = true;
                        }
                        _db.Entry(TravelLeaveDetails).State = System.Data.Entity.EntityState.Modified;
                        _db.SaveChanges();
                    }
                }
            }
            else if (Header == "Annual Leave Request")
            {
                var data = _NotificationMethod.GetAnnualLeaveNotificationByKey(EmployeeID, DetailsId).FirstOrDefault();
                if (data != null)
                {
                    _NotificationDetail.EmployeeId = data.EmployeeId;
                    _NotificationDetail.StartDate  = data.StartDate;
                    _NotificationDetail.EndDate    = data.EndDate;
                    _NotificationDetail.HeaderType = "Annual Leave Request";
                    _NotificationDetail.Duration   = data.Duration;
                    var reportTodata      = _db.EmployeeRelations.Where(x => x.IsActive == true && x.UserID == EmployeeID).FirstOrDefault();
                    var aspnetUserDetails = _db.AspNetUsers.Where(x => x.Archived == false && x.Id == EmployeeID).FirstOrDefault();
                    Employee_AnualLeave AnualLeaveDetails = new Employee_AnualLeave();
                    AnualLeaveDetails = _db.Employee_AnualLeave.Find(DetailsId);
                    if (AnualLeaveDetails != null && AnualLeaveDetails.ApprovalStatus == "Pending")
                    {
                        _NotificationDetail.AppStatus = AnualLeaveDetails.ApprovalStatus;
                    }
                    if (aspnetUserDetails != null && AnualLeaveDetails != null)
                    {
                        if (aspnetUserDetails.HRResponsible == SessionProxy.UserId && aspnetUserDetails.HRResponsible != null)
                        {
                            AnualLeaveDetails.IsReadHR = true;
                        }
                        if (aspnetUserDetails.AdditionalReportsto == SessionProxy.UserId)
                        {
                            AnualLeaveDetails.IsReadAddRep = true;
                        }
                        if (AnualLeaveDetails != null && reportTodata.Reportsto == SessionProxy.UserId)
                        {
                            AnualLeaveDetails.IsRead = true;
                        }
                        _db.Entry(AnualLeaveDetails).State = System.Data.Entity.EntityState.Modified;
                        _db.SaveChanges();
                    }
                }
            }
            else if (Header == "Other Leave Request")
            {
                var data = _NotificationMethod.GetOtherLeaveNotificationByKey(EmployeeID, DetailsId).FirstOrDefault();
                if (data != null)
                {
                    _NotificationDetail.EmployeeId = data.EmployeeId;
                    _NotificationDetail.HeaderType = data.HeaderType;
                    _NotificationDetail.StartDate  = data.StartDate;
                    _NotificationDetail.EndDate    = data.EndDate;
                    _NotificationDetail.Duration   = data.Duration;
                    _NotificationDetail.Reason     = data.Reason;
                    var reportTodata      = _db.EmployeeRelations.Where(x => x.IsActive == true && x.UserID == EmployeeID).FirstOrDefault();
                    var aspnetUserDetails = _db.AspNetUsers.Where(x => x.Archived == false && x.Id == EmployeeID).FirstOrDefault();
                    Employee_OtherLeave OtherLeaveDetails = new Employee_OtherLeave();
                    OtherLeaveDetails = _db.Employee_OtherLeave.Find(DetailsId);
                    if (OtherLeaveDetails != null && OtherLeaveDetails.ApprovalStatus == "Pending")
                    {
                        _NotificationDetail.AppStatus = OtherLeaveDetails.ApprovalStatus;
                    }
                    if (aspnetUserDetails != null && OtherLeaveDetails != null)
                    {
                        if (aspnetUserDetails.HRResponsible == SessionProxy.UserId && aspnetUserDetails.HRResponsible != null)
                        {
                            OtherLeaveDetails.IsReadHR = true;
                        }
                        if (aspnetUserDetails.AdditionalReportsto == SessionProxy.UserId)
                        {
                            OtherLeaveDetails.IsReadAddRep = true;
                        }
                        if (OtherLeaveDetails != null && reportTodata.Reportsto == SessionProxy.UserId)
                        {
                            OtherLeaveDetails.IsRead = true;
                        }
                        _db.Entry(OtherLeaveDetails).State = System.Data.Entity.EntityState.Modified;
                        _db.SaveChanges();
                    }
                }
            }
            else if (Header == "Maternity/Paternity Leave")
            {
                var data = _NotificationMethod.GetMaternityPatLeaveByKey(Convert.ToInt32(DetailsId)).FirstOrDefault();
                if (data != null)
                {
                    _NotificationDetail.EmployeeId = data.EmployeeID;
                    _NotificationDetail.HeaderType = "Maternity/Paternity Leave";
                    _NotificationDetail.StartDate  = Convert.ToString(data.ActualStartDate);
                    _NotificationDetail.EndDate    = Convert.ToString(data.ActualEndDate);
                    _NotificationDetail.dueDate    = Convert.ToString(data.DueDate);
                    _NotificationDetail.Link       = data.Link;
                    var reportTodata      = _db.EmployeeRelations.Where(x => x.IsActive == true && x.UserID == EmployeeID).FirstOrDefault();
                    var aspnetUserDetails = _db.AspNetUsers.Where(x => x.Archived == false && x.Id == EmployeeID).FirstOrDefault();
                    Employee_MaternityOrPaternityLeaves MatPatLeaveDetails = new Employee_MaternityOrPaternityLeaves();
                    MatPatLeaveDetails = _db.Employee_MaternityOrPaternityLeaves.Find(DetailsId);
                    if (MatPatLeaveDetails != null && MatPatLeaveDetails.ApprovalStatus == "Pending")
                    {
                        _NotificationDetail.AppStatus = MatPatLeaveDetails.ApprovalStatus;
                    }
                    if (aspnetUserDetails != null && MatPatLeaveDetails != null)
                    {
                        if (aspnetUserDetails.HRResponsible == SessionProxy.UserId && aspnetUserDetails.HRResponsible != null)
                        {
                            MatPatLeaveDetails.IsReadHR = true;
                        }
                        if (aspnetUserDetails.AdditionalReportsto == SessionProxy.UserId)
                        {
                            MatPatLeaveDetails.IsReadAddRes = true;
                        }
                        if (MatPatLeaveDetails != null && reportTodata.Reportsto == SessionProxy.UserId)
                        {
                            MatPatLeaveDetails.IsRead = true;
                        }
                        _db.Entry(MatPatLeaveDetails).State = System.Data.Entity.EntityState.Modified;
                        _db.SaveChanges();
                    }
                }
            }
            else if (Header == "Sick Leave")
            {
                var data = _NotificationMethod.getSickLeaveByKey(Convert.ToInt32(DetailsId)).FirstOrDefault();
                if (data != null)
                {
                    _NotificationDetail.EmployeeId    = data.EmployeeId;
                    _NotificationDetail.HeaderType    = "Sick Leave Request";
                    _NotificationDetail.StartDate     = Convert.ToString(data.StartDate);
                    _NotificationDetail.EndDate       = Convert.ToString(data.EndDate);
                    _NotificationDetail.Duration      = Convert.ToDecimal(data.DurationDays);
                    _NotificationDetail.DoctConsulted = data.DoctorConsulted;
                    _NotificationDetail.Paid          = data.IsPaid;
                    var reportTodata = _db.EmployeeRelations.Where(x => x.IsActive == true && x.UserID == EmployeeID).FirstOrDefault();
                    Employee_SickLeaves SickLeaveDetails = new Employee_SickLeaves();
                    SickLeaveDetails = _db.Employee_SickLeaves.Find(DetailsId);
                    if (SickLeaveDetails != null && SickLeaveDetails.ApprovalStatus == "Pending")
                    {
                        _NotificationDetail.AppStatus = SickLeaveDetails.ApprovalStatus;
                    }
                    var aspnetUserDetails = _db.AspNetUsers.Where(x => x.Archived == false && x.Id == EmployeeID).FirstOrDefault();
                    if (aspnetUserDetails != null && SickLeaveDetails != null)
                    {
                        if (aspnetUserDetails.HRResponsible == SessionProxy.UserId && aspnetUserDetails.HRResponsible != null)
                        {
                            SickLeaveDetails.IsReadHR = true;
                        }
                        if (aspnetUserDetails.AdditionalReportsto == SessionProxy.UserId)
                        {
                            SickLeaveDetails.IsReadAddRep = true;
                        }
                        if (SickLeaveDetails != null && reportTodata.Reportsto == SessionProxy.UserId)
                        {
                            SickLeaveDetails.IsRead = true;
                        }

                        _db.Entry(SickLeaveDetails).State = System.Data.Entity.EntityState.Modified;
                        _db.SaveChanges();
                    }
                }
            }
            else if (Header == "Training Request")
            {
                var data = _NotificationMethod.GetTrainingNotificationByKey(EmployeeID, DetailsId).FirstOrDefault();
                if (data != null)
                {
                    _NotificationDetail.EmployeeId   = data.EmployeeId;
                    _NotificationDetail.StartDate    = data.StartDate;
                    _NotificationDetail.EndDate      = data.EndDate;
                    _NotificationDetail.TrainingName = data.TrainingName;
                    _NotificationDetail.Provider     = data.Provider;
                    if (data.Importance == 1)
                    {
                        _NotificationDetail.Importance = "Mandatory";
                    }
                    else
                    {
                        _NotificationDetail.Importance = "Optional";
                    }

                    _NotificationDetail.Cost       = data.Cost;
                    _NotificationDetail.Day        = Convert.ToString(data.Days);
                    _NotificationDetail.HeaderType = "Training Request";

                    EmployeeTraining EmployeeTraining = new EmployeeTraining();
                    EmployeeTraining                  = _db.EmployeeTrainings.Find(DetailsId);
                    EmployeeTraining.IsRead           = true;
                    _db.Entry(EmployeeTraining).State = System.Data.Entity.EntityState.Modified;
                    _db.SaveChanges();
                }
            }
            else if (Header == "New Vacancy")
            {
                var data = _NotificationMethod.GetNewVacancyNotificationByKey(EmployeeID, DetailsId).FirstOrDefault();
                if (data != null)
                {
                    _NotificationDetail.EmployeeId          = null;
                    _NotificationDetail.HeaderType          = "New Vacancy";
                    _NotificationDetail.Vacancy             = data.Title;
                    _NotificationDetail.ClosingDate         = data.ClosingDate;
                    _NotificationDetail.RecruitementProcess = data.RecruitmentProcesses;
                    _NotificationDetail.SalaryRange         = data.Salary;
                    _NotificationDetail.Location            = data.Location;
                    _NotificationDetail.Business            = data.Business;
                    _NotificationDetail.Division            = data.Division;
                    _NotificationDetail.Pool     = data.Pool;
                    _NotificationDetail.Function = data.Functions;

                    Vacancy VacancyDetails = new Vacancy();
                    VacancyDetails                  = _db.Vacancies.Find(DetailsId);
                    VacancyDetails.IsRead           = true;
                    _db.Entry(VacancyDetails).State = System.Data.Entity.EntityState.Modified;
                    _db.SaveChanges();
                }
            }
            else if (Header == "Uplift Submission")
            {
                var data = _NotificationMethod.GetUpLiftNotificationByKey(EmployeeID, DetailsId).FirstOrDefault();
                if (data != null)
                {
                    _NotificationDetail.EmployeeId           = data.EmployeeId;
                    _NotificationDetail.HeaderType           = data.HeaderType;
                    _NotificationDetail.Day                  = data.day;
                    _NotificationDetail.Date                 = data.Date;
                    _NotificationDetail.UpliftPosition       = data.UpliftPostionId;
                    _NotificationDetail.Hours                = data.Hours;
                    _NotificationDetail.ProjectName          = data.Project;
                    _NotificationDetail.CustomerName         = data.Customer;
                    _NotificationDetail.ChangeInWorkRate     = data.WorkerRate;
                    _NotificationDetail.ChangeInCustomerRate = data.CustomerRate;

                    Employee_ProjectPlanner_Uplift_Detail UpliftDetails = new Employee_ProjectPlanner_Uplift_Detail();
                    var reportTodata = _db.EmployeeRelations.Where(x => x.IsActive == true && x.UserID == EmployeeID).FirstOrDefault();
                    UpliftDetails = _db.Employee_ProjectPlanner_Uplift_Detail.Find(DetailsId);
                    var aspnetUserDetails = _db.AspNetUsers.Where(x => x.Id == EmployeeID && x.Archived == false).FirstOrDefault();
                    if (UpliftDetails != null && UpliftDetails.ApprovalStatus == "Pending")
                    {
                        _NotificationDetail.AppStatus = UpliftDetails.ApprovalStatus;
                    }
                    if (aspnetUserDetails != null && UpliftDetails != null)
                    {
                        if (aspnetUserDetails.HRResponsible == SessionProxy.UserId && aspnetUserDetails.HRResponsible != null)
                        {
                            UpliftDetails.IsReadHR = true;
                        }
                        if (aspnetUserDetails.AdditionalReportsto == SessionProxy.UserId)
                        {
                            UpliftDetails.IsReadAddRep = true;
                        }
                        if (UpliftDetails != null && reportTodata.Reportsto == SessionProxy.UserId)
                        {
                            UpliftDetails.IsRead = true;
                        }
                        _db.Entry(UpliftDetails).State = System.Data.Entity.EntityState.Modified;
                        _db.SaveChanges();
                    }
                }
            }
            else if (Header == "Skill Endorsement")
            {
                Employee_AddEndrosementSkills EndrosementSkillseDetails = new Employee_AddEndrosementSkills();
                EndrosementSkillseDetails                  = _db.Employee_AddEndrosementSkills.Find(DetailsId);
                EndrosementSkillseDetails.IsRead           = true;
                _db.Entry(EndrosementSkillseDetails).State = System.Data.Entity.EntityState.Modified;
                _db.SaveChanges();
            }
            else if (Header == "New Resource")
            {
                var data = _NotificationMethod.getNewResourceDetails(EmployeeID);
                if (data != null)
                {
                    _NotificationDetail.EmployeeId = data.Id;
                    _NotificationDetail.HeaderType = "New Resource";
                    _NotificationDetail.StartDate  = Convert.ToString(data.StartDate);
                    _NotificationDetail.email      = Convert.ToString(data.UserName);

                    AspNetUser aspDetails   = new AspNetUser();
                    var        reportTodata = _db.EmployeeRelations.Where(x => x.IsActive == true && x.UserID == EmployeeID).FirstOrDefault();
                    aspDetails = _db.AspNetUsers.Find(EmployeeID);
                    if (aspDetails.HRResponsible == SessionProxy.UserId)
                    {
                        aspDetails.IsReadHRRespo = true;
                    }
                    if (aspDetails.AdditionalReportsto == SessionProxy.UserId)
                    {
                        aspDetails.IsReadAddReport = true;
                    }
                    if (reportTodata != null && reportTodata.Reportsto == SessionProxy.UserId)
                    {
                        aspDetails.IsReadNewResource = true;
                    }
                    _db.Entry(aspDetails).State = System.Data.Entity.EntityState.Modified;
                    _db.SaveChanges();
                }
            }
            else if (Header == "Delete employee")
            {
                var data = _NotificationMethod.getDeleteResourceDetails(EmployeeID);
                if (data != null)
                {
                    _NotificationDetail.EmployeeId   = data.Id;
                    _NotificationDetail.HeaderType   = "Delete employee";
                    _NotificationDetail.EmployeeName = data.FirstName + " " + data.LastName;
                    _NotificationDetail.StartDate    = Convert.ToString(data.StartDate);
                    _NotificationDetail.email        = Convert.ToString(data.UserName);

                    AspNetUser aspDetails = new AspNetUser();
                    aspDetails = _db.AspNetUsers.Find(EmployeeID);
                    aspDetails.IsReadArchived   = true;
                    _db.Entry(aspDetails).State = System.Data.Entity.EntityState.Modified;
                    _db.SaveChanges();
                }
            }
            else if (Header == "New Document")
            {
                var data = _NotificationMethod.getEmployeeDocumentByKey(Convert.ToInt32(DetailsId));
                _NotificationDetail.EmployeeId   = data.Id;
                _NotificationDetail.HeaderType   = "New Document";
                _NotificationDetail.DocumentName = data.DocumentPath;
                _NotificationDetail.Description  = data.Description;
                _NotificationDetail.DocLink      = data.LinkURL;
                Employee_Document aspDetails = new Employee_Document();
                aspDetails                  = _db.Employee_Document.Find(DetailsId);
                aspDetails.IsRead           = true;
                _db.Entry(aspDetails).State = System.Data.Entity.EntityState.Modified;
                _db.SaveChanges();
            }
            else if (Header == "Document Signature")
            {
                var data = _NotificationMethod.getEmployeeDocumentForSignatureByKey(Convert.ToInt32(DetailsId));
                _NotificationDetail.EmployeeId   = data.Id;
                _NotificationDetail.HeaderType   = "Document Signature";
                _NotificationDetail.DocumentName = data.DocumentPath;
                _NotificationDetail.Description  = data.Description;
                _NotificationDetail.DocLink      = data.LinkURL;
                Employee_Document aspDetails = new Employee_Document();
                aspDetails = _db.Employee_Document.Find(DetailsId);
                aspDetails.IsReadSignature  = true;
                _db.Entry(aspDetails).State = System.Data.Entity.EntityState.Modified;
                _db.SaveChanges();
            }
            else if (Header == "New Vacancy Posted")
            {
                var data = _NotificationMethod.getVacancyByKey(Convert.ToInt32(DetailsId));

                _NotificationDetail.EmployeeId = data.Id;
                _NotificationDetail.HeaderType = "New Vacancy Posted";
                Vacancy vacDetails = new Vacancy();
                vacDetails = _db.Vacancies.Find(DetailsId);
                vacDetails.IsReadVacancy    = true;
                _db.Entry(vacDetails).State = System.Data.Entity.EntityState.Modified;
                _db.SaveChanges();
            }
            else if (Header == "New Applicant")
            {
                var data = _NotificationMethod.getTMSApplicantDetailByKey(Convert.ToInt32(EmployeeID));

                _NotificationDetail.EmployeeId = data.Id;
                _NotificationDetail.HeaderType = "New Applicant";
                TMS_Applicant aspDetails = new TMS_Applicant();
                aspDetails = _db.TMS_Applicant.Find(EmployeeID);
                aspDetails.IsReadHiringLead = true;
                _db.Entry(aspDetails).State = System.Data.Entity.EntityState.Modified;
                _db.SaveChanges();
            }
            return(PartialView("_GetNotificationDetails", _NotificationDetail));
        }
Example #17
0
 public static void Show(NotificationMethod method, string message, string caption)
 {
     Instance.ShowMessage(method, message, caption);
 }
Example #18
0
 public static void Show(NotificationMethod method, string message, string caption,
                         Action notificationTapped)
 {
     Awful.AppDataModel model = Awful.App.Model;
     Instance.ShowMessage(method, message, caption, notificationTapped);
 }
Example #19
0
        public INotificationSenderService <TInvoker> Create(NotificationMethod method)
        {
            var service = _lifetimeScope.ResolveKeyed <INotificationSenderService <TInvoker> >(method);

            return(service);
        }
Example #20
0
        private void ShowErrorMessage(NotificationMethod method, string message, string caption, Action notificationTapped)
        {
            switch (method)
            {
                // send toast, or message box if failure
                case NotificationMethod.Toast:
                    try { ShowToastError(message, caption, notificationTapped); }
                    catch (Exception) { ShowMessageBoxError(message, caption, notificationTapped); }
                    break;

                // send message box
                case NotificationMethod.MessageBox:
                    ShowMessageBoxError(message, caption, notificationTapped);
                    break;
            }
        }
Example #21
0
 public static void ShowError(NotificationMethod notificationMethod, string p1, string p2, Action onTap = null)
 {
     string caption = p2 == null ? string.Empty : p2;
     string message = p1 == null ? string.Empty : p1;
     Instance.ShowErrorMessage(notificationMethod, message, caption, onTap);
 }
Example #22
0
 public static void Show(NotificationMethod method, string message, string caption,
     Action notificationTapped)
 {
     Awful.AppDataModel model = Awful.App.Model;
     Instance.ShowMessage(method, message, caption, notificationTapped);
 }
Example #23
0
 public static void Show(NotificationMethod method, string message, string caption)
 {
     Instance.ShowMessage(method, message, caption);
 }
 public void Update()
 {
     object value;
     _temperaturelertlevel = (value = _settings.Get(_TEMPERATURE_ALERT_LEVEL_KEY)) != null ? (int)value : _DEFAULT_TEMPERATURE_ALERT_LEVEL;
     _updatetime = (value = _settings.Get(_UPDATE_TIME_KEY)) != null ? (int)value : _DEFAULT_UPDATE_TIME;
     _notification = (value = _settings.Get(_NOTIFICATION_KEY)) != null ? (NotificationMethod)value : _DEFAULT_NOTIFICATION;
     _theme = (value = _settings.Get(_THEME_KEY)) != null ? (Theme)value : _DEFAULT_THEME;
     _soundResourceName = (value = _settings.Get(_SOUND_RESOURCE_NAME_KEY)) as string;
 }