Exemplo n.º 1
0
        ///<summary>Creates security log entries for all that PatNums passed in.</summary>
        public static void MakeLogEntry(Permissions permType, List <long> listPatNums, string logText)
        {
            if (RemotingClient.RemotingRole == RemotingRole.ClientWeb)
            {
                Meth.GetVoid(MethodBase.GetCurrentMethod(), permType, listPatNums, logText);
                return;
            }
            List <SecurityLog> listSecLogs = new List <SecurityLog>();

            foreach (long patNum in listPatNums)
            {
                SecurityLog secLog = MakeLogEntryNoInsert(permType, patNum, logText, 0);
                SecurityLogs.Insert(secLog);
                listSecLogs.Add(secLog);
            }
            List <SecurityLogHash> listHash    = new List <SecurityLogHash>();
            List <EntryLog>        listEntries = new List <EntryLog>();

            listSecLogs = SecurityLogs.GetMany(SQLWhere.CreateIn(nameof(SecurityLog.SecurityLogNum),
                                                                 listSecLogs.Select(x => x.SecurityLogNum).ToList()));
            foreach (SecurityLog log in listSecLogs)
            {
                SecurityLogHash secLogHash = new SecurityLogHash();
                secLogHash.SecurityLogNum = log.SecurityLogNum;
                secLogHash.LogHash        = SecurityLogHashes.GetHashString(log);
                listHash.Add(secLogHash);
                if (log.PermType == Permissions.AppointmentCreate)
                {
                    listEntries.Add(new EntryLog(log.UserNum, EntryLogFKeyType.Appointment, log.FKey, log.LogSource));
                }
            }
            EntryLogs.InsertMany(listEntries);
            SecurityLogHashes.InsertMany(listHash);
        }
Exemplo n.º 2
0
        ///<summary>Updates the Schedule note with the number of sent and waiting to send AsapComms.</summary>
        public static void UpdateSchedule(long scheduleNum)
        {
            if (RemotingClient.RemotingRole == RemotingRole.ClientWeb)
            {
                Meth.GetVoid(MethodBase.GetCurrentMethod(), scheduleNum);
                return;
            }
            List <Schedule> listSchedules = Schedules.GetByScheduleNum(new List <long> {
                scheduleNum
            });

            if (listSchedules.Count == 0)
            {
                return;
            }
            Schedule        sched      = listSchedules[0];
            List <SQLWhere> listWheres = new List <SQLWhere> {
                SQLWhere.Create(nameof(AsapComm.ScheduleNum), ComparisonOperator.Equals, scheduleNum)
            };
            List <AsapComm> listAsapComms  = GetMany(listWheres);
            int             textsSent      = listAsapComms.Count(x => x.SmsSendStatus == AutoCommStatus.SendSuccessful);
            int             textsToBeSent  = listAsapComms.Count(x => x.SmsSendStatus == AutoCommStatus.SendNotAttempted);
            int             emailsSent     = listAsapComms.Count(x => x.EmailSendStatus == AutoCommStatus.SendSuccessful);
            int             emailsToBeSent = listAsapComms.Count(x => x.EmailSendStatus == AutoCommStatus.SendNotAttempted);

            sched.Note = textsSent + " " + Lans.g("ContrAppt", "text" + (textsSent == 1 ? "" : "s") + " sent,") + " "
                         + textsToBeSent + " " + Lans.g("ContrAppt", "text" + (textsToBeSent == 1 ? "" : "s") + " to be sent") + "\r\n"
                         + emailsSent + " " + Lans.g("ContrAppt", "email" + (emailsSent == 1 ? "" : "s") + " sent") + " "
                         + emailsToBeSent + " " + Lans.g("ContrAppt", "email" + (emailsToBeSent == 1 ? "" : "s") + " to be sent");
            Schedules.Update(sched);
        }
Exemplo n.º 3
0
 ///<summary>Gets a list of all AsapComms for the given patients.</summary>
 public static List <AsapComm> GetForPats(List <long> listPatNums)
 {
     if (RemotingClient.RemotingRole == RemotingRole.ClientWeb)
     {
         return(Meth.GetObject <List <AsapComm> >(MethodBase.GetCurrentMethod(), listPatNums));
     }
     return(GetMany(new List <SQLWhere> {
         SQLWhere.CreateIn(nameof(AsapComm.PatNum), listPatNums)
     }));
 }
Exemplo n.º 4
0
        ///<summary>Creates a NOT BETWEEN clause with the specified column and the specified values.</summary>
        public static SQLWhere CreateNotBetween <T>(string columnName, T valueLower, T valueHigher, bool doTreatDtAsDate = false, string tableName = "")
        {
            if (!string.IsNullOrEmpty(tableName))
            {
                columnName = tableName.ToLower() + "." + columnName;
            }
            SQLWhere sqlParam = new SQLWhere();

            sqlParam._whereClause = (doTreatDtAsDate ? DbHelper.DtimeToDate(columnName) : columnName)
                                    + " NOT BETWEEN " + POutObj(valueLower, doTreatDtAsDate) + " AND " + POutObj(valueHigher, doTreatDtAsDate) + "";
            return(sqlParam);
        }
Exemplo n.º 5
0
        ///<summary>Creates a SQLParam that evaluates the specified column with regards to the specified value.</summary>
        public static SQLWhere Create <T>(string columnName, ComparisonOperator comparison, T value, bool doTreatDtAsDate = false, string tableName = "")
        {
            if (!string.IsNullOrEmpty(tableName))
            {
                columnName = tableName.ToLower() + "." + columnName;
            }
            SQLWhere sqlParam = new SQLWhere();

            sqlParam._whereClause = (doTreatDtAsDate ? DbHelper.DtimeToDate(columnName) : columnName)
                                    + comparison.GetDescription() + POutObj(value, doTreatDtAsDate);
            return(sqlParam);
        }
Exemplo n.º 6
0
        ///<summary>Creates a NOT IN clause using the specified column and the specified values.</summary>
        public static SQLWhere CreateNotIn <T>(string columnName, List <T> listValues, bool doTreatDtAsDate = false, string tableName = "")
        {
            if (!string.IsNullOrEmpty(tableName))
            {
                columnName = tableName.ToLower() + "." + columnName;
            }
            SQLWhere sqlParam = new SQLWhere();

            if (listValues.Count == 0)
            {
                sqlParam._whereClause = " TRUE ";
            }
            else
            {
                sqlParam._whereClause = (doTreatDtAsDate ? DbHelper.DtimeToDate(columnName) : columnName)
                                        + " NOT IN (" + string.Join(",", listValues.Select(x => POutObj(x, doTreatDtAsDate))) + ")";
            }
            return(sqlParam);
        }