/// <summary> /// US:864 US:876 loads a dropdown list with patient checklists, will screen out /// check lists that the user does not have view permissions for. /// </summary> /// <param name="BaseMastr"></param> /// <param name="strPatientID"></param> /// <param name="ddl"></param> /// <returns></returns> public CStatus LoadPatientChecklists(CBaseMaster BaseMstr, string strPatientID, DropDownList ddl) { CPatientChecklistLogic pcl = new CPatientChecklistLogic(BaseMstr.BaseData); CStatus status = pcl.RunLogic(strPatientID); if (!status.Status) { return(status); } CPatChecklistData pc = new CPatChecklistData(BaseMstr.BaseData); DataSet ds = null; status = pc.GetPatChecklistDS(strPatientID, out ds); if (!status.Status) { return(status); } //remove records from the ds that the user is not allowed to view foreach (DataTable table in ds.Tables) { foreach (DataRow dr in table.Rows) { long lChecklistID = CDataUtils.GetDSLongValue(dr, "CHECKLIST_ID"); CChecklistPermissionsDataItem pdi = null; CChecklistData clData = new CChecklistData(BaseMstr.BaseData); clData.GetCheckListPermissionsDI(lChecklistID, out pdi); //is the user allowed to view this checklist if (!pdi.HasPermission(BaseMstr.AppUser, k_CHECKLIST_PERMISSION.Viewable)) { dr.Delete(); } } } ds.AcceptChanges(); //render the dataset status = CDropDownList.RenderDataSet( ds, ddl, "CHECKLIST_LABEL", "PAT_CL_ID"); if (!status.Status) { return(status); } return(new CStatus()); }
/// <summary> /// do the actual work of assigning the checklist /// </summary> /// <param name="state"></param> public void DoWork(Object state) { //thread hashcount work lock (HashCount) { if (!HashCount.ContainsKey(Thread.CurrentThread.GetHashCode())) { HashCount.Add(Thread.CurrentThread.GetHashCode(), 0); } HashCount[Thread.CurrentThread.GetHashCode()] = ((int)HashCount[Thread.CurrentThread.GetHashCode()]) + 1; } //create a new connection for the thread CDataDBConn conn = new CDataDBConn(); conn.Connect(); CData data = new CData(conn, this.ClientIP, this.UserID, this.SessionID, this.WebSession, this.MDWSTransfer); //do real work here CPatientChecklistLogic pcll = new CPatientChecklistLogic(data); Status = pcll.RunLogic(PatientChecklistID); //cleanup the database connection conn.Close(); //signals we are done. Interlocked.Increment(ref ThreadCount); if (ThreadCount == ThreadMax) { if (eventX != null) { eventX.Set(); ThreadCount = 0; ThreadMax = 0; } } }
/// <summary> /// do the actual work of assigning the checklist /// </summary> /// <param name="state"></param> public void DoWork(Object state) { //thread hashcount work lock (HashCount) { if (!HashCount.ContainsKey(Thread.CurrentThread.GetHashCode())) { HashCount.Add(Thread.CurrentThread.GetHashCode(), 0); } HashCount[Thread.CurrentThread.GetHashCode()] = ((int)HashCount[Thread.CurrentThread.GetHashCode()]) + 1; } //do the real work here ////////////////////////////////////////////////////////////// //create a new connection for the thread CDataDBConn conn = new CDataDBConn(); conn.Connect(); CData data = new CData( conn, this.ClientIP, this.UserID, this.SessionID, this.WebSession, this.MDWSTransfer); CPatChecklistData pcl = new CPatChecklistData(data); string strPatientID = PatientID; CPatChecklistDataItem di = new CPatChecklistDataItem(); di.ProcedureDate = CDataUtils.GetNullDate(); di.AssignmentDate = DateTime.Now; di.ChecklistID = ChecklistID; di.ChecklistStateID = k_CHECKLIST_STATE_ID.Open; di.PatientID = strPatientID; di.StateID = k_STATE_ID.Unknown; long lPatCLID = 0; Status = pcl.InsertPatChecklist(di, out lPatCLID); if (Status.Status) { if (MDWSTransfer) { //talk to the communicator to update the //patient checklist from mdws CCommunicator com = new CCommunicator(); Status = com.RefreshPatientCheckList( conn, data, strPatientID, lPatCLID); } if (Status.Status) { CPatientChecklistLogic pcll = new CPatientChecklistLogic(data); Status = pcll.RunLogic(lPatCLID); } } //cleanup the database connection conn.Close(); //signals we are done. Interlocked.Increment(ref ThreadCount); if (ThreadCount == ThreadMax) { if (eventX != null) { eventX.Set(); ThreadCount = 0; ThreadMax = 0; } } }