Пример #1
0
        public void CanNotificationBeSaved()
        {
            var notification = new Notification()
                                   {
                                       Text = "transport order two",
                                       Url = _destinationURl,
                                       RecordId = 2,
                                       IsRead = false,
                                       TypeOfNotification = "New transport order",
                                       CreatedDate = DateTime.Now,
                                       Id = 1,
                                       Application = "Hub Managers"
                                   };

            var tranportRequsition = new TransportRequisition()
                                         {
                                             CertifiedBy = 1,
                                             CertifiedDate = DateTime.Today,
                                             RequestedBy = 1,
                                             RequestedDate = DateTime.Today,
                                             TransportRequisitionID = 1,
                                             TransportRequisitionNo = "TRN-001",
                                             Status = 1,
                                             Remark = "Remark",
                                         };
            var hubId = new List<int>(){1,2,3};
            var resultLogistics = _notificationService.AddNotificationForLogistcisFromEarlyWaring("",1, 1, "reg-001");
            var resultProcurement = _notificationService.AddNotificationForProcurementFromLogistics("",tranportRequsition);
            var resultHubManager = _notificationService.AddNotificationForHubManagersFromTransportOrder("",1, "trans-001",hubId);

            Assert.IsTrue(resultLogistics);
            Assert.IsTrue(resultProcurement);
            Assert.IsTrue(resultHubManager);
        }
Пример #2
0
        public bool AddNotificationForEarlyWaringFromRegions(string destinationURl, int requestId, int regionId)
        {
            try
            {
                var notification = new Notification
                {
                    Text = "Request - " + requestId.ToString(),
                    CreatedDate = DateTime.Now.Date,
                    IsRead = false,
                    Id = regionId,
                    RecordId = requestId,
                    Url = destinationURl,
                    TypeOfNotification = "Request Creation from Regions",
                    Application = Application.EARLY_WARNING
                };

                AddNotification(notification);
                return true;

            }
            catch (Exception)
            {
                return false;

            }
        }
Пример #3
0
        public bool AddNotificationForLogistcisFromEarlyWaring(string destinationURl,int requisitionID, int regionId, string requisitioNo)
        {
            try
            {
                    var notification = new Notification
                                           {
                                               Text = "Approved Requistion" + requisitioNo,
                                               CreatedDate = DateTime.Now.Date,
                                               IsRead = false,
                                               Role = 1,
                                               RecordId = requisitionID,
                                               Url = destinationURl,
                                               TypeOfNotification = "Requisition Approval",
                                               RoleName = Application.HUB_ALLOCATER
                                           };

                    AddNotification(notification);
                    return true;

            }
            catch (Exception)
            {
                return false;

            }
        }
Пример #4
0
        public bool AddNotificationForHubManagersFromTransportOrder(string destinationUrl,int transportOrderId, string transportOrderNo)
        {
            try
            {

                var notification = new Notification
                {
                    Text = "Transport Order No:" + transportOrderNo,
                    CreatedDate = DateTime.Now.Date,
                    IsRead = false,
                    Role = 1,
                    RecordId = transportOrderId,
                    Url = destinationUrl,
                    TypeOfNotification = "New Transport Order",
                    RoleName = Application.HUB_MANAGER
                };
                AddNotification(notification);
                return true;
            }
            catch (Exception)
            {

                return false;
            }
        }
Пример #5
0
        public bool AddNotificationForHubManagersFromTransportOrder(string destinationUrl,int transportOrderId, string transportOrderNo,List<int> hubId)
        {
            try
            {
                Notification notification=null;
                if (hubId!=null)
                {
                    foreach (var id in hubId)
                    {
                        notification = new Notification
                        {
                            Text = "Transport Order No:" + transportOrderNo,
                            CreatedDate = DateTime.Now.Date,
                            IsRead = false,
                            Id = id,
                            RecordId = transportOrderId,
                            Url = destinationUrl,
                            TypeOfNotification = "New Transport Order",
                            Application = Application.HUB
                        };
                        AddNotification(notification);
                    }
                }

                else
                {
                    notification = new Notification
                    {
                        Text = "Transport Order No:" + transportOrderNo,
                        CreatedDate = DateTime.Now.Date,
                        IsRead = false,
                        Id = -1,
                        RecordId = transportOrderId,
                        Url = destinationUrl,
                        TypeOfNotification = "New Transport Order",
                        Application = Application.HUB
                    };
                    AddNotification(notification);
                }

                return true;
            }
            catch (Exception)
            {

                return false;
            }
        }
Пример #6
0
 public bool AddNotification(Notification notification)
 {
     _unitOfWork.NotificationRepository.Add(notification);
     _unitOfWork.Save();
     return true;
 }
Пример #7
0
 public bool EditNotification(Notification notification)
 {
     _unitOfWork.NotificationRepository.Edit(notification);
     _unitOfWork.Save();
     return true;
 }
Пример #8
0
 public bool DeleteNotification(Notification notification)
 {
     if (notification == null) return false;
     _unitOfWork.NotificationRepository.Delete(notification);
     _unitOfWork.Save();
     return true;
 }
Пример #9
0
        public bool AddNotificationForProcurmentForGRNDiscripancy(string destinationURl, int transportOrderId,string transportOrderNo)
        {
            try
            {
                var notification = new Notification
                {
                    Text = "GRN with loss from transport order " + transportOrderNo,
                    CreatedDate = DateTime.Now.Date,
                    IsRead = false,
                    Id = 1,
                    RecordId = transportOrderId,
                    Url = destinationURl,
                    TypeOfNotification = "GRN With loss",
                    Application = Application.TRANSPORT_ORDER_CREATER
                };

                AddNotification(notification);
                return true;

            }
            catch (Exception)
            {
                return false;

            }
        }
Пример #10
0
        public bool AddNotificationForProcurementFromLogistics(string destinationURl, TransportRequisition transportRequisition)
        {
            try
            {

                var notification = new Notification
                {
                    Text = "Transport Requisition No:" + transportRequisition.TransportRequisitionNo,
                    CreatedDate = DateTime.Now.Date,
                    IsRead = false,
                    Id = 1,
                    RecordId = transportRequisition.TransportRequisitionID,
                    Url = destinationURl,
                    TypeOfNotification = "New Transport Requisition",
                    Application = Application.PROCUREMENT
                };
                AddNotification(notification);
                return true;
            }
            catch (Exception)
            {

                return false;
            }
        }