Ejemplo n.º 1
0
 ///<Summary>Returns a defnum.  If no match, then it returns the first one in the list in that category.</Summary>
 public static long GetTypeAuto(CommItemTypeAuto typeauto)
 {
     //No need to check RemotingRole; no call to db.
     for(int i=0;i<DefC.Long[(int)DefCat.CommLogTypes].Length;i++){
         if(DefC.Long[(int)DefCat.CommLogTypes][i].ItemValue==typeauto.ToString()){
             return DefC.Long[(int)DefCat.CommLogTypes][i].DefNum;
         }
     }
     if(DefC.Long[(int)DefCat.CommLogTypes].Length>0){
         return DefC.Long[(int)DefCat.CommLogTypes][0].DefNum;
     }
     return 0;
 }
Ejemplo n.º 2
0
 ///<Summary>Returns a defnum.  If no match, then it returns the first one in the list in that category.</Summary>
 public static int GetTypeAuto(CommItemTypeAuto typeauto)
 {
     for (int i = 0; i < DefB.Long[(int)DefCat.CommLogTypes].Length; i++)
     {
         if (DefB.Long[(int)DefCat.CommLogTypes][i].ItemValue == typeauto.ToString())
         {
             return(DefB.Long[(int)DefCat.CommLogTypes][i].DefNum);
         }
     }
     if (DefB.Long[(int)DefCat.CommLogTypes].Length > 0)
     {
         return(DefB.Long[(int)DefCat.CommLogTypes][0].DefNum);
     }
     return(0);
 }
Ejemplo n.º 3
0
 ///<Summary>Returns a defnum.  If no match, then it returns the first one in the list in that category.</Summary>
 public static long GetTypeAuto(CommItemTypeAuto typeauto)
 {
     //No need to check RemotingRole; no call to db.
     for (int i = 0; i < DefC.Long[(int)DefCat.CommLogTypes].Length; i++)
     {
         if (DefC.Long[(int)DefCat.CommLogTypes][i].ItemValue == typeauto.ToString())
         {
             return(DefC.Long[(int)DefCat.CommLogTypes][i].DefNum);
         }
     }
     if (DefC.Long[(int)DefCat.CommLogTypes].Length > 0)
     {
         return(DefC.Long[(int)DefCat.CommLogTypes][0].DefNum);
     }
     return(0);
 }
Ejemplo n.º 4
0
        ///<Summary>Returns a defnum.  If no match, then it returns the first one in the list in that category.
        ///If there are no defs in the category, 0 is returned.</Summary>
        public static long GetTypeAuto(CommItemTypeAuto typeauto)
        {
            //No need to check RemotingRole; no call to db.
            List <Def> listDefs = Defs.GetDefsForCategory(DefCat.CommLogTypes);
            Def        def      = listDefs.FirstOrDefault(x => x.ItemValue == typeauto.ToString());

            if (def != null)
            {
                return(def.DefNum);
            }
            if (listDefs.Count > 0)
            {
                return(listDefs[0].DefNum);
            }
            return(0);
        }
Ejemplo n.º 5
0
        ///<summary>Used when printing or emailing recall to make a commlog entry without any display.
        ///Set commSource to the corresponding entity that is making this recall.  E.g. Web Sched.
        ///If the commSource is a 3rd party, set it to ProgramLink and make an overload that accepts the ProgramNum.</summary>
        public static Commlog InsertForRecallOrReactivation(long patNum, CommItemMode _mode, int numberOfReminders, long defNumNewStatus, CommItemSource commSource, long userNum, DateTime dateTimeNow, CommItemTypeAuto type = CommItemTypeAuto.RECALL)
        {
            if (RemotingClient.RemotingRole == RemotingRole.ClientWeb)
            {
                return(Meth.GetObject <Commlog>(MethodBase.GetCurrentMethod(), patNum, _mode, numberOfReminders, defNumNewStatus, commSource, userNum,
                                                dateTimeNow, type));
            }
            long   commType    = Commlogs.GetTypeAuto(type);
            string commTypeStr = type == CommItemTypeAuto.RECALL?"Recall":"Reactivation";
            string command;
            string datesql = "CURDATE()";

            if (DataConnection.DBtype == DatabaseType.Oracle)
            {
                datesql = "(SELECT CURRENT_DATE FROM dual)";
            }
            if (commType != 0)
            {
                command  = "SELECT * FROM commlog WHERE ";
                command += DbHelper.DtimeToDate("CommDateTime") + " = " + datesql;
                command += " AND PatNum=" + POut.Long(patNum) + " AND CommType=" + POut.Long(commType)
                           + " AND Mode_=" + POut.Long((int)_mode)
                           + " AND SentOrReceived=1";
                List <Commlog> listComms = Crud.CommlogCrud.SelectMany(command).OrderByDescending(x => x.CommDateTime).ToList();
                if (listComms.Count > 0)
                {
                    return(listComms[0]);
                }
            }
            Commlog com = new Commlog();

            com.PatNum         = patNum;
            com.CommDateTime   = dateTimeNow;
            com.CommType       = commType;
            com.Mode_          = _mode;
            com.SentOrReceived = CommSentOrReceived.Sent;
            com.Note           = "";
            if (numberOfReminders == 0)
            {
                com.Note = Lans.g("FormRecallList", $"{commTypeStr} reminder.");
            }
            else if (numberOfReminders == 1)
            {
                com.Note = Lans.g("FormRecallList", $"Second {commTypeStr} reminder.");
            }
            else if (numberOfReminders == 2)
            {
                com.Note = Lans.g("FormRecallList", $"Third {commTypeStr} reminder.");
            }
            else
            {
                com.Note = Lans.g("FormRecallList", $"{commTypeStr} reminder:") + " " + (numberOfReminders + 1).ToString();
            }
            if (defNumNewStatus == 0)
            {
                com.Note += "  " + Lans.g("Commlogs", "Status None");
            }
            else
            {
                com.Note += "  " + Defs.GetName(DefCat.RecallUnschedStatus, defNumNewStatus);
            }
            com.UserNum    = userNum;
            com.CommSource = commSource;
            com.CommlogNum = Insert(com);
            EhrMeasureEvent newMeasureEvent = new EhrMeasureEvent();

            newMeasureEvent.DateTEvent = com.CommDateTime;
            newMeasureEvent.EventType  = EhrMeasureEventType.ReminderSent;
            newMeasureEvent.PatNum     = com.PatNum;
            newMeasureEvent.MoreInfo   = com.Note;
            EhrMeasureEvents.Insert(newMeasureEvent);
            return(com);
        }
Ejemplo n.º 6
0
 ///<summary>Used when printing or emailing recall to make a commlog entry without any display.</summary>
 public static void InsertForRecallOrReactivation(long patNum, CommItemMode _mode, int numberOfReminders, long defNumNewStatus, CommItemTypeAuto type = CommItemTypeAuto.RECALL)
 {
     //No need to check RemotingRole; no call to db.
     InsertForRecallOrReactivation(patNum, _mode, numberOfReminders, defNumNewStatus, CommItemSource.User, Security.CurUser.UserNum       //Recall commlog not associated to the Web Sched app.
                                   , DateTime.Now, type);
 }