Exemple #1
0
        /// <summary>Load the preferences from the session. If it is not found in the session it's loaded from the database</summary>
        public static PrefmC LoadPreferences()
        {
            PrefmC prefmc = (PrefmC)HttpContext.Current.Session["prefmC"];

            if (prefmc == null)
            {
                if (HttpContext.Current.Session["Patient"] != null)
                {
                    long DentalOfficeID = ((Patientm)HttpContext.Current.Session["Patient"]).CustomerNum;
                    prefmc = LoadPreferences(DentalOfficeID);
                }
            }
            return(prefmc);
        }
Exemple #2
0
 public Dictionary <string, Prefm> Dict = new Dictionary <string, Prefm>();  // cannot have a static variable here because we want something unique for each patient.
 ///<summary>Gets a pref of type string.</summary>
 public static string GetString(PrefmName prefmName)
 {
     try {
         PrefmC prefmC = Prefms.LoadPreferences();
         if (!prefmC.Dict.ContainsKey(prefmName.ToString()))
         {
             throw new Exception(prefmName + " is an invalid pref name.");
         }
         return(prefmC.Dict[prefmName.ToString()].ValueString);
     }
     catch (Exception ex) {
         return("");
     }
 }
Exemple #3
0
			public static PrefmC LoadPreferences(long customerNum) {
				string command="SELECT * FROM preferencem WHERE CustomerNum = "+POut.Long(customerNum); 
				DataTable table=Db.GetTable(command);
				Prefm prefm=new Prefm(); 
				PrefmC prefmc=new PrefmC();
				for(int i=0;i<table.Rows.Count;i++) {
					prefm=new Prefm();
					if(table.Columns.Contains("PrefNum")) {
						prefm.PrefNum=PIn.Long(table.Rows[i]["PrefNum"].ToString());
					}
					prefm.PrefmName=PIn.String(table.Rows[i]["PrefName"].ToString());
					prefm.ValueString=PIn.String(table.Rows[i]["ValueString"].ToString());
					prefmc.Dict.Add(prefm.PrefmName,prefm);
				}
				HttpContext.Current.Session["prefmC"]=prefmc;
				return prefmc;
			}
Exemple #4
0
        public static PrefmC LoadPreferences(long customerNum)
        {
            string    command = "SELECT * FROM preferencem WHERE CustomerNum = " + POut.Long(customerNum);
            DataTable table   = Db.GetTable(command);
            Prefm     prefm   = new Prefm();
            PrefmC    prefmc  = new PrefmC();

            for (int i = 0; i < table.Rows.Count; i++)
            {
                prefm = new Prefm();
                if (table.Columns.Contains("PrefNum"))
                {
                    prefm.PrefNum = PIn.Long(table.Rows[i]["PrefNum"].ToString());
                }
                prefm.PrefmName   = PIn.String(table.Rows[i]["PrefName"].ToString());
                prefm.ValueString = PIn.String(table.Rows[i]["ValueString"].ToString());
                prefmc.Dict.Add(prefm.PrefmName, prefm);
            }
            HttpContext.Current.Session["prefmC"] = prefmc;
            return(prefmc);
        }