SHARE
TWEET

Untitled

a guest Jul 22nd, 2019 67 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. private void skinGallery_ItemClick(object sender, System.EventArgs e)
  2.         {
  3.             var ulf = (DevExpress.LookAndFeel.UserLookAndFeel)sender;
  4.  
  5.             var skinName = ulf.SkinName;
  6.             var paletteName = ulf.ActiveSvgPaletteName;
  7.             Microsoft.Win32.Registry.SetValue("HKEY_CURRENT_USER\\APERTech\\GENESIS\\GALLERY", "SKIN", skinName, Microsoft.Win32.RegistryValueKind.String);
  8.             Microsoft.Win32.Registry.SetValue("HKEY_CURRENT_USER\\APERTech\\GENESIS\\GALLERY", "PALETTE", paletteName, Microsoft.Win32.RegistryValueKind.String);
  9.         }
  10.  
  11. ////////////////////////////
  12.  
  13.  private void Home_Load(object sender, System.EventArgs e)
  14.         {
  15.             string skinName = Microsoft.Win32.Registry.GetValue("HKEY_CURRENT_USER\\APERTech\\GENESIS\\GALLERY", "SKIN", DevExpress.LookAndFeel.UserLookAndFeel.DefaultSkinName).ToString();
  16.             string paletteName = Microsoft.Win32.Registry.GetValue("HKEY_CURRENT_USER\\APERTech\\GENESIS\\GALLERY", "PALETTE", "").ToString();
  17.  
  18.             DevExpress.LookAndFeel.UserLookAndFeel.Default.SetSkinStyle(skinName, paletteName);
  19.  
  20.             // Configure current culture for SQL SERVER
  21.             System.Globalization.CultureInfo culture = (System.Globalization.CultureInfo)System.Globalization.CultureInfo.CurrentCulture.Clone();
  22.             culture.DateTimeFormat.ShortDatePattern = "yyyy-MM-dd";
  23.             culture.NumberFormat.NumberDecimalSeparator = ".";
  24.             System.Threading.Thread.CurrentThread.CurrentCulture = culture;
  25.  
  26.             UpdateUserStatus(int.Parse(InitializeSettings.CurrentUserId), 1);
  27.             txtUserFullName.Caption = InitializeSettings.CurrentUsername;
  28.             System.Data.DataTable data = AppLibrary.Data.SqlOps.ExecQuery($"SELECT SKIN_NAME FROM [dbo].[ADM_USERS_SKINS] WHERE USER_ID = {InitializeSettings.CurrentUserId}");
  29.             if (data.Rows.Count > 0) DevExpress.LookAndFeel.UserLookAndFeel.Default.SkinName = (string)data.Rows[0]["SKIN_NAME"];
  30.  
  31.             data = AppLibrary.Data.SqlOps.ExecQuery($"SELECT GROUP_ID FROM [dbo].[ADM_UG_USERS] WHERE USER_ID = {InitializeSettings.CurrentUserId}");
  32.             userGroups.Add(-1);
  33.             foreach (System.Data.DataRow row in data.Rows)
  34.                 userGroups.Add((int)row["GROUP_ID"]);
  35.  
  36.             //InitializeSettings.CurrentUserId = "142";
  37.             AppLibrary.Controls.ControlOps.AdjustControlPermission(this, GetType().FullName);
  38.  
  39. #if !DEBUG
  40.             DevExpress.XtraSplashScreen.SplashScreenManager.ShowDefaultWaitForm("Updates checking", "Please wait...");
  41.             AppLibrary.Deployment.UpdateApplication update = new AppLibrary.Deployment.UpdateApplication(true);
  42.             update?.btnUpdate_Click(null, null);
  43.             update?.ShowDialog();
  44.             DevExpress.XtraSplashScreen.SplashScreenManager.CloseDefaultWaitForm();
  45. #endif
  46.         }
  47.  
  48.  
  49. ///////////////////////
  50.  
  51. public Home()
  52.         {
  53.             InitializeComponent();
  54.             Text = $"APERTech - GENESIS ERP Systems {Microsoft.Win32.Registry.GetValue("HKEY_CURRENT_USER\\APERTech\\GENESIS\\Version", "VER", "1.0")}";
  55.             DevExpress.LookAndFeel.UserLookAndFeel.Default.StyleChanged += new System.EventHandler(skinGallery_ItemClick);
  56.         }
  57.  
  58.         bool userClosing = false;
  59.         public static System.Collections.Generic.List<int> userGroups = new System.Collections.Generic.List<int>();
  60.  
  61.         void UpdateUserStatus(int userId, int status)
  62.         {
  63.             System.Data.DataTable data = AppLibrary.Data.SqlOps.ExecQuery($"SELECT * FROM [dbo].[ADM_ACTIVE_USERS] WHERE USER_ID = {userId}", AppLibrary.Data.ConType._GENESIS);
  64.  
  65.             if (data.Rows.Count > 0) AppLibrary.Data.SqlOps.ExecNonQuery($"UPDATE [dbo].[ADM_ACTIVE_USERS] SET STATUS = {status}, DATE = CURRENT_TIMESTAMP WHERE USER_ID = {userId}");
  66.             else AppLibrary.Data.SqlOps.ExecNonQuery($"INSERT INTO [dbo].[ADM_ACTIVE_USERS](USER_ID, DATE, STATUS) VALUES({userId}, CURRENT_TIMESTAMP, {status})");
  67.         }
  68.  
  69.         void Home_FormClosed(object sender, System.Windows.Forms.FormClosedEventArgs e)
  70.         {
  71.             _ = AppLibrary.Data.SqlOps.ExecNonQuery($"DELETE FROM [dbo].[ADM_USERS_SKINS] WHERE USER_ID = {InitializeSettings.CurrentUserId}");
  72.             _ = AppLibrary.Data.SqlOps.ExecNonQuery($"INSERT INTO [dbo].[ADM_USERS_SKINS](USER_ID, SKIN_NAME) VALUES({InitializeSettings.CurrentUserId}, '{DevExpress.LookAndFeel.UserLookAndFeel.Default.SkinName}')");
  73.  
  74.             UpdateUserStatus(int.Parse(InitializeSettings.CurrentUserId), 0);
  75.  
  76.             if (!userClosing) System.Windows.Forms.Application.Exit();
  77.             else System.Windows.Forms.Application.OpenForms["Login"].Show();
  78.         }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top