Exemplo n.º 1
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 "";
			}
		}
Exemplo n.º 2
0
			///<summary>Returns true if a change was required, or false if no change needed. This method is no longer used and may be deleted later. Dennis Mathew: Dec 24, 2011</summary>
			public void UpdateString(long customerNum,PrefmName prefmName,string newValue) {
				string command="SELECT * FROM preferencem "
					+"WHERE CustomerNum =" +POut.Long(customerNum)+" AND PrefName = '"+POut.String(prefmName.ToString())+"'";
				DataTable table=Db.GetTable(command);
				if(table.Rows.Count>0) {
					command = "UPDATE preferencem SET "
					+"ValueString = '"+POut.String(newValue)+"' "
					+"WHERE CustomerNum =" +POut.Long(customerNum)+" AND PrefName = '"+POut.String(prefmName.ToString())+"'";
					Db.NonQ(command);
				}
				else {
					command = "INSERT into preferencem " 
					+"(CustomerNum,PrefName,ValueString) VALUES "
					+"("+POut.Long(customerNum)+",'"+POut.String(prefmName.ToString())+"','"+POut.String(newValue)+"')";
					Db.NonQ(command);
				}
			}