private void hmTabControlTools_SelectedPageChanging(object sender, TabPageChangingEventArgs e) { if (e.PrevPage == tpSyncManager) { if (CompanySyncProcess.GetSyncProcessEnum(CompanySyncProcess.NoCompany, EnumSyncType.System) != EnumSyncProcess.NotSyncing) { GuiCommon.ShowMessage("System Sync is broken, please run it again."); e.Cancel = true; return; } var syncStatus = CompanySyncProcess.GetSyncProcessEnum(Company.CurrentId, EnumSyncType.Lookup); if (syncStatus == EnumSyncProcess.LookupSyncing) { GuiCommon.ShowMessage("Lookup Sync is broken, please finish or cancel it."); e.Cancel = true; return; } syncStatus = CompanySyncProcess.GetSyncProcessEnum(Company.CurrentId, EnumSyncType.Core); if (syncStatus == EnumSyncProcess.CoreSending) { GuiCommon.ShowMessage("Core Sync is broken in sending data, please finish or cancel it."); e.Cancel = true; return; } else if (syncStatus == EnumSyncProcess.CoreReceiving) { GuiCommon.ShowMessage("Core Sync is broken in receiving data, please finish or cancel it."); e.Cancel = true; return; } } }
private async void btnSync_ClickAsync(object sender, EventArgs e) { CL_Dialog.PleaseWait.Show("Data syncing...\r\nPlease Wait", ParentForm); SyncResult result = await DataSync.HandShakeAsync(); if (result.Successful) { var resultSync = await DataSync.RunSyncSystem(DataSync.GetSyncSystemList()); if (resultSync.Successful) { string msg = LoginUser.AddSqlUsers(); if (msg != null) { GuiCommon.ShowMessage(msg); } } GuiCommon.ShowMessage(resultSync.DisplayMessage()); } else { GuiCommon.ShowMessage(result.DisplayMessage()); } CL_Dialog.PleaseWait.Hide(); }
private void VerifiyUser() { if (CompanySyncProcess.GetSyncProcessEnum(CompanySyncProcess.NoCompany, EnumSyncType.System) != EnumSyncProcess.NotSyncing) { GuiCommon.ShowMessage("First time use or sync broken, need to Sync Users."); btnSync.Focus(); return; } if (teUsername.EditValue == null) { GuiCommon.ShowMessage("Please enter a user name."); return; } if (tePassword.EditValue == null) { GuiCommon.ShowMessage("Please enter a password."); return; } IntPtr userHandle = IntPtr.Zero; bool winValid = LogonUser(teUsername.EditValue.ToString(), System.Net.NetworkInformation.IPGlobalProperties.GetIPGlobalProperties().DomainName, tePassword.EditValue.ToString(), 2, 0, ref userHandle); if (!winValid) { GuiCommon.ShowMessage("Failed in windows authentication. Incorrect Username/Password."); return; } int?id = LoginUser.ValidUser(teUsername.EditValue.ToString()); if (id == null) { GuiCommon.ShowMessage("Cannot find this user."); return; } else { LoginUser.CurrUser = LoginUser.GetUser(id.Value); DataManage.UpdateCodeVersion(); if (LoginUser.MaxCodeVersion() != LoginUser.CurrUser.CodeVersion) { GuiCommon.ShowMessage("Code verion is not correct, please log out and restart."); return; } luCompany.Properties.DataSource = Company.List.Where(x => LoginUser.CurrUser.AccessList.Select(a => a.CompanyId).Contains(x.MatchId)).Select(x => new { CompanyID = x.MatchId, CompanyName = x.CompanyName }); if (LoginUser.CurrUser.AccessList.Count == 1) { luCompany.ItemIndex = 0;//autoload the only company } } }
private void hmTabControlProcess_SelectedPageChanging(object sender, TabPageChangingEventArgs e) { if (e.Page == tpEditLem) { if (tabLemHeader.GetCurrentLog() == null) { GuiCommon.ShowMessage("Must select a log header."); e.Cancel = true; } } }
private void ucMain_Load(object sender, EventArgs e) { hmNavigationBar1.SetMOBSecurity(LoginUser.CurrUser.AccessList.Single(x => x.CompanyId == Company.CurrentId).Department, Company.CurrentId, MobileCommon.MobileDB); if (CompanySyncProcess.GetSyncProcessEnum(Company.CurrentId, EnumSyncType.Lookup) != EnumSyncProcess.NotSyncing) { GuiCommon.ShowMessage("Last Lookup Sync was broken, please finish or cancel it."); hmTabControlTop.SelectedTabPage = hmTabPageTools; hmTabControlTools.SelectedTabPage = tpSyncManager; } if (new EnumSyncProcess[] { EnumSyncProcess.NotSyncing, EnumSyncProcess.CoreHalfWay }.Contains(CompanySyncProcess.GetSyncProcessEnum(Company.CurrentId, EnumSyncType.Core)) == false) { GuiCommon.ShowMessage("Last Core Sync was broken, please finish or cancel it."); hmTabControlTop.SelectedTabPage = hmTabPageTools; hmTabControlTools.SelectedTabPage = tpSyncManager; } }
public frmMain() { InitializeComponent(); MobileCommon.ServerName = ConfigurationManager.AppSettings["ServerName"]; MobileCommon.DatabaseName = ConfigurationManager.AppSettings["DatabaseName"]; MobileCommon.MobileDB = $"Data Source ={MobileCommon.ServerName}; Initial Catalog = {MobileCommon.DatabaseName}; Integrated Security = True;"; GuiCommon.HMDevXManager = new TUC_HMDevXManager.TUC_HMDevXManager(defaultLookAndFeel1); ReflexCommon.SqlCommon.ReportMessage += GuiCommon.ShowMessage; DataManage.ReportMessage += GuiCommon.ShowMessage; DataManage.CheckCreateDatabase(); if (!DataManage.HasDBAccess()) { GuiCommon.ShowMessage("Please contact your system administrator to grant you database access."); return; } DataManage.Purge(); }