///<summary>Used when printing or emailing recall to make a commlog entry without any display. Only set isWebSched to true if this is a commlog associated to the GWT Web Sched app.</summary> public static void InsertForRecall(long patNum,CommItemMode _mode,int numberOfReminders,long defNumNewStatus,bool isWebSched,long userNum) { if(RemotingClient.RemotingRole==RemotingRole.ClientWeb) { Meth.GetVoid(MethodBase.GetCurrentMethod(),patNum,_mode,numberOfReminders,defNumNewStatus,isWebSched,userNum); return; } long recallType=Commlogs.GetTypeAuto(CommItemTypeAuto.RECALL); string command; string datesql="CURDATE()"; if(DataConnection.DBtype==DatabaseType.Oracle){ datesql="(SELECT CURRENT_DATE FROM dual)"; } if(recallType!=0){ command="SELECT COUNT(*) FROM commlog WHERE "; command+=DbHelper.DtimeToDate("CommDateTime")+" = "+datesql; command+=" AND PatNum="+POut.Long(patNum)+" AND CommType="+POut.Long(recallType) +" AND Mode_="+POut.Long((int)_mode) +" AND SentOrReceived=1"; if(Db.GetCount(command)!="0"){ return; } } Commlog com=new Commlog(); com.PatNum=patNum; com.CommDateTime=DateTime.Now; com.CommType=recallType; com.Mode_=_mode; com.SentOrReceived=CommSentOrReceived.Sent; com.Note=""; if(numberOfReminders==0){ com.Note=Lans.g("FormRecallList","Recall reminder."); } else if(numberOfReminders==1) { com.Note=Lans.g("FormRecallList","Second recall reminder."); } else if(numberOfReminders==2) { com.Note=Lans.g("FormRecallList","Third recall reminder."); } else { com.Note=Lans.g("FormRecallList","Recall reminder:")+" "+(numberOfReminders+1).ToString(); } if(defNumNewStatus==0) { com.Note+=" "+Lans.g("Commlogs","Status None"); } else { com.Note+=" "+DefC.GetName(DefCat.RecallUnschedStatus,defNumNewStatus); } com.UserNum=userNum; com.IsWebSched=isWebSched; 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); }
///<summary>Used when printing or emailing recall to make a commlog entry without any display.</summary> public static void InsertForRecall(long patNum, CommItemMode _mode, int numberOfReminders, long defNumNewStatus) { if (RemotingClient.RemotingRole == RemotingRole.ClientWeb) { Meth.GetVoid(MethodBase.GetCurrentMethod(), patNum, _mode, numberOfReminders, defNumNewStatus); return; } long recallType = Commlogs.GetTypeAuto(CommItemTypeAuto.RECALL); string command; string datesql = "CURDATE()"; if (DataConnection.DBtype == DatabaseType.Oracle) { datesql = "(SELECT CURRENT_DATE FROM dual)"; } if (recallType != 0) { command = "SELECT COUNT(*) FROM commlog WHERE "; command += DbHelper.DateColumn("CommDateTime") + " = " + datesql; command += " AND PatNum=" + POut.Long(patNum) + " AND CommType=" + POut.Long(recallType) + " AND Mode_=" + POut.Long((int)_mode) + " AND SentOrReceived=1"; if (Db.GetCount(command) != "0") { return; } } Commlog com = new Commlog(); com.PatNum = patNum; com.CommDateTime = DateTime.Now; com.CommType = recallType; com.Mode_ = _mode; com.SentOrReceived = CommSentOrReceived.Sent; com.Note = ""; if (numberOfReminders == 0) { com.Note = Lans.g("FormRecallList", "Recall reminder."); } else if (numberOfReminders == 1) { com.Note = Lans.g("FormRecallList", "Second recall reminder."); } else if (numberOfReminders == 2) { com.Note = Lans.g("FormRecallList", "Third recall reminder."); } else { com.Note = Lans.g("FormRecallList", "Recall reminder:") + " " + (numberOfReminders + 1).ToString(); } if (defNumNewStatus == 0) { com.Note += " " + Lans.g("Commlogs", "Status None"); } else { com.Note += " " + DefC.GetName(DefCat.RecallUnschedStatus, defNumNewStatus); } com.UserNum = Security.CurUser.UserNum; Insert(com); }
///<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 InsertForRecall(long patNum, CommItemMode _mode, int numberOfReminders, long defNumNewStatus, CommItemSource commSource, long userNum, DateTime dateTimeNow) { if (RemotingClient.RemotingRole == RemotingRole.ClientWeb) { return(Meth.GetObject <Commlog>(MethodBase.GetCurrentMethod(), patNum, _mode, numberOfReminders, defNumNewStatus, commSource, userNum, dateTimeNow)); } long recallType = Commlogs.GetTypeAuto(CommItemTypeAuto.RECALL); string command; string datesql = "CURDATE()"; if (DataConnection.DBtype == DatabaseType.Oracle) { datesql = "(SELECT CURRENT_DATE FROM dual)"; } if (recallType != 0) { command = "SELECT * FROM commlog WHERE "; command += DbHelper.DtimeToDate("CommDateTime") + " = " + datesql; command += " AND PatNum=" + POut.Long(patNum) + " AND CommType=" + POut.Long(recallType) + " 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 = recallType; com.Mode_ = _mode; com.SentOrReceived = CommSentOrReceived.Sent; com.Note = ""; if (numberOfReminders == 0) { com.Note = Lans.g("FormRecallList", "Recall reminder."); } else if (numberOfReminders == 1) { com.Note = Lans.g("FormRecallList", "Second recall reminder."); } else if (numberOfReminders == 2) { com.Note = Lans.g("FormRecallList", "Third recall reminder."); } else { com.Note = Lans.g("FormRecallList", "Recall 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); }
///<summary>Used when printing or emailing recall to make a commlog entry without any display.</summary> public static void InsertForRecall(long patNum, CommItemMode _mode, int numberOfReminders, long defNumNewStatus) { //No need to check RemotingRole; no call to db. InsertForRecall(patNum, _mode, numberOfReminders, defNumNewStatus, CommItemSource.User, Security.CurUser.UserNum //Recall commlog not associated to the Web Sched app. , DateTime.Now); }
///<summary>Used when printing or emailing recall to make a commlog entry without any display.</summary> public static void InsertForRecall(long patNum,CommItemMode _mode,int numberOfReminders,long defNumNewStatus) { //No need to check RemotingRole; no call to db. InsertForRecall(patNum,_mode,numberOfReminders,defNumNewStatus,false,Security.CurUser.UserNum);//Recall commlog not associated to the Web Sched app. }
public static Commlog CreateCommlog(long patNum, string text = "", DateTime commDateTime = default(DateTime), CommSentOrReceived sentOrReceived = CommSentOrReceived.Sent, CommItemMode itemMode = CommItemMode.None) { Commlog commlog = new Commlog { CommDateTime = commDateTime.Year > 1880 ? commDateTime : DateTime.Now, Mode_ = itemMode, Note = text, PatNum = patNum, SentOrReceived = sentOrReceived, }; Commlogs.Insert(commlog); return(commlog); }