Example #1
0
        ///<summary>A list item per each clinic indicating the number of messages which have not yet been read for that clinic (practice).
        ///Inserts a new InvalidType.SmsTextMsgReceivedUnreadCount signal.</summary>
        public static List <SmsNotification> UpdateSmsNotification()
        {
            if (RemotingClient.RemotingRole == RemotingRole.ClientWeb)
            {
                return(Meth.GetObject <List <SmsNotification> >(MethodBase.GetCurrentMethod()));
            }
            string command             = "SELECT ClinicNum,COUNT(*) AS CountUnread FROM smsfrommobile WHERE SmsStatus=0 GROUP BY ClinicNum";
            List <SmsNotification> ret = Db.GetTable(command).AsEnumerable()
                                         .Select(x => new SmsNotification()
            {
                ClinicNum = PIn.Long(x["ClinicNum"].ToString()),
                Count     = PIn.Int(x["CountUnread"].ToString()),
            }).ToList();

            //Insert as structured data signal so all workstations won't have to query the db to get the counts. They will get it directly from Signalod.MsgValue.
            Signalods.InsertSmsNotification(SmsNotification.GetJsonFromList(ret));
            return(ret);
        }