Пример #1
0
        ///<summary>Deletes any patrestrictions for the specified patient and type.</summary>
        public static void RemovePatRestriction(long patNum, PatRestrict patRestrictType)
        {
            if (RemotingClient.RemotingRole == RemotingRole.ClientWeb)
            {
                Meth.GetVoid(MethodBase.GetCurrentMethod(), patNum, patRestrictType);
                return;
            }
            string command = "DELETE FROM patrestriction WHERE PatNum=" + POut.Long(patNum) + " AND PatRestrictType=" + POut.Int((int)patRestrictType);

            Db.NonQ(command);
            return;
        }
Пример #2
0
        ///<summary>Gets the human readable description of the patrestriction, passed through Lans.g.
        ///Returns empty string if the enum was not found in the switch statement.</summary>
        public static string GetPatRestrictDesc(PatRestrict patRestrictType)
        {
            switch (patRestrictType)
            {
            case PatRestrict.ApptSchedule:
                return(Lans.g("patRestrictEnum", "Appointment Scheduling"));

            case PatRestrict.None:
            default:
                return("");
            }
        }
Пример #3
0
 ///<summary>Checks for an existing patrestriction for the specified patient and PatRestrictType. If one exists returns true.
 ///boolean to suppress or show message. If suppress message is false, will display msgbox.</summary>
 public static bool IsRestricted(long patNum, PatRestrict patRestrictType, bool suppressMessage = false)
 {
     if (PatRestrictions.IsRestricted(patNum, patRestrictType))
     {
         if (!suppressMessage)
         {
             MessageBox.Show(Lans.g("PatRestrictions", "Not allowed due to patient restriction") + "\r\n" + PatRestrictions.GetPatRestrictDesc(patRestrictType));
         }
         return(true);
     }
     else
     {
         return(false);
     }
 }
Пример #4
0
        ///<summary>Checks for an existing patrestriction for the specified patient and PatRestrictType.
        ///If one exists, returns true (IsRestricted).  If none exist, returns false (!IsRestricted).</summary>
        public static bool IsRestricted(long patNum, PatRestrict patRestrictType)
        {
            if (RemotingClient.RemotingRole == RemotingRole.ClientWeb)
            {
                return(Meth.GetBool(MethodBase.GetCurrentMethod(), patNum, patRestrictType));
            }
            string command = "SELECT COUNT(*) FROM patrestriction WHERE PatNum=" + POut.Long(patNum) + " AND PatRestrictType=" + POut.Int((int)patRestrictType);

            if (PIn.Int(Db.GetCount(command)) > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Пример #5
0
        ///<summary>This will only insert a new PatRestriction if there is not already an existing PatRestriction in the db for this patient and type.
        ///If exists, returns the PatRestrictionNum of the first one found.  Otherwise returns the PatRestrictionNum of the newly inserted one.</summary>
        public static long Upsert(long patNum, PatRestrict patRestrictType)
        {
            if (RemotingClient.RemotingRole == RemotingRole.ClientWeb)
            {
                return(Meth.GetLong(MethodBase.GetCurrentMethod(), patNum, patRestrictType));
            }
            List <PatRestriction> listPatRestricts = GetAllForPat(patNum).FindAll(x => x.PatRestrictType == patRestrictType);

            if (listPatRestricts.Count > 0)
            {
                return(listPatRestricts[0].PatRestrictionNum);
            }
            return(Crud.PatRestrictionCrud.Insert(new PatRestriction()
            {
                PatNum = patNum, PatRestrictType = patRestrictType
            }));
        }