///<summary>Updates one ComputerPref in the database.</summary> public static void Update(ComputerPref computerPref) { string command = "UPDATE computerpref SET " + "ComputerName = '" + POut.String(computerPref.ComputerName) + "', " + "GraphicsUseHardware = " + POut.Bool(computerPref.GraphicsUseHardware) + ", " + "GraphicsSimple = " + POut.Int((int)computerPref.GraphicsSimple) + ", " + "SensorType = '" + POut.String(computerPref.SensorType) + "', " + "SensorBinned = " + POut.Bool(computerPref.SensorBinned) + ", " + "SensorPort = " + POut.Int(computerPref.SensorPort) + ", " + "SensorExposure = " + POut.Int(computerPref.SensorExposure) + ", " + "GraphicsDoubleBuffering= " + POut.Bool(computerPref.GraphicsDoubleBuffering) + ", " + "PreferredPixelFormatNum= " + POut.Int(computerPref.PreferredPixelFormatNum) + ", " + "AtoZpath = '" + POut.String(computerPref.AtoZpath) + "', " + "TaskKeepListHidden = " + POut.Bool(computerPref.TaskKeepListHidden) + ", " + "TaskDock = " + POut.Int(computerPref.TaskDock) + ", " + "TaskX = " + POut.Int(computerPref.TaskX) + ", " + "TaskY = " + POut.Int(computerPref.TaskY) + ", " + "DirectXFormat = '" + POut.String(computerPref.DirectXFormat) + "', " + "RecentApptView = " + POut.Byte(computerPref.RecentApptView) + ", " + "ScanDocSelectSource = " + POut.Bool(computerPref.ScanDocSelectSource) + ", " + "ScanDocShowOptions = " + POut.Bool(computerPref.ScanDocShowOptions) + ", " + "ScanDocDuplex = " + POut.Bool(computerPref.ScanDocDuplex) + ", " + "ScanDocGrayscale = " + POut.Bool(computerPref.ScanDocGrayscale) + ", " + "ScanDocResolution = " + POut.Int(computerPref.ScanDocResolution) + ", " + "ScanDocQuality = " + POut.Byte(computerPref.ScanDocQuality) + " " + "WHERE ComputerPrefNum = " + POut.Long(computerPref.ComputerPrefNum); Db.NonQ(command); }
///<summary>Inserts the given preference and ensures that the primary key is properly set.</summary> public static void Insert(ComputerPref computerPref) { if (PrefB.RandomKeys) { computerPref.ComputerPrefNum = MiscData.GetKey("computerpref", "ComputerPrefNum"); } string command = "INSERT INTO computerpref ("; if (PrefB.RandomKeys) { command += "ComputerPrefNum,"; } command += "ComputerName,GraphicsUseHardware,GraphicsSimple,SensorType,SensorPort,SensorExposure,SensorBinned,GraphicsDoubleBuffering,PreferredPixelFormatNum) VALUES("; if (PrefB.RandomKeys) { command += "'" + POut.PInt(computerPref.ComputerPrefNum) + "',"; } command += "'" + POut.PString(computerPref.ComputerName) + "'," + "'" + POut.PBool(computerPref.GraphicsUseHardware) + "'," + "'" + POut.PBool(computerPref.GraphicsSimple) + "'," + "'" + POut.PString(computerPref.SensorType) + "'," + "'" + POut.PBool(computerPref.SensorBinned) + "'," + "'" + POut.PInt(computerPref.SensorPort) + "'," + "'" + POut.PInt(computerPref.SensorExposure) + "'," + "'" + POut.PBool(computerPref.GraphicsDoubleBuffering) + "'," + "'" + POut.PInt(computerPref.PreferredPixelFormatNum) + "')"; if (PrefB.RandomKeys) { General.NonQ(command); } else { computerPref.ComputerPrefNum = General.NonQ(command, true); } }
private void butOK_Click(object sender, System.EventArgs e) { OpenGLWinFormsControl contextTester = new OpenGLWinFormsControl(); try { if (contextTester.TaoInitializeContexts(selectedFormatNum) != selectedFormatNum) { throw new Exception(Lan.g(this, "Could not initialize pixel format ") + selectedFormatNum.ToString() + "."); } } catch (Exception ex) { MessageBox.Show(Lan.g(this, "Please choose a different pixel format, the selected pixel format will not support the 3D tooth chart on this computer: " + ex.Message)); contextTester.Dispose(); return; } contextTester.Dispose(); ComputerPref computerPref = ComputerPrefs.GetForLocalComputer(); computerPref.GraphicsUseHardware = checkHardwareAccel.Checked; computerPref.GraphicsSimple = radioSimpleChart.Checked; computerPref.GraphicsDoubleBuffering = checkDoubleBuffering.Checked; computerPref.PreferredPixelFormatNum = selectedFormatNum; ComputerPrefs.Update(computerPref); DialogResult = DialogResult.OK; }
///<summary>Converts a DataTable to a list of objects.</summary> public static List<ComputerPref> TableToList(DataTable table){ List<ComputerPref> retVal=new List<ComputerPref>(); ComputerPref computerPref; for(int i=0;i<table.Rows.Count;i++) { computerPref=new ComputerPref(); computerPref.ComputerPrefNum = PIn.Long (table.Rows[i]["ComputerPrefNum"].ToString()); computerPref.ComputerName = PIn.String(table.Rows[i]["ComputerName"].ToString()); computerPref.GraphicsUseHardware = PIn.Bool (table.Rows[i]["GraphicsUseHardware"].ToString()); computerPref.GraphicsSimple = (OpenDentBusiness.DrawingMode)PIn.Int(table.Rows[i]["GraphicsSimple"].ToString()); computerPref.SensorType = PIn.String(table.Rows[i]["SensorType"].ToString()); computerPref.SensorBinned = PIn.Bool (table.Rows[i]["SensorBinned"].ToString()); computerPref.SensorPort = PIn.Int (table.Rows[i]["SensorPort"].ToString()); computerPref.SensorExposure = PIn.Int (table.Rows[i]["SensorExposure"].ToString()); computerPref.GraphicsDoubleBuffering= PIn.Bool (table.Rows[i]["GraphicsDoubleBuffering"].ToString()); computerPref.PreferredPixelFormatNum= PIn.Int (table.Rows[i]["PreferredPixelFormatNum"].ToString()); computerPref.AtoZpath = PIn.String(table.Rows[i]["AtoZpath"].ToString()); computerPref.TaskKeepListHidden = PIn.Bool (table.Rows[i]["TaskKeepListHidden"].ToString()); computerPref.TaskDock = PIn.Int (table.Rows[i]["TaskDock"].ToString()); computerPref.TaskX = PIn.Int (table.Rows[i]["TaskX"].ToString()); computerPref.TaskY = PIn.Int (table.Rows[i]["TaskY"].ToString()); computerPref.DirectXFormat = PIn.String(table.Rows[i]["DirectXFormat"].ToString()); computerPref.ScanDocSelectSource = PIn.Bool (table.Rows[i]["ScanDocSelectSource"].ToString()); computerPref.ScanDocShowOptions = PIn.Bool (table.Rows[i]["ScanDocShowOptions"].ToString()); computerPref.ScanDocDuplex = PIn.Bool (table.Rows[i]["ScanDocDuplex"].ToString()); computerPref.ScanDocGrayscale = PIn.Bool (table.Rows[i]["ScanDocGrayscale"].ToString()); computerPref.ScanDocResolution = PIn.Int (table.Rows[i]["ScanDocResolution"].ToString()); computerPref.ScanDocQuality = PIn.Byte (table.Rows[i]["ScanDocQuality"].ToString()); computerPref.ClinicNum = PIn.Long (table.Rows[i]["ClinicNum"].ToString()); computerPref.ApptViewNum = PIn.Long (table.Rows[i]["ApptViewNum"].ToString()); computerPref.RecentApptView = PIn.Byte (table.Rows[i]["RecentApptView"].ToString()); retVal.Add(computerPref); } return retVal; }
///<summary>Converts a DataTable to a list of objects.</summary> internal static List <ComputerPref> TableToList(DataTable table) { List <ComputerPref> retVal = new List <ComputerPref>(); ComputerPref computerPref; for (int i = 0; i < table.Rows.Count; i++) { computerPref = new ComputerPref(); computerPref.ComputerPrefNum = PIn.Long(table.Rows[i]["ComputerPrefNum"].ToString()); computerPref.ComputerName = PIn.String(table.Rows[i]["ComputerName"].ToString()); computerPref.GraphicsUseHardware = PIn.Bool(table.Rows[i]["GraphicsUseHardware"].ToString()); computerPref.GraphicsSimple = (DrawingMode)PIn.Int(table.Rows[i]["GraphicsSimple"].ToString()); computerPref.SensorType = PIn.String(table.Rows[i]["SensorType"].ToString()); computerPref.SensorBinned = PIn.Bool(table.Rows[i]["SensorBinned"].ToString()); computerPref.SensorPort = PIn.Int(table.Rows[i]["SensorPort"].ToString()); computerPref.SensorExposure = PIn.Int(table.Rows[i]["SensorExposure"].ToString()); computerPref.GraphicsDoubleBuffering = PIn.Bool(table.Rows[i]["GraphicsDoubleBuffering"].ToString()); computerPref.PreferredPixelFormatNum = PIn.Int(table.Rows[i]["PreferredPixelFormatNum"].ToString()); computerPref.AtoZpath = PIn.String(table.Rows[i]["AtoZpath"].ToString()); computerPref.TaskKeepListHidden = PIn.Bool(table.Rows[i]["TaskKeepListHidden"].ToString()); computerPref.TaskDock = PIn.Int(table.Rows[i]["TaskDock"].ToString()); computerPref.TaskX = PIn.Int(table.Rows[i]["TaskX"].ToString()); computerPref.TaskY = PIn.Int(table.Rows[i]["TaskY"].ToString()); computerPref.DirectXFormat = PIn.String(table.Rows[i]["DirectXFormat"].ToString()); computerPref.RecentApptView = PIn.Byte(table.Rows[i]["RecentApptView"].ToString()); retVal.Add(computerPref); } return(retVal); }
///<summary>Inserts one ComputerPref into the database. Returns the new priKey.</summary> internal static long Insert(ComputerPref computerPref) { if (DataConnection.DBtype == DatabaseType.Oracle) { computerPref.ComputerPrefNum = DbHelper.GetNextOracleKey("computerpref", "ComputerPrefNum"); int loopcount = 0; while (loopcount < 100) { try { return(Insert(computerPref, true)); } catch (Oracle.DataAccess.Client.OracleException ex) { if (ex.Number == 1 && ex.Message.ToLower().Contains("unique constraint") && ex.Message.ToLower().Contains("violated")) { computerPref.ComputerPrefNum++; loopcount++; } else { throw ex; } } } throw new ApplicationException("Insert failed. Could not generate primary key."); } else { return(Insert(computerPref, false)); } }
///<summary>Inserts one ComputerPref into the database. Returns the new priKey.</summary> internal static long Insert(ComputerPref computerPref) { if(DataConnection.DBtype==DatabaseType.Oracle) { computerPref.ComputerPrefNum=DbHelper.GetNextOracleKey("computerpref","ComputerPrefNum"); int loopcount=0; while(loopcount<100){ try { return Insert(computerPref,true); } catch(Oracle.DataAccess.Client.OracleException ex){ if(ex.Number==1 && ex.Message.ToLower().Contains("unique constraint") && ex.Message.ToLower().Contains("violated")){ computerPref.ComputerPrefNum++; loopcount++; } else{ throw ex; } } } throw new ApplicationException("Insert failed. Could not generate primary key."); } else { return Insert(computerPref,false); } }
///<summary>Inserts one ComputerPref into the database. Provides option to use the existing priKey. Doesn't use the cache.</summary> public static long InsertNoCache(ComputerPref computerPref, bool useExistingPK) { bool isRandomKeys = Prefs.GetBoolNoCache(PrefName.RandomPrimaryKeys); string command = "INSERT INTO computerpref ("; if (!useExistingPK && isRandomKeys) { computerPref.ComputerPrefNum = ReplicationServers.GetKeyNoCache("computerpref", "ComputerPrefNum"); } if (isRandomKeys || useExistingPK) { command += "ComputerPrefNum,"; } command += "ComputerName,GraphicsUseHardware,GraphicsSimple,SensorType,SensorBinned,SensorPort,SensorExposure,GraphicsDoubleBuffering,PreferredPixelFormatNum,AtoZpath,TaskKeepListHidden,TaskDock,TaskX,TaskY,DirectXFormat,ScanDocSelectSource,ScanDocShowOptions,ScanDocDuplex,ScanDocGrayscale,ScanDocResolution,ScanDocQuality,ClinicNum,ApptViewNum,RecentApptView,PatSelectSearchMode,NoShowLanguage,NoShowDecimal,ComputerOS,HelpButtonXAdjustment) VALUES("; if (isRandomKeys || useExistingPK) { command += POut.Long(computerPref.ComputerPrefNum) + ","; } command += "'" + POut.String(computerPref.ComputerName) + "'," + POut.Bool(computerPref.GraphicsUseHardware) + "," + POut.Int((int)computerPref.GraphicsSimple) + "," + "'" + POut.String(computerPref.SensorType) + "'," + POut.Bool(computerPref.SensorBinned) + "," + POut.Int(computerPref.SensorPort) + "," + POut.Int(computerPref.SensorExposure) + "," + POut.Bool(computerPref.GraphicsDoubleBuffering) + "," + POut.Int(computerPref.PreferredPixelFormatNum) + "," + "'" + POut.String(computerPref.AtoZpath) + "'," + POut.Bool(computerPref.TaskKeepListHidden) + "," + POut.Int(computerPref.TaskDock) + "," + POut.Int(computerPref.TaskX) + "," + POut.Int(computerPref.TaskY) + "," + "'" + POut.String(computerPref.DirectXFormat) + "'," + POut.Bool(computerPref.ScanDocSelectSource) + "," + POut.Bool(computerPref.ScanDocShowOptions) + "," + POut.Bool(computerPref.ScanDocDuplex) + "," + POut.Bool(computerPref.ScanDocGrayscale) + "," + POut.Int(computerPref.ScanDocResolution) + "," + POut.Byte(computerPref.ScanDocQuality) + "," + POut.Long(computerPref.ClinicNum) + "," + POut.Long(computerPref.ApptViewNum) + "," + POut.Byte(computerPref.RecentApptView) + "," + POut.Int((int)computerPref.PatSelectSearchMode) + "," + POut.Bool(computerPref.NoShowLanguage) + "," + POut.Bool(computerPref.NoShowDecimal) + "," + "'" + POut.String(computerPref.ComputerOS.ToString()) + "'," + "'" + POut.Double(computerPref.HelpButtonXAdjustment) + "')"; if (useExistingPK || isRandomKeys) { Db.NonQ(command); } else { computerPref.ComputerPrefNum = Db.NonQ(command, true, "ComputerPrefNum", "computerPref"); } return(computerPref.ComputerPrefNum); }
///<summary>Converts a DataTable to a list of objects.</summary> public static List <ComputerPref> TableToList(DataTable table) { List <ComputerPref> retVal = new List <ComputerPref>(); ComputerPref computerPref; foreach (DataRow row in table.Rows) { computerPref = new ComputerPref(); computerPref.ComputerPrefNum = PIn.Long(row["ComputerPrefNum"].ToString()); computerPref.ComputerName = PIn.String(row["ComputerName"].ToString()); computerPref.GraphicsUseHardware = PIn.Bool(row["GraphicsUseHardware"].ToString()); computerPref.GraphicsSimple = (OpenDentBusiness.DrawingMode)PIn.Int(row["GraphicsSimple"].ToString()); computerPref.SensorType = PIn.String(row["SensorType"].ToString()); computerPref.SensorBinned = PIn.Bool(row["SensorBinned"].ToString()); computerPref.SensorPort = PIn.Int(row["SensorPort"].ToString()); computerPref.SensorExposure = PIn.Int(row["SensorExposure"].ToString()); computerPref.GraphicsDoubleBuffering = PIn.Bool(row["GraphicsDoubleBuffering"].ToString()); computerPref.PreferredPixelFormatNum = PIn.Int(row["PreferredPixelFormatNum"].ToString()); computerPref.AtoZpath = PIn.String(row["AtoZpath"].ToString()); computerPref.TaskKeepListHidden = PIn.Bool(row["TaskKeepListHidden"].ToString()); computerPref.TaskDock = PIn.Int(row["TaskDock"].ToString()); computerPref.TaskX = PIn.Int(row["TaskX"].ToString()); computerPref.TaskY = PIn.Int(row["TaskY"].ToString()); computerPref.DirectXFormat = PIn.String(row["DirectXFormat"].ToString()); computerPref.ScanDocSelectSource = PIn.Bool(row["ScanDocSelectSource"].ToString()); computerPref.ScanDocShowOptions = PIn.Bool(row["ScanDocShowOptions"].ToString()); computerPref.ScanDocDuplex = PIn.Bool(row["ScanDocDuplex"].ToString()); computerPref.ScanDocGrayscale = PIn.Bool(row["ScanDocGrayscale"].ToString()); computerPref.ScanDocResolution = PIn.Int(row["ScanDocResolution"].ToString()); computerPref.ScanDocQuality = PIn.Byte(row["ScanDocQuality"].ToString()); computerPref.ClinicNum = PIn.Long(row["ClinicNum"].ToString()); computerPref.ApptViewNum = PIn.Long(row["ApptViewNum"].ToString()); computerPref.RecentApptView = PIn.Byte(row["RecentApptView"].ToString()); computerPref.PatSelectSearchMode = (OpenDentBusiness.SearchMode)PIn.Int(row["PatSelectSearchMode"].ToString()); computerPref.NoShowLanguage = PIn.Bool(row["NoShowLanguage"].ToString()); computerPref.NoShowDecimal = PIn.Bool(row["NoShowDecimal"].ToString()); string computerOS = row["ComputerOS"].ToString(); if (computerOS == "") { computerPref.ComputerOS = (OpenDentBusiness.PlatformOD) 0; } else { try{ computerPref.ComputerOS = (OpenDentBusiness.PlatformOD)Enum.Parse(typeof(OpenDentBusiness.PlatformOD), computerOS); } catch { computerPref.ComputerOS = (OpenDentBusiness.PlatformOD) 0; } } computerPref.HelpButtonXAdjustment = PIn.Double(row["HelpButtonXAdjustment"].ToString()); retVal.Add(computerPref); } return(retVal); }
///<summary>Inserts one ComputerPref into the database. Provides option to use the existing priKey.</summary> public static long Insert(ComputerPref computerPref, bool useExistingPK) { if (!useExistingPK && PrefC.RandomKeys) { computerPref.ComputerPrefNum = ReplicationServers.GetKey("computerpref", "ComputerPrefNum"); } string command = "INSERT INTO computerpref ("; if (useExistingPK || PrefC.RandomKeys) { command += "ComputerPrefNum,"; } command += "ComputerName,GraphicsUseHardware,GraphicsSimple,SensorType,SensorBinned,SensorPort,SensorExposure,GraphicsDoubleBuffering,PreferredPixelFormatNum,AtoZpath,TaskKeepListHidden,TaskDock,TaskX,TaskY,DirectXFormat,RecentApptView,ScanDocSelectSource,ScanDocShowOptions,ScanDocDuplex,ScanDocGrayscale,ScanDocResolution,ScanDocQuality) VALUES("; if (useExistingPK || PrefC.RandomKeys) { command += POut.Long(computerPref.ComputerPrefNum) + ","; } command += "'" + POut.String(computerPref.ComputerName) + "'," + POut.Bool(computerPref.GraphicsUseHardware) + "," + POut.Int((int)computerPref.GraphicsSimple) + "," + "'" + POut.String(computerPref.SensorType) + "'," + POut.Bool(computerPref.SensorBinned) + "," + POut.Int(computerPref.SensorPort) + "," + POut.Int(computerPref.SensorExposure) + "," + POut.Bool(computerPref.GraphicsDoubleBuffering) + "," + POut.Int(computerPref.PreferredPixelFormatNum) + "," + "'" + POut.String(computerPref.AtoZpath) + "'," + POut.Bool(computerPref.TaskKeepListHidden) + "," + POut.Int(computerPref.TaskDock) + "," + POut.Int(computerPref.TaskX) + "," + POut.Int(computerPref.TaskY) + "," + "'" + POut.String(computerPref.DirectXFormat) + "'," + POut.Byte(computerPref.RecentApptView) + "," + POut.Bool(computerPref.ScanDocSelectSource) + "," + POut.Bool(computerPref.ScanDocShowOptions) + "," + POut.Bool(computerPref.ScanDocDuplex) + "," + POut.Bool(computerPref.ScanDocGrayscale) + "," + POut.Int(computerPref.ScanDocResolution) + "," + POut.Byte(computerPref.ScanDocQuality) + ")"; if (useExistingPK || PrefC.RandomKeys) { Db.NonQ(command); } else { computerPref.ComputerPrefNum = Db.NonQ(command, true); } return(computerPref.ComputerPrefNum); }
///<summary>Returns the computer preferences for the computer which this instance of Open Dental is running on.</summary> public static ComputerPref GetForLocalComputer() { string computerName = Dns.GetHostName(); //local computer name string command = "SELECT * FROM computerpref WHERE ComputerName='" + POut.PString(computerName) + "'"; DataTable table; ComputerPref computerPref = new ComputerPref(); //OpenGL tooth chart not supported on Unix systems. if (Environment.OSVersion.Platform == PlatformID.Unix) { computerPref.GraphicsSimple = true; } //Default sensor values to start computerPref.SensorType = "D"; computerPref.SensorPort = 0; computerPref.SensorExposure = 1; computerPref.SensorBinned = false; try{ table = General.GetTableEx(command); }catch { //In case of database error, just use default graphics settings so that it is possible for the program to start. return(computerPref); } if (table.Rows.Count == 0) //Computer prefs do not exist yet. { computerPref.ComputerName = computerName; Insert(computerPref); //Create default prefs for the specified computer. Also sets primary key in our computerPref object. return(computerPref); } if (table.Rows.Count > 1) { //Should never happen (would only happen if the primary key showed up more than once). Logger.openlog.LogMB("Corrupt computerpref table in database. The computer name '" + POut.PString(computerName) + "' is a primary key in multiple records. Please run the " + "database maintenance tool, then call us for help if you still get this message.", Logger.Severity.WARNING); } computerPref.ComputerPrefNum = PIn.PInt(table.Rows[0][0].ToString()); computerPref.ComputerName = PIn.PString(table.Rows[0][1].ToString()); computerPref.GraphicsUseHardware = PIn.PBool(table.Rows[0][2].ToString()); computerPref.GraphicsSimple = PIn.PBool(table.Rows[0][3].ToString()); computerPref.SensorType = PIn.PString(table.Rows[0][4].ToString()); computerPref.SensorBinned = PIn.PBool(table.Rows[0][5].ToString()); computerPref.SensorPort = PIn.PInt(table.Rows[0][6].ToString()); computerPref.SensorExposure = PIn.PInt(table.Rows[0][7].ToString()); computerPref.GraphicsDoubleBuffering = PIn.PBool(table.Rows[0][8].ToString()); computerPref.PreferredPixelFormatNum = PIn.PInt(table.Rows[0][9].ToString()); return(computerPref); }
///<summary>Inserts one ComputerPref into the database. Returns the new priKey. Doesn't use the cache.</summary> public static long InsertNoCache(ComputerPref computerPref) { if (DataConnection.DBtype == DatabaseType.MySql) { return(InsertNoCache(computerPref, false)); } else { if (DataConnection.DBtype == DatabaseType.Oracle) { computerPref.ComputerPrefNum = DbHelper.GetNextOracleKey("computerpref", "ComputerPrefNum"); //Cacheless method } return(InsertNoCache(computerPref, true)); } }
private void FormToothChartingBig_Load(object sender, EventArgs e) { ComputerPref computerPref = ComputerPrefs.GetForLocalComputer(); toothChart.UseHardware = computerPref.GraphicsUseHardware; toothChart.PreferredPixelFormatNumber = computerPref.PreferredPixelFormatNum; toothChart.SimpleMode = computerPref.GraphicsSimple; //Must be last preference set, last so that all //settings are caried through in the reinitialization //this line triggers. //The preferred pixel format number changes to the selected pixel format number after a context is chosen. computerPref.PreferredPixelFormatNum = toothChart.PreferredPixelFormatNumber; ComputerPrefs.Update(computerPref); FillToothChart(); //toothChart.Refresh(); }
private void FormGraphics_Load(object sender, EventArgs e) { gridFormats.BeginUpdate(); gridFormats.Columns.Clear(); ODGridColumn col = new ODGridColumn(Lan.g(this, "FormatNum"), 80); gridFormats.Columns.Add(col); col = new ODGridColumn(Lan.g(this, "OpenGL"), 60); gridFormats.Columns.Add(col); col = new ODGridColumn(Lan.g(this, "Windowed"), 80); gridFormats.Columns.Add(col); col = new ODGridColumn(Lan.g(this, "Bitmapped"), 80); gridFormats.Columns.Add(col); col = new ODGridColumn(Lan.g(this, "Palette"), 75); gridFormats.Columns.Add(col); col = new ODGridColumn(Lan.g(this, "Accelerated"), 80); gridFormats.Columns.Add(col); col = new ODGridColumn(Lan.g(this, "Buffered"), 75); gridFormats.Columns.Add(col); col = new ODGridColumn(Lan.g(this, "ColorBits"), 75); gridFormats.Columns.Add(col); col = new ODGridColumn(Lan.g(this, "DepthBits"), 75); gridFormats.Columns.Add(col); gridFormats.EndUpdate(); if (Environment.OSVersion.Platform == PlatformID.Unix) //Force simple mode on Unix systems. { MsgBox.Show(this, "Linux users must use simple graphics mode."); radio3DChart.Enabled = false; group3DToothChart.Enabled = false; return; } ComputerPref computerPref = ComputerPrefs.GetForLocalComputer(); if (computerPref.GraphicsSimple) { radioSimpleChart.Checked = true; group3DToothChart.Enabled = false; } else { radio3DChart.Checked = true; } checkHardwareAccel.Checked = computerPref.GraphicsUseHardware; checkDoubleBuffering.Checked = computerPref.GraphicsDoubleBuffering; selectedFormatNum = computerPref.PreferredPixelFormatNum; textSelected.Text = selectedFormatNum.ToString(); RefreshFormats(); }
public static int Update(ComputerPref computerPref) { string command = "UPDATE computerpref SET " + "ComputerName='" + POut.PString(computerPref.ComputerName) + "'," + "GraphicsUseHardware='" + POut.PBool(computerPref.GraphicsUseHardware) + "'," + "GraphicsSimple='" + POut.PBool(computerPref.GraphicsSimple) + "'," + "SensorType='" + POut.PString(computerPref.SensorType) + "'," + "SensorBinned='" + POut.PBool(computerPref.SensorBinned) + "'," + "SensorPort='" + POut.PInt(computerPref.SensorPort) + "'," + "SensorExposure='" + POut.PInt(computerPref.SensorExposure) + "'," + "GraphicsDoubleBuffering='" + POut.PBool(computerPref.GraphicsDoubleBuffering) + "'," + "PreferredPixelFormatNum='" + POut.PInt(computerPref.PreferredPixelFormatNum) + "' " + "WHERE ComputerPrefNum='" + POut.PInt(computerPref.ComputerPrefNum) + "'"; return(General.NonQ(command)); }
private void butOK_Click(object sender, System.EventArgs e) { //ComputerPrefCur doesn't change until here, so make the old copy exactly when we need it instead of when the form is created. ComputerPref computerPrefOld = ComputerPrefCur.Copy(); //ComputerPref computerPref=ComputerPrefs.GetForLocalComputer(); if (radioDirectXChart.Checked) { if (!_isRemoteEdit && !TestDirectXFormat(this, selectedDirectXFormat)) { MessageBox.Show(Lan.g(this, "Please choose a different device format, " + "the selected device format will not support the DirectX 3D tooth chart on this computer")); return; } ComputerPrefCur.GraphicsSimple = DrawingMode.DirectX; ComputerPrefCur.DirectXFormat = selectedDirectXFormat; } else if (radioSimpleChart.Checked) { ComputerPrefCur.GraphicsSimple = DrawingMode.Simple2D; } else //OpenGL { OpenGLWinFormsControl contextTester = new OpenGLWinFormsControl(); try { if (!_isRemoteEdit && contextTester.TaoInitializeContexts(selectedFormatNum) != selectedFormatNum) { throw new Exception(Lan.g(this, "Could not initialize pixel format ") + selectedFormatNum.ToString() + "."); } } catch (Exception ex) { MessageBox.Show(Lan.g(this, "Please choose a different pixel format, the selected pixel format will not support the 3D tooth chart on this computer: " + ex.Message)); contextTester.Dispose(); return; } contextTester.Dispose(); ComputerPrefCur.GraphicsUseHardware = checkHardwareAccel.Checked; ComputerPrefCur.GraphicsDoubleBuffering = checkDoubleBuffering.Checked; ComputerPrefCur.PreferredPixelFormatNum = selectedFormatNum; ComputerPrefCur.GraphicsSimple = DrawingMode.OpenGL; } ComputerPrefs.Update(ComputerPrefCur, computerPrefOld); DialogResult = DialogResult.OK; }
private void FormImagingSetup_Load(object sender, System.EventArgs e) { comboType.Items.Add("B"); comboType.Items.Add("D"); textDoc.Text = PrefB.GetInt("ScannerCompression").ToString(); slider.MinVal = PrefB.GetInt("ImageWindowingMin"); slider.MaxVal = PrefB.GetInt("ImageWindowingMax"); computerPrefs = ComputerPrefs.GetForLocalComputer(); upDownPort.Value = computerPrefs.SensorPort; comboType.Text = computerPrefs.SensorType; checkBinned.Checked = computerPrefs.SensorBinned; int exposureLevelVal = computerPrefs.SensorExposure; if (exposureLevelVal < (int)upDownExposure.Minimum || exposureLevelVal > (int)upDownExposure.Maximum) { exposureLevelVal = (int)upDownExposure.Minimum; //Play it safe with the default exposure. } upDownExposure.Value = exposureLevelVal; }
///<summary>This used to be called all the time, now only needs to be called on load.</summary> private void FillSearchOption() { _computerPref = ComputerPrefs.LocalComputer; //This is the computerprefs for this local computer. switch (_computerPref.PatSelectSearchMode) { case SearchMode.Default: checkRefresh.Checked = true; //!PrefC.GetBool(PrefName.PatientSelectUsesSearchButton);//Use global preference break; case SearchMode.RefreshWhileTyping: checkRefresh.Checked = true; break; case SearchMode.UseSearchButton: default: checkRefresh.Checked = false; break; } }
private void butOK_Click(object sender, EventArgs e) { if (comboLanguageAndRegion.SelectedIndex == -1) { MsgBox.Show(this, "Select a language and region."); return; } if (Security.IsAuthorized(Permissions.Setup, true)) { //_cultureCur=_listAllCultures[comboLanguageAndRegion.SelectedIndex]; if (Prefs.UpdateString(PrefName.LanguageAndRegion, _listAllCultures[comboLanguageAndRegion.SelectedIndex].Name)) { MsgBox.Show(this, "Program must be restarted for changes to take full effect."); } ComputerPref local = ComputerPrefs.LocalComputer; local.NoShowLanguage = checkNoShow.Checked; ComputerPrefs.Update(local); } DialogResult = DialogResult.OK; }
///<summary>Inserts one ComputerPref into the database. Provides option to use the existing priKey.</summary> internal static long Insert(ComputerPref computerPref,bool useExistingPK) { if(!useExistingPK && PrefC.RandomKeys) { computerPref.ComputerPrefNum=ReplicationServers.GetKey("computerpref","ComputerPrefNum"); } string command="INSERT INTO computerpref ("; if(useExistingPK || PrefC.RandomKeys) { command+="ComputerPrefNum,"; } command+="ComputerName,GraphicsUseHardware,GraphicsSimple,SensorType,SensorBinned,SensorPort,SensorExposure,GraphicsDoubleBuffering,PreferredPixelFormatNum,AtoZpath,TaskKeepListHidden,TaskDock,TaskX,TaskY,DirectXFormat,RecentApptView) VALUES("; if(useExistingPK || PrefC.RandomKeys) { command+=POut.Long(computerPref.ComputerPrefNum)+","; } command+= "'"+POut.String(computerPref.ComputerName)+"'," + POut.Bool (computerPref.GraphicsUseHardware)+"," + POut.Int ((int)computerPref.GraphicsSimple)+"," +"'"+POut.String(computerPref.SensorType)+"'," + POut.Bool (computerPref.SensorBinned)+"," + POut.Int (computerPref.SensorPort)+"," + POut.Int (computerPref.SensorExposure)+"," + POut.Bool (computerPref.GraphicsDoubleBuffering)+"," + POut.Int (computerPref.PreferredPixelFormatNum)+"," +"'"+POut.String(computerPref.AtoZpath)+"'," + POut.Bool (computerPref.TaskKeepListHidden)+"," + POut.Int (computerPref.TaskDock)+"," + POut.Int (computerPref.TaskX)+"," + POut.Int (computerPref.TaskY)+"," +"'"+POut.String(computerPref.DirectXFormat)+"'," + POut.Byte (computerPref.RecentApptView)+")"; if(useExistingPK || PrefC.RandomKeys) { Db.NonQ(command); } else { computerPref.ComputerPrefNum=Db.NonQ(command,true); } return computerPref.ComputerPrefNum; }
///<summary>Updates one ComputerPref in the database. Uses an old object to compare to, and only alters changed fields. This prevents collisions and concurrency problems in heavily used tables. Returns true if an update occurred.</summary> public static bool Update(ComputerPref computerPref, ComputerPref oldComputerPref) { string command = ""; if (computerPref.ComputerName != oldComputerPref.ComputerName) { if (command != "") { command += ","; } command += "ComputerName = '" + POut.String(computerPref.ComputerName) + "'"; } if (computerPref.GraphicsUseHardware != oldComputerPref.GraphicsUseHardware) { if (command != "") { command += ","; } command += "GraphicsUseHardware = " + POut.Bool(computerPref.GraphicsUseHardware) + ""; } if (computerPref.GraphicsSimple != oldComputerPref.GraphicsSimple) { if (command != "") { command += ","; } command += "GraphicsSimple = " + POut.Int((int)computerPref.GraphicsSimple) + ""; } if (computerPref.SensorType != oldComputerPref.SensorType) { if (command != "") { command += ","; } command += "SensorType = '" + POut.String(computerPref.SensorType) + "'"; } if (computerPref.SensorBinned != oldComputerPref.SensorBinned) { if (command != "") { command += ","; } command += "SensorBinned = " + POut.Bool(computerPref.SensorBinned) + ""; } if (computerPref.SensorPort != oldComputerPref.SensorPort) { if (command != "") { command += ","; } command += "SensorPort = " + POut.Int(computerPref.SensorPort) + ""; } if (computerPref.SensorExposure != oldComputerPref.SensorExposure) { if (command != "") { command += ","; } command += "SensorExposure = " + POut.Int(computerPref.SensorExposure) + ""; } if (computerPref.GraphicsDoubleBuffering != oldComputerPref.GraphicsDoubleBuffering) { if (command != "") { command += ","; } command += "GraphicsDoubleBuffering = " + POut.Bool(computerPref.GraphicsDoubleBuffering) + ""; } if (computerPref.PreferredPixelFormatNum != oldComputerPref.PreferredPixelFormatNum) { if (command != "") { command += ","; } command += "PreferredPixelFormatNum = " + POut.Int(computerPref.PreferredPixelFormatNum) + ""; } if (computerPref.AtoZpath != oldComputerPref.AtoZpath) { if (command != "") { command += ","; } command += "AtoZpath = '" + POut.String(computerPref.AtoZpath) + "'"; } if (computerPref.TaskKeepListHidden != oldComputerPref.TaskKeepListHidden) { if (command != "") { command += ","; } command += "TaskKeepListHidden = " + POut.Bool(computerPref.TaskKeepListHidden) + ""; } if (computerPref.TaskDock != oldComputerPref.TaskDock) { if (command != "") { command += ","; } command += "TaskDock = " + POut.Int(computerPref.TaskDock) + ""; } if (computerPref.TaskX != oldComputerPref.TaskX) { if (command != "") { command += ","; } command += "TaskX = " + POut.Int(computerPref.TaskX) + ""; } if (computerPref.TaskY != oldComputerPref.TaskY) { if (command != "") { command += ","; } command += "TaskY = " + POut.Int(computerPref.TaskY) + ""; } if (computerPref.DirectXFormat != oldComputerPref.DirectXFormat) { if (command != "") { command += ","; } command += "DirectXFormat = '" + POut.String(computerPref.DirectXFormat) + "'"; } if (computerPref.ScanDocSelectSource != oldComputerPref.ScanDocSelectSource) { if (command != "") { command += ","; } command += "ScanDocSelectSource = " + POut.Bool(computerPref.ScanDocSelectSource) + ""; } if (computerPref.ScanDocShowOptions != oldComputerPref.ScanDocShowOptions) { if (command != "") { command += ","; } command += "ScanDocShowOptions = " + POut.Bool(computerPref.ScanDocShowOptions) + ""; } if (computerPref.ScanDocDuplex != oldComputerPref.ScanDocDuplex) { if (command != "") { command += ","; } command += "ScanDocDuplex = " + POut.Bool(computerPref.ScanDocDuplex) + ""; } if (computerPref.ScanDocGrayscale != oldComputerPref.ScanDocGrayscale) { if (command != "") { command += ","; } command += "ScanDocGrayscale = " + POut.Bool(computerPref.ScanDocGrayscale) + ""; } if (computerPref.ScanDocResolution != oldComputerPref.ScanDocResolution) { if (command != "") { command += ","; } command += "ScanDocResolution = " + POut.Int(computerPref.ScanDocResolution) + ""; } if (computerPref.ScanDocQuality != oldComputerPref.ScanDocQuality) { if (command != "") { command += ","; } command += "ScanDocQuality = " + POut.Byte(computerPref.ScanDocQuality) + ""; } if (computerPref.ClinicNum != oldComputerPref.ClinicNum) { if (command != "") { command += ","; } command += "ClinicNum = " + POut.Long(computerPref.ClinicNum) + ""; } if (computerPref.ApptViewNum != oldComputerPref.ApptViewNum) { if (command != "") { command += ","; } command += "ApptViewNum = " + POut.Long(computerPref.ApptViewNum) + ""; } if (computerPref.RecentApptView != oldComputerPref.RecentApptView) { if (command != "") { command += ","; } command += "RecentApptView = " + POut.Byte(computerPref.RecentApptView) + ""; } if (computerPref.PatSelectSearchMode != oldComputerPref.PatSelectSearchMode) { if (command != "") { command += ","; } command += "PatSelectSearchMode = " + POut.Int((int)computerPref.PatSelectSearchMode) + ""; } if (computerPref.NoShowLanguage != oldComputerPref.NoShowLanguage) { if (command != "") { command += ","; } command += "NoShowLanguage = " + POut.Bool(computerPref.NoShowLanguage) + ""; } if (computerPref.NoShowDecimal != oldComputerPref.NoShowDecimal) { if (command != "") { command += ","; } command += "NoShowDecimal = " + POut.Bool(computerPref.NoShowDecimal) + ""; } if (computerPref.ComputerOS != oldComputerPref.ComputerOS) { if (command != "") { command += ","; } command += "ComputerOS = '" + POut.String(computerPref.ComputerOS.ToString()) + "'"; } if (computerPref.HelpButtonXAdjustment != oldComputerPref.HelpButtonXAdjustment) { if (command != "") { command += ","; } command += "HelpButtonXAdjustment = '" + POut.Double(computerPref.HelpButtonXAdjustment) + "'"; } if (command == "") { return(false); } command = "UPDATE computerpref SET " + command + " WHERE ComputerPrefNum = " + POut.Long(computerPref.ComputerPrefNum); Db.NonQ(command); return(true); }
///<summary>Updates one ComputerPref in the database. Uses an old object to compare to, and only alters changed fields. This prevents collisions and concurrency problems in heavily used tables.</summary> internal static void Update(ComputerPref computerPref,ComputerPref oldComputerPref) { string command=""; if(computerPref.ComputerName != oldComputerPref.ComputerName) { if(command!=""){ command+=",";} command+="ComputerName = '"+POut.String(computerPref.ComputerName)+"'"; } if(computerPref.GraphicsUseHardware != oldComputerPref.GraphicsUseHardware) { if(command!=""){ command+=",";} command+="GraphicsUseHardware = "+POut.Bool(computerPref.GraphicsUseHardware)+""; } if(computerPref.GraphicsSimple != oldComputerPref.GraphicsSimple) { if(command!=""){ command+=",";} command+="GraphicsSimple = "+POut.Int ((int)computerPref.GraphicsSimple)+""; } if(computerPref.SensorType != oldComputerPref.SensorType) { if(command!=""){ command+=",";} command+="SensorType = '"+POut.String(computerPref.SensorType)+"'"; } if(computerPref.SensorBinned != oldComputerPref.SensorBinned) { if(command!=""){ command+=",";} command+="SensorBinned = "+POut.Bool(computerPref.SensorBinned)+""; } if(computerPref.SensorPort != oldComputerPref.SensorPort) { if(command!=""){ command+=",";} command+="SensorPort = "+POut.Int(computerPref.SensorPort)+""; } if(computerPref.SensorExposure != oldComputerPref.SensorExposure) { if(command!=""){ command+=",";} command+="SensorExposure = "+POut.Int(computerPref.SensorExposure)+""; } if(computerPref.GraphicsDoubleBuffering != oldComputerPref.GraphicsDoubleBuffering) { if(command!=""){ command+=",";} command+="GraphicsDoubleBuffering = "+POut.Bool(computerPref.GraphicsDoubleBuffering)+""; } if(computerPref.PreferredPixelFormatNum != oldComputerPref.PreferredPixelFormatNum) { if(command!=""){ command+=",";} command+="PreferredPixelFormatNum = "+POut.Int(computerPref.PreferredPixelFormatNum)+""; } if(computerPref.AtoZpath != oldComputerPref.AtoZpath) { if(command!=""){ command+=",";} command+="AtoZpath = '"+POut.String(computerPref.AtoZpath)+"'"; } if(computerPref.TaskKeepListHidden != oldComputerPref.TaskKeepListHidden) { if(command!=""){ command+=",";} command+="TaskKeepListHidden = "+POut.Bool(computerPref.TaskKeepListHidden)+""; } if(computerPref.TaskDock != oldComputerPref.TaskDock) { if(command!=""){ command+=",";} command+="TaskDock = "+POut.Int(computerPref.TaskDock)+""; } if(computerPref.TaskX != oldComputerPref.TaskX) { if(command!=""){ command+=",";} command+="TaskX = "+POut.Int(computerPref.TaskX)+""; } if(computerPref.TaskY != oldComputerPref.TaskY) { if(command!=""){ command+=",";} command+="TaskY = "+POut.Int(computerPref.TaskY)+""; } if(computerPref.DirectXFormat != oldComputerPref.DirectXFormat) { if(command!=""){ command+=",";} command+="DirectXFormat = '"+POut.String(computerPref.DirectXFormat)+"'"; } if(computerPref.RecentApptView != oldComputerPref.RecentApptView) { if(command!=""){ command+=",";} command+="RecentApptView = "+POut.Byte(computerPref.RecentApptView)+""; } if(command==""){ return; } command="UPDATE computerpref SET "+command +" WHERE ComputerPrefNum = "+POut.Long(computerPref.ComputerPrefNum); Db.NonQ(command); }
///<summary>Inserts one ComputerPref into the database. Returns the new priKey. Doesn't use the cache.</summary> public static long InsertNoCache(ComputerPref computerPref) { return(InsertNoCache(computerPref, false)); }
///<summary>Converts a DataTable to a list of objects.</summary> internal static List<ComputerPref> TableToList(DataTable table) { List<ComputerPref> retVal=new List<ComputerPref>(); ComputerPref computerPref; for(int i=0;i<table.Rows.Count;i++) { computerPref=new ComputerPref(); computerPref.ComputerPrefNum = PIn.Long (table.Rows[i]["ComputerPrefNum"].ToString()); computerPref.ComputerName = PIn.String(table.Rows[i]["ComputerName"].ToString()); computerPref.GraphicsUseHardware = PIn.Bool (table.Rows[i]["GraphicsUseHardware"].ToString()); computerPref.GraphicsSimple = (DrawingMode)PIn.Int(table.Rows[i]["GraphicsSimple"].ToString()); computerPref.SensorType = PIn.String(table.Rows[i]["SensorType"].ToString()); computerPref.SensorBinned = PIn.Bool (table.Rows[i]["SensorBinned"].ToString()); computerPref.SensorPort = PIn.Int (table.Rows[i]["SensorPort"].ToString()); computerPref.SensorExposure = PIn.Int (table.Rows[i]["SensorExposure"].ToString()); computerPref.GraphicsDoubleBuffering= PIn.Bool (table.Rows[i]["GraphicsDoubleBuffering"].ToString()); computerPref.PreferredPixelFormatNum= PIn.Int (table.Rows[i]["PreferredPixelFormatNum"].ToString()); computerPref.AtoZpath = PIn.String(table.Rows[i]["AtoZpath"].ToString()); computerPref.TaskKeepListHidden = PIn.Bool (table.Rows[i]["TaskKeepListHidden"].ToString()); computerPref.TaskDock = PIn.Int (table.Rows[i]["TaskDock"].ToString()); computerPref.TaskX = PIn.Int (table.Rows[i]["TaskX"].ToString()); computerPref.TaskY = PIn.Int (table.Rows[i]["TaskY"].ToString()); computerPref.DirectXFormat = PIn.String(table.Rows[i]["DirectXFormat"].ToString()); computerPref.RecentApptView = PIn.Byte (table.Rows[i]["RecentApptView"].ToString()); retVal.Add(computerPref); } return retVal; }
///<summary>Updates one ComputerPref in the database.</summary> internal static void Update(ComputerPref computerPref) { string command="UPDATE computerpref SET " +"ComputerName = '"+POut.String(computerPref.ComputerName)+"', " +"GraphicsUseHardware = "+POut.Bool (computerPref.GraphicsUseHardware)+", " +"GraphicsSimple = "+POut.Int ((int)computerPref.GraphicsSimple)+", " +"SensorType = '"+POut.String(computerPref.SensorType)+"', " +"SensorBinned = "+POut.Bool (computerPref.SensorBinned)+", " +"SensorPort = "+POut.Int (computerPref.SensorPort)+", " +"SensorExposure = "+POut.Int (computerPref.SensorExposure)+", " +"GraphicsDoubleBuffering= "+POut.Bool (computerPref.GraphicsDoubleBuffering)+", " +"PreferredPixelFormatNum= "+POut.Int (computerPref.PreferredPixelFormatNum)+", " +"AtoZpath = '"+POut.String(computerPref.AtoZpath)+"', " +"TaskKeepListHidden = "+POut.Bool (computerPref.TaskKeepListHidden)+", " +"TaskDock = "+POut.Int (computerPref.TaskDock)+", " +"TaskX = "+POut.Int (computerPref.TaskX)+", " +"TaskY = "+POut.Int (computerPref.TaskY)+", " +"DirectXFormat = '"+POut.String(computerPref.DirectXFormat)+"', " +"RecentApptView = "+POut.Byte (computerPref.RecentApptView)+" " +"WHERE ComputerPrefNum = "+POut.Long(computerPref.ComputerPrefNum); Db.NonQ(command); }
///<summary>Updates one ComputerPref in the database.</summary> public static void Update(ComputerPref computerPref){ string command="UPDATE computerpref SET " +"ComputerName = '"+POut.String(computerPref.ComputerName)+"', " +"GraphicsUseHardware = "+POut.Bool (computerPref.GraphicsUseHardware)+", " +"GraphicsSimple = "+POut.Int ((int)computerPref.GraphicsSimple)+", " +"SensorType = '"+POut.String(computerPref.SensorType)+"', " +"SensorBinned = "+POut.Bool (computerPref.SensorBinned)+", " +"SensorPort = "+POut.Int (computerPref.SensorPort)+", " +"SensorExposure = "+POut.Int (computerPref.SensorExposure)+", " +"GraphicsDoubleBuffering= "+POut.Bool (computerPref.GraphicsDoubleBuffering)+", " +"PreferredPixelFormatNum= "+POut.Int (computerPref.PreferredPixelFormatNum)+", " +"AtoZpath = '"+POut.String(computerPref.AtoZpath)+"', " +"TaskKeepListHidden = "+POut.Bool (computerPref.TaskKeepListHidden)+", " +"TaskDock = "+POut.Int (computerPref.TaskDock)+", " +"TaskX = "+POut.Int (computerPref.TaskX)+", " +"TaskY = "+POut.Int (computerPref.TaskY)+", " +"DirectXFormat = '"+POut.String(computerPref.DirectXFormat)+"', " +"ScanDocSelectSource = "+POut.Bool (computerPref.ScanDocSelectSource)+", " +"ScanDocShowOptions = "+POut.Bool (computerPref.ScanDocShowOptions)+", " +"ScanDocDuplex = "+POut.Bool (computerPref.ScanDocDuplex)+", " +"ScanDocGrayscale = "+POut.Bool (computerPref.ScanDocGrayscale)+", " +"ScanDocResolution = "+POut.Int (computerPref.ScanDocResolution)+", " +"ScanDocQuality = "+POut.Byte (computerPref.ScanDocQuality)+", " +"ClinicNum = "+POut.Long (computerPref.ClinicNum)+", " +"ApptViewNum = "+POut.Long (computerPref.ApptViewNum)+", " +"RecentApptView = "+POut.Byte (computerPref.RecentApptView)+" " +"WHERE ComputerPrefNum = "+POut.Long(computerPref.ComputerPrefNum); Db.NonQ(command); }
///<summary>Updates one ComputerPref in the database. Uses an old object to compare to, and only alters changed fields. This prevents collisions and concurrency problems in heavily used tables. Returns true if an update occurred.</summary> public static bool Update(ComputerPref computerPref,ComputerPref oldComputerPref){ string command=""; if(computerPref.ComputerName != oldComputerPref.ComputerName) { if(command!=""){ command+=",";} command+="ComputerName = '"+POut.String(computerPref.ComputerName)+"'"; } if(computerPref.GraphicsUseHardware != oldComputerPref.GraphicsUseHardware) { if(command!=""){ command+=",";} command+="GraphicsUseHardware = "+POut.Bool(computerPref.GraphicsUseHardware)+""; } if(computerPref.GraphicsSimple != oldComputerPref.GraphicsSimple) { if(command!=""){ command+=",";} command+="GraphicsSimple = "+POut.Int ((int)computerPref.GraphicsSimple)+""; } if(computerPref.SensorType != oldComputerPref.SensorType) { if(command!=""){ command+=",";} command+="SensorType = '"+POut.String(computerPref.SensorType)+"'"; } if(computerPref.SensorBinned != oldComputerPref.SensorBinned) { if(command!=""){ command+=",";} command+="SensorBinned = "+POut.Bool(computerPref.SensorBinned)+""; } if(computerPref.SensorPort != oldComputerPref.SensorPort) { if(command!=""){ command+=",";} command+="SensorPort = "+POut.Int(computerPref.SensorPort)+""; } if(computerPref.SensorExposure != oldComputerPref.SensorExposure) { if(command!=""){ command+=",";} command+="SensorExposure = "+POut.Int(computerPref.SensorExposure)+""; } if(computerPref.GraphicsDoubleBuffering != oldComputerPref.GraphicsDoubleBuffering) { if(command!=""){ command+=",";} command+="GraphicsDoubleBuffering = "+POut.Bool(computerPref.GraphicsDoubleBuffering)+""; } if(computerPref.PreferredPixelFormatNum != oldComputerPref.PreferredPixelFormatNum) { if(command!=""){ command+=",";} command+="PreferredPixelFormatNum = "+POut.Int(computerPref.PreferredPixelFormatNum)+""; } if(computerPref.AtoZpath != oldComputerPref.AtoZpath) { if(command!=""){ command+=",";} command+="AtoZpath = '"+POut.String(computerPref.AtoZpath)+"'"; } if(computerPref.TaskKeepListHidden != oldComputerPref.TaskKeepListHidden) { if(command!=""){ command+=",";} command+="TaskKeepListHidden = "+POut.Bool(computerPref.TaskKeepListHidden)+""; } if(computerPref.TaskDock != oldComputerPref.TaskDock) { if(command!=""){ command+=",";} command+="TaskDock = "+POut.Int(computerPref.TaskDock)+""; } if(computerPref.TaskX != oldComputerPref.TaskX) { if(command!=""){ command+=",";} command+="TaskX = "+POut.Int(computerPref.TaskX)+""; } if(computerPref.TaskY != oldComputerPref.TaskY) { if(command!=""){ command+=",";} command+="TaskY = "+POut.Int(computerPref.TaskY)+""; } if(computerPref.DirectXFormat != oldComputerPref.DirectXFormat) { if(command!=""){ command+=",";} command+="DirectXFormat = '"+POut.String(computerPref.DirectXFormat)+"'"; } if(computerPref.ScanDocSelectSource != oldComputerPref.ScanDocSelectSource) { if(command!=""){ command+=",";} command+="ScanDocSelectSource = "+POut.Bool(computerPref.ScanDocSelectSource)+""; } if(computerPref.ScanDocShowOptions != oldComputerPref.ScanDocShowOptions) { if(command!=""){ command+=",";} command+="ScanDocShowOptions = "+POut.Bool(computerPref.ScanDocShowOptions)+""; } if(computerPref.ScanDocDuplex != oldComputerPref.ScanDocDuplex) { if(command!=""){ command+=",";} command+="ScanDocDuplex = "+POut.Bool(computerPref.ScanDocDuplex)+""; } if(computerPref.ScanDocGrayscale != oldComputerPref.ScanDocGrayscale) { if(command!=""){ command+=",";} command+="ScanDocGrayscale = "+POut.Bool(computerPref.ScanDocGrayscale)+""; } if(computerPref.ScanDocResolution != oldComputerPref.ScanDocResolution) { if(command!=""){ command+=",";} command+="ScanDocResolution = "+POut.Int(computerPref.ScanDocResolution)+""; } if(computerPref.ScanDocQuality != oldComputerPref.ScanDocQuality) { if(command!=""){ command+=",";} command+="ScanDocQuality = "+POut.Byte(computerPref.ScanDocQuality)+""; } if(computerPref.ClinicNum != oldComputerPref.ClinicNum) { if(command!=""){ command+=",";} command+="ClinicNum = "+POut.Long(computerPref.ClinicNum)+""; } if(computerPref.ApptViewNum != oldComputerPref.ApptViewNum) { if(command!=""){ command+=",";} command+="ApptViewNum = "+POut.Long(computerPref.ApptViewNum)+""; } if(computerPref.RecentApptView != oldComputerPref.RecentApptView) { if(command!=""){ command+=",";} command+="RecentApptView = "+POut.Byte(computerPref.RecentApptView)+""; } if(command==""){ return false; } command="UPDATE computerpref SET "+command +" WHERE ComputerPrefNum = "+POut.Long(computerPref.ComputerPrefNum); Db.NonQ(command); return true; }
///<summary>Updates one ComputerPref in the database. Uses an old object to compare to, and only alters changed fields. This prevents collisions and concurrency problems in heavily used tables.</summary> internal static void Update(ComputerPref computerPref, ComputerPref oldComputerPref) { string command = ""; if (computerPref.ComputerName != oldComputerPref.ComputerName) { if (command != "") { command += ","; } command += "ComputerName = '" + POut.String(computerPref.ComputerName) + "'"; } if (computerPref.GraphicsUseHardware != oldComputerPref.GraphicsUseHardware) { if (command != "") { command += ","; } command += "GraphicsUseHardware = " + POut.Bool(computerPref.GraphicsUseHardware) + ""; } if (computerPref.GraphicsSimple != oldComputerPref.GraphicsSimple) { if (command != "") { command += ","; } command += "GraphicsSimple = " + POut.Int((int)computerPref.GraphicsSimple) + ""; } if (computerPref.SensorType != oldComputerPref.SensorType) { if (command != "") { command += ","; } command += "SensorType = '" + POut.String(computerPref.SensorType) + "'"; } if (computerPref.SensorBinned != oldComputerPref.SensorBinned) { if (command != "") { command += ","; } command += "SensorBinned = " + POut.Bool(computerPref.SensorBinned) + ""; } if (computerPref.SensorPort != oldComputerPref.SensorPort) { if (command != "") { command += ","; } command += "SensorPort = " + POut.Int(computerPref.SensorPort) + ""; } if (computerPref.SensorExposure != oldComputerPref.SensorExposure) { if (command != "") { command += ","; } command += "SensorExposure = " + POut.Int(computerPref.SensorExposure) + ""; } if (computerPref.GraphicsDoubleBuffering != oldComputerPref.GraphicsDoubleBuffering) { if (command != "") { command += ","; } command += "GraphicsDoubleBuffering = " + POut.Bool(computerPref.GraphicsDoubleBuffering) + ""; } if (computerPref.PreferredPixelFormatNum != oldComputerPref.PreferredPixelFormatNum) { if (command != "") { command += ","; } command += "PreferredPixelFormatNum = " + POut.Int(computerPref.PreferredPixelFormatNum) + ""; } if (computerPref.AtoZpath != oldComputerPref.AtoZpath) { if (command != "") { command += ","; } command += "AtoZpath = '" + POut.String(computerPref.AtoZpath) + "'"; } if (computerPref.TaskKeepListHidden != oldComputerPref.TaskKeepListHidden) { if (command != "") { command += ","; } command += "TaskKeepListHidden = " + POut.Bool(computerPref.TaskKeepListHidden) + ""; } if (computerPref.TaskDock != oldComputerPref.TaskDock) { if (command != "") { command += ","; } command += "TaskDock = " + POut.Int(computerPref.TaskDock) + ""; } if (computerPref.TaskX != oldComputerPref.TaskX) { if (command != "") { command += ","; } command += "TaskX = " + POut.Int(computerPref.TaskX) + ""; } if (computerPref.TaskY != oldComputerPref.TaskY) { if (command != "") { command += ","; } command += "TaskY = " + POut.Int(computerPref.TaskY) + ""; } if (computerPref.DirectXFormat != oldComputerPref.DirectXFormat) { if (command != "") { command += ","; } command += "DirectXFormat = '" + POut.String(computerPref.DirectXFormat) + "'"; } if (computerPref.RecentApptView != oldComputerPref.RecentApptView) { if (command != "") { command += ","; } command += "RecentApptView = " + POut.Byte(computerPref.RecentApptView) + ""; } if (command == "") { return; } command = "UPDATE computerpref SET " + command + " WHERE ComputerPrefNum = " + POut.Long(computerPref.ComputerPrefNum); Db.NonQ(command); }
///<summary>Returns true if Update(ComputerPref,ComputerPref) would make changes to the database. ///Does not make any changes to the database and can be called before remoting role is checked.</summary> public static bool UpdateComparison(ComputerPref computerPref, ComputerPref oldComputerPref) { if (computerPref.ComputerName != oldComputerPref.ComputerName) { return(true); } if (computerPref.GraphicsUseHardware != oldComputerPref.GraphicsUseHardware) { return(true); } if (computerPref.GraphicsSimple != oldComputerPref.GraphicsSimple) { return(true); } if (computerPref.SensorType != oldComputerPref.SensorType) { return(true); } if (computerPref.SensorBinned != oldComputerPref.SensorBinned) { return(true); } if (computerPref.SensorPort != oldComputerPref.SensorPort) { return(true); } if (computerPref.SensorExposure != oldComputerPref.SensorExposure) { return(true); } if (computerPref.GraphicsDoubleBuffering != oldComputerPref.GraphicsDoubleBuffering) { return(true); } if (computerPref.PreferredPixelFormatNum != oldComputerPref.PreferredPixelFormatNum) { return(true); } if (computerPref.AtoZpath != oldComputerPref.AtoZpath) { return(true); } if (computerPref.TaskKeepListHidden != oldComputerPref.TaskKeepListHidden) { return(true); } if (computerPref.TaskDock != oldComputerPref.TaskDock) { return(true); } if (computerPref.TaskX != oldComputerPref.TaskX) { return(true); } if (computerPref.TaskY != oldComputerPref.TaskY) { return(true); } if (computerPref.DirectXFormat != oldComputerPref.DirectXFormat) { return(true); } if (computerPref.ScanDocSelectSource != oldComputerPref.ScanDocSelectSource) { return(true); } if (computerPref.ScanDocShowOptions != oldComputerPref.ScanDocShowOptions) { return(true); } if (computerPref.ScanDocDuplex != oldComputerPref.ScanDocDuplex) { return(true); } if (computerPref.ScanDocGrayscale != oldComputerPref.ScanDocGrayscale) { return(true); } if (computerPref.ScanDocResolution != oldComputerPref.ScanDocResolution) { return(true); } if (computerPref.ScanDocQuality != oldComputerPref.ScanDocQuality) { return(true); } if (computerPref.ClinicNum != oldComputerPref.ClinicNum) { return(true); } if (computerPref.ApptViewNum != oldComputerPref.ApptViewNum) { return(true); } if (computerPref.RecentApptView != oldComputerPref.RecentApptView) { return(true); } if (computerPref.PatSelectSearchMode != oldComputerPref.PatSelectSearchMode) { return(true); } if (computerPref.NoShowLanguage != oldComputerPref.NoShowLanguage) { return(true); } if (computerPref.NoShowDecimal != oldComputerPref.NoShowDecimal) { return(true); } if (computerPref.ComputerOS != oldComputerPref.ComputerOS) { return(true); } if (computerPref.HelpButtonXAdjustment != oldComputerPref.HelpButtonXAdjustment) { return(true); } return(false); }
private void FormGraphics_Load(object sender, EventArgs e) { if (ComputerPrefCur == null) { ComputerPrefCur = ComputerPrefs.LocalComputer; } else { if (ComputerPrefCur != ComputerPrefs.LocalComputer) { _isRemoteEdit = true; } MsgBox.Show(this, "Warning, editing another computers graphical settings should be done from that computer to ensure the selected settings work." + " We do not recommend editing this way. If you make changes for another computer you should still verifiy that they work on that machine."); SecurityLogs.MakeLogEntry(Permissions.GraphicsRemoteEdit, 0, "Edited graphical settings for " + ComputerPrefCur.ComputerName); } Text += " - " + ComputerPrefCur.ComputerName; if (ComputerPrefCur.ComputerOS == PlatformOD.Undefined) //Remote computer has not updated yet. { MsgBox.Show(this, "Selected computer needs to be updated before being able to remotely change its graphical settings."); DialogResult = DialogResult.Cancel; return; } if (ComputerPrefCur.ComputerOS == PlatformOD.Unix) //Force simple mode on Unix systems. { MsgBox.Show(this, "Linux users must use simple tooth chart."); radioDirectXChart.Enabled = false; radioOpenGLChart.Enabled = false; group3DToothChart.Enabled = false; return; } //ComputerPref computerPref=ComputerPrefs.GetForLocalComputer(); checkHardwareAccel.Checked = ComputerPrefCur.GraphicsUseHardware; checkDoubleBuffering.Checked = ComputerPrefCur.GraphicsDoubleBuffering; selectedFormatNum = ComputerPrefCur.PreferredPixelFormatNum; selectedDirectXFormat = ComputerPrefCur.DirectXFormat; textSelected.Text = ""; if (ComputerPrefCur.GraphicsSimple == DrawingMode.Simple2D) { radioSimpleChart.Checked = true; group3DToothChart.Enabled = false; } else if (ComputerPrefCur.GraphicsSimple == DrawingMode.DirectX) { radioDirectXChart.Checked = true; group3DToothChart.Enabled = true; groupFilters.Enabled = false; } else //OpenGL { radioOpenGLChart.Checked = true; group3DToothChart.Enabled = true; groupFilters.Enabled = true; } if (Clinics.IsMedicalPracticeOrClinic(Clinics.ClinicNum)) { radioDirectXChart.Text = "Use DirectX Graphics (recommended)"; radioSimpleChart.Text = "Use Simple Graphics"; radioOpenGLChart.Text = "Use OpenGL Graphics"; group3DToothChart.Text = "Options For 3D Graphics"; label3DChart.Text = "Most users will never need to change any of these options. These are only used when the 3D graphics are not working " + "properly."; } RefreshFormats(); }