private void worker_DoWork(object sender, DoWorkEventArgs e) { try { SetProgressBar(60); SetLabel("Initializing components"); //this.LoadUserAppData(); SetProgressBar(100); SetLabel("Getting user information"); //GlobalService.User = "******"; //GlobalService.DbTable = "TB_hk950097"; /*if (domain == "kmhk.local") * GlobalService.DbTable = "TB_" + AdUtil.GetUserIdByUsername(GlobalService.User, "kmhk.local"); * else * { * string id = AdUtil.GetUserIdByUsername(GlobalService.User, domain); * * string tb = id == "as1600048" ? "hk070022" * : id == "as1600049" ? "hk110017" * : id == "as1600050" ? "hk040015" * : id == "as1600051" ? "hk160002" * : id == "as1600053" ? "hk950330" * : id == "as1600054" ? "hk110023" * : id == "as1600055" ? "hk120027" * : id == "as1600056" ? "hk140005" : ""; * * GlobalService.DbTable = "TB_" + tb; * * string name = id == "as1600048" ? "Chow Chi To(周志滔,Sammy)" * : id == "as1600049" ? "Ling Wai Man(凌慧敏,Velma)" * : id == "as1600050" ? "Chan Fai Lung(陳輝龍,Onyx)" * : id == "as1600051" ? "Ng Lau Yu, Lilith (吳柳如)" * : id == "as1600053" ? "Lee Miu Wah(李苗華)" * : id == "as1600054" ? "Lee Ming Fung(李銘峯)" * : id == "as1600055" ? "Ho Kin Hang(何健恒,Ken)" * : id == "as1600056" ? "Yeung Wai, Gabriel (楊偉)" : ""; * * GlobalService.User = name; * }*/ //List<string> list = new List<string>(); //list.Add(GlobalService.User); //EmailUtil.SendNotificationEmail(list); GlobalService.User = GlobalService.User.Trim(); try { SetLabel("Synchronizing data"); SharedUtil.AutoDeleteData(); Stopwatch sw = new Stopwatch(); sw.Start(); GlobalService.DepartmentFolder = SetupUtil.GetDepartmentFolder(GlobalService.User); sw.Stop(); Debug.WriteLine("Get Department Folder: " + sw.Elapsed); sw.Reset(); sw.Start(); GlobalService.DivisionMemberList = SystemUtil.DivisionMember(GlobalService.User); sw.Stop(); Debug.WriteLine("Get Division Memeber: " + sw.Elapsed); sw.Reset(); sw.Start(); GlobalService.DepartmentMemberList = SystemUtil.DepartmentMember(GlobalService.User); sw.Stop(); Debug.WriteLine("Get Department Member: " + sw.Elapsed); sw.Reset(); sw.Start(); GlobalService.SystemGroupList = GroupUtil.SystemGroupList(); GlobalService.CNGroupList = GroupUtil.CnGroupList(); GlobalService.VNGroupList = GroupUtil.VnGroupList(); GlobalService.JPGroupList = GroupUtil.JpGroupList(); sw.Stop(); Debug.WriteLine("Get System Group: " + sw.Elapsed); sw.Reset(); sw.Start(); GlobalService.CustomGroupList = GroupUtil.CustomGroupList2(GlobalService.User); sw.Stop(); Debug.WriteLine("Get Custom Group: " + sw.Elapsed); sw.Reset(); sw.Start(); GlobalService.AllUserList = UserUtil.AllUserList(); GlobalService.CnUserList = UserUtil.CnUserList(); GlobalService.VnUserList = UserUtil.VnUserList(); GlobalService.JpUserList = UserUtil.JpUserList(); sw.Stop(); Debug.WriteLine("Get All User: "******"Initialize attachment list: " + sw.Elapsed); sw.Reset(); sw.Start(); GlobalService.ExtraSystemGroupList = GroupUtil.ExtraSystemGroupList(); sw.Stop(); Debug.WriteLine("Get Extra System Group: " + sw.Elapsed); sw.Reset(); sw.Start(); GlobalService.NoticeList = MessageUtil.GetNoticeList(); sw.Stop(); Debug.WriteLine("Get Notice list: " + sw.Elapsed); GlobalService.IsPasswordInput = false; sw.Reset(); sw.Start(); GlobalService.DiscList = DiscUtil.PopulateDiscList(); sw.Stop(); Debug.WriteLine("Populate Disc List: " + sw.Elapsed); sw.Reset(); sw.Start(); GlobalService.Division = SystemUtil.GetDivision(GlobalService.User); sw.Stop(); Debug.WriteLine("Get Division: " + sw.Elapsed); sw.Reset(); sw.Start(); GlobalService.AppsList = SystemUtil.AppsList(); sw.Stop(); Debug.WriteLine("Get Application list: " + sw.Elapsed); sw.Reset(); sw.Start(); GlobalService.DocumentList = new List <lists.DocumentList>(); sw.Stop(); Debug.WriteLine("Initialize Document List: " + sw.Elapsed); sw.Reset(); sw.Start(); GlobalService.ContactList = ContactUtil.ContactList(); sw.Stop(); Debug.WriteLine("Load Contact List: " + sw.Elapsed); GetSystemVersion(); UpdateCommon(); SharedUtil.UpdateEmptyShared(); SharedUtil.UpdateShared(); Login(); //DataUtil.SyncDataToServer(); } catch (Exception ex) { Debug.WriteLine(ex.Message + ex.StackTrace); } } catch (ArgumentException ex) { File.WriteAllText(@"D:\Error.txt", ex.Message + ex.StackTrace); MessageBox.Show(ex.Message + ex.StackTrace); } }