Пример #1
0
        public JsonResult GetJson()
        {
            IList <Tariff> reply    = _tariffService.GetallTariff();
            JsonResult     response = Json(reply, JsonRequestBehavior.AllowGet);

            List <TariffObject> responsee = new List <TariffObject>();

            foreach (Tariff item in reply)
            {
                TariffObject pond = new TariffObject();
                MrCMS.Entities.People.User cteatedby = _userservice.GetUser(item.CreatedBy);
                MrCMS.Entities.People.User authuser  = _userservice.GetUser(item.authBy);

                pond.Id          = item.Id.ToString();
                pond.Name        = CurrentRequestData.CultureInfo.TextInfo.ToTitleCase(!string.IsNullOrEmpty(item.Name) ? item.Name : "--");
                pond.Description = item.Description;
                pond.Status      = item.Status.ToString();
                pond.CreatedBy   = cteatedby != null ? cteatedby.Name : "--";
                pond.CreatedDate =
                    Convert.ToDateTime(item.CreatedOn)
                    .ToString(CurrentRequestData.CultureInfo.DateTimeFormat.FullDateTimePattern);
                pond.authstatus = item.authstatus ? "Authorized" : "Pending";
                pond.authBy     = authuser != null?authuser.Name.ToUpper() : "--";

                pond.AuthorizedDate = item.authstatus ? Convert.ToDateTime(item.AuthorizedDate)
                                      .ToString(CurrentRequestData.CultureInfo.DateTimeFormat.FullDateTimePattern) : "--";


                responsee.Add(pond);
            }
            return(Json(new
            {
                aaData = responsee
            }));
        }
Пример #2
0
        public override System.Threading.Tasks.Task OnDisconnected(bool stopCalled)
        {
            string connectionid = Context.ConnectionId;

            MrCMS.Entities.People.User user = _notificationHubUSerService.GetUser(Context.User);

            if (user != null)
            {
                _notificationHubUSerService.RemoveUserfromConnectionList(user);
            }

            return(base.OnDisconnected(stopCalled));
        }
Пример #3
0
        private IList <Webpage> GetPages(IList <Webpage> parents)
        {
            IQueryOver <Webpage, Webpage> queryOver = _session.QueryOver <Webpage>();

            if (parents == null)
            {
                queryOver = queryOver.Where(webpage => webpage.Parent == null);
            }
            else
            {
                List <int> parentIds = parents.Select(p => p.Id).ToList();
                queryOver = queryOver.Where(webpage => webpage.Parent.Id.IsIn(parentIds));
            }

            List <Webpage> resp = queryOver.Where(webpage => webpage.RevealInNavigation)
                                  .OrderBy(webpage => webpage.DisplayOrder).Asc
                                  .Cacheable()
                                  .List().ToList(x => x.Published);

            //Check if the user is permitted for the particular page
            //Added by Tony navigation returns for only users that are permitted
            MrCMS.Entities.People.User user = CurrentRequestData.CurrentUser;

            if (user != null)
            {
                ISet <MrCMS.Entities.People.UserRole> userRoles = user.Roles;
                List <Webpage> notPermitted = resp.Where(page => !userRoles.Any(x => x.FrontEndWebpages.Contains(page))).ToList();
                //Remove the pages that are not permitted


                foreach (Webpage item in notPermitted)
                {
                    if (item.ShowOnlyIfPermitted)
                    {
                        resp.Remove(item);
                    }
                }
            }
            else
            {
                //Clear all Tabs
                resp.Clear();
            }

            return(resp);
        }
Пример #4
0
        public override System.Threading.Tasks.Task OnConnected()
        {
            string connectionid = Context.ConnectionId;

            MrCMS.Entities.People.User user = _notificationHubUSerService.GetUser(Context.User);

            if (user != null)
            {
                //add user to
                _notificationHubUSerService.AddUsertoConnectionList(user, connectionid);
                //_notificationHubUSerService.PushUserNotification(user.Guid.ToString(), "hello world ,tony was here", user.Roles.Single(),
                //Enums.NotificationType.Single);

                //check if the user has offline messages
                IList <Entities.OfflineMessage> msges = _notificationHubUSerService.GetAllofflineMessages(user.Guid.ToString());
                //send the client the username
                GlobalHost.ConnectionManager.GetHubContext <ClientNotificationHub>().Clients.Client(connectionid).
                setUsername(user.Guid.ToString());
                //Tell the client that the use is online
                GlobalHost.ConnectionManager.GetHubContext <ClientNotificationHub>().Clients.All.showuserOnline(
                    user.Guid.ToString(), "1");
                if (msges.Any())
                {
                    //send the messages
                    foreach (Entities.OfflineMessage msg in msges)
                    {
                        // Call the client to update the recepient
                        Clients.All.receiveMsg(msg.FromId, msg.ToId, msg.Message, msg.Message);
                        //mark the messages as read
                        _notificationHubUSerService.MarkOfflinemessageasread(msg);
                    }
                }
            }
            else
            {
                //probably providers
            }

            return(base.OnConnected());
        }
Пример #5
0
        public bool addAuthorization(AuthorizationCode authorizaction)
        {
            if (authorizaction != null)
            {
                _session.Transact(session => session.SaveOrUpdate(authorizaction));

                MrCMS.Entities.People.User usergenerated = _userService.GetUser(authorizaction.generatedby);
                MrCMS.Entities.People.User userauth      = _userService.GetUser(authorizaction.Authorizedby);
                Provider provider = _providersvc.GetProvider(authorizaction.provider);


                QueuedMessage emailmsg = new QueuedMessage();
                emailmsg.FromAddress = _mailSettings.SystemEmailAddress;
                emailmsg.ToAddress   = userauth.Email;
                emailmsg.Subject     = "NovoHub Authorization Code Generated ";
                emailmsg.FromName    = "NOVOHUB";



                emailmsg.Body = string.Format("An authorization code {5} was generated for {0} by {1} and was authorized by you on {2} for {4} with policy number {3}", provider.Name.ToUpper(), usergenerated.Name.ToUpper(), Convert.ToDateTime(authorizaction.CreatedOn).ToString(CurrentRequestData.CultureInfo.DateTimeFormat.FullDateTimePattern), authorizaction.policyNumber, authorizaction.enrolleeName, authorizaction.authorizationCode);

                //_emailSender.AddToQueue(emailmsg);

                //send admission shit
                if (authorizaction.Isadmission)
                {
                    StringBuilder bodyText = new StringBuilder();
                    bodyText.Append("<p>Dear Admin,</p>");
                    bodyText.AppendLine(string.Format("<p>A new admission was approved with code {5} for {0} and generated by {1} and was authorized by {6} on {2} for {4} with policy number {3} </p>", provider.Name.ToUpper(), usergenerated.Name.ToUpper(), Convert.ToDateTime(authorizaction.CreatedOn).ToString(CurrentRequestData.CultureInfo.DateTimeFormat.FullDateTimePattern), authorizaction.policyNumber, authorizaction.enrolleeName, authorizaction.authorizationCode, userauth.Name.ToUpper()));
                    bodyText.AppendLine(Environment.NewLine);
                    bodyText.AppendLine("<p>You are required to follow up on the admission.</p>");
                    bodyText.AppendLine("<p>Thank You.</p>");

                    //send to client service.
                    MrCMS.Entities.People.UserRole role = _roleSvc.GetRoleByName("CLIENT SERVICE");
                    if (role != null)
                    {
                        foreach (MrCMS.Entities.People.User user in role.Users)
                        {
                            //each user

                            QueuedMessage emailmsgAdd = new QueuedMessage();
                            emailmsgAdd.FromAddress = _mailSettings.SystemEmailAddress;
                            emailmsgAdd.ToAddress   = user.Email;
                            emailmsgAdd.Subject     = "NovoHub -New Admission ";
                            emailmsgAdd.FromName    = "NOVOHUB";
                            emailmsgAdd.Body        = bodyText.ToString();
                            emailmsgAdd.IsHtml      = true;

                            //_emailSender.AddToQueue(emailmsgAdd);
                        }
                    }
                    //added else
                    else
                    {
                    }
                    //send to provider service.
                    role = _roleSvc.GetRoleByName("PROVIDER");
                    if (role != null)
                    {
                        foreach (MrCMS.Entities.People.User user in role.Users)
                        {
                            //each user

                            QueuedMessage emailmsgAdd = new QueuedMessage();
                            emailmsgAdd.FromAddress = _mailSettings.SystemEmailAddress;
                            emailmsgAdd.ToAddress   = user.Email;
                            emailmsgAdd.Subject     = "NovoHub -New Admission ";
                            emailmsgAdd.FromName    = "NOVOHUB";
                            emailmsgAdd.Body        = bodyText.ToString();
                            emailmsgAdd.IsHtml      = true;
                            // _emailSender.AddToQueue(emailmsgAdd);
                        }
                    }
                    //added else
                    else
                    {
                    }


                    //send to medical service.
                    role = _roleSvc.GetRoleByName("MEDICAL UNIT");
                    if (role != null)
                    {
                        foreach (MrCMS.Entities.People.User user in role.Users)
                        {
                            //each user

                            QueuedMessage emailmsgAdd = new QueuedMessage();
                            emailmsgAdd.FromAddress = _mailSettings.SystemEmailAddress;
                            emailmsgAdd.ToAddress   = user.Email;
                            emailmsgAdd.Subject     = "NovoHub -New Admission ";
                            emailmsgAdd.FromName    = "NOVOHUB";
                            emailmsgAdd.Body        = bodyText.ToString();
                            emailmsgAdd.IsHtml      = true;
                            // _emailSender.AddToQueue(emailmsgAdd);
                        }
                    }
                    //added else
                    else
                    {
                    }
                }


                //Notify the theres a new verificationCode
                AuthenticationCodeCreatedArgs args = new AuthenticationCodeCreatedArgs
                {
                    AuthorizationCode = authorizaction
                };
                //Notify the Hub of the new Input
                EventContext.Instance.Publish(typeof(INewNotificationEvent), args);

                return(true);
            }
            return(false);
        }
Пример #6
0
        public ProviderVm GetProviderVm(int id)
        {
            Provider item = GetProvider(id);

            if (item != null)
            {
                string[] split = item.Providerservices != null?item.Providerservices.Split(',') : new string[]
                {
                    string.Empty
                };
                string[] split2 = item.Providerplans != null?item.Providerplans.Split(',') : new string[]
                {
                    string.Empty
                };
                string[] split3 = item.ProviderTariffs != null?item.ProviderTariffs.Split(',') : new string[]
                {
                    string.Empty
                };
                string[] split4 = item.CompanyConsession != null?item.CompanyConsession.Split(',') : new string[]
                {
                    string.Empty
                };
                List <string> planlist        = new List <string>();
                List <string> servicelist     = new List <string>();
                List <string> tarifflist      = new List <string>();
                List <string> consessionslist = new List <string>();
                if (split.Any())
                {
                    foreach (string serv in split)
                    {
                        if (!string.IsNullOrEmpty(serv))
                        {
                            servicelist.Add(_servicevc.GetService(Convert.ToInt32(serv)).Name + ",");
                        }
                    }
                }



                if (split2.Any())
                {
                    foreach (string plan in split2)
                    {
                        if (!string.IsNullOrEmpty(plan))
                        {
                            planlist.Add(_plansvc.GetPlan(Convert.ToInt32(plan)).Name + ",");
                        }
                    }
                    // planlist = split2.Select(plan => _plansvc.GetPlan(Convert.ToInt32(plan)).Name + ",").ToList();
                }
                if (split3.Any())
                {
                    Tariff tempitem = null;

                    try
                    {
                        tarifflist = split3.Select(tariff => (tempitem = _tariffService.GetTariff(Convert.ToInt32(tariff))) != null ? tempitem.Name + "," : string.Empty).ToList();
                    }
                    catch (Exception)
                    {
                        //throw;
                    }
                }

                if (split4.Any())
                {
                    Company tempitem = null;

                    try
                    {
                        consessionslist = split4.Select(concess => (tempitem = _companyService.GetCompany(Convert.ToInt32(concess))) != null ? tempitem.Name + "," : string.Empty).ToList();
                    }
                    catch (Exception)
                    {
                        //throw;
                    }
                }
                if (servicelist.Any())
                {
                    string last = servicelist.Last();
                    servicelist.Remove(last);
                    try
                    {
                        servicelist.Add(last.Substring(0, last.Length - 1));
                    }
                    catch (Exception)
                    {
                    }
                }

                if (planlist.Any())
                {
                    string plast = planlist.Last();



                    planlist.Remove(plast);
                    try
                    {
                        planlist.Add(plast.Substring(0, plast.Length - 1));
                    }
                    catch (Exception)
                    {
                    }
                }



                try
                {
                    string tlast = tarifflist.Last();
                    tarifflist.Remove(tlast);
                    tarifflist.Add(tlast.Substring(0, tlast.Length - 1));
                }
                catch (Exception)
                {
                }

                try
                {
                    string tlast = consessionslist.Last();
                    consessionslist.Remove(tlast);
                    consessionslist.Add(tlast.Substring(0, tlast.Length - 1));
                }
                catch (Exception)
                {
                }

                MrCMS.Entities.People.User test   = _userService.GetAllUsers().SingleOrDefault(x => x.Guid.ToString().ToLower() == item.CreatedBy.ToLower());
                MrCMS.Entities.People.User authby = item.AuthorizedBy > 0 ? _userService.GetUser(item.AuthorizedBy) : null;
                if (true)
                {
                    ProviderVm model = new ProviderVm()
                    {
                        Id                  = item.Id,
                        Name                = item.Name.ToUpper(),
                        Code                = item.Code,
                        SubCode             = item.SubCode,
                        Phone               = item.Phone,
                        Phone2              = item.Phone2,
                        Email               = item.Email,
                        Website             = item.Website,
                        Address             = item.Address,
                        Provideraccount     = item.Provideraccount,
                        Provideraccount2    = item.Provideraccount2,
                        Area                = item.Area,
                        Assignee            = item.Assignee,
                        AssigneeName        = _userService.GetUser(item.Assignee).Name,
                        State               = item.State,
                        Lganame             = item.Lga.Name,
                        Lgaid               = item.Lga.Id,
                        AuthorizationStatus = item.AuthorizationStatus,
                        AuthorizationNote   = item.AuthorizationNote,
                        AuthorizedBy        = item.AuthorizedBy,
                        Status              = item.Status,
                        Providerplans       = planlist,
                        Providerservices    = servicelist,
                        ProviderTariffs     = tarifflist,
                        consessionslist     = consessionslist,
                        consessions         = item.CompanyConsession,
                        CreatedBy           =
                            item.CreatedBy != null && test != null
                                    ? test.
                            Name
                                    : "--",
                        Zone                   = _helpersvc.GetzonebyId(Convert.ToInt32(item.State.Zone)).Name,
                        BankName               = _helpersvc.Getbank(item.Provideraccount.BankId).Name,
                        BankName2              = item.Provideraccount2 != null?_helpersvc.Getbank(item.Provideraccount2.BankId).Name : "--",
                        CreatedDate            = item.CreatedOn.ToString("dd MMM yyyy"),
                        ProviderplansStr       = item.Providerplans,
                        ProviderservicesStr    = item.Providerservices,
                        ProvidertariffsStr     = item.ProviderTariffs,
                        AuthorizedDate         = item.AuthorizedDate,
                        category               = item.Category,
                        isdelisted             = item.isDelisted,
                        DelistNote             = item.DelistNote,
                        delistedBy             = item.delistedBy,
                        AuthorizedByString     = item.AuthorizedBy > 0 && authby != null ? authby.Name : "--",
                        AuthorizationStatusStr = Enum.GetName(typeof(AuthorizationStatus), item.AuthorizationStatus)
                    };

                    return(model);
                }
            }


            return(null);
        }