//reload data from database private void Reload() { try { this.branchClient = new BranchClient(); this.currentData = new ObservableCollection <CM_BRANCH>(); this.ItemsData = new List <ItemYesNo>() { new ItemYesNo() { Id = "A", Name = CommonResource.lblApproved }, new ItemYesNo() { Id = "U", Name = CommonResource.lblDisApprove }, new ItemYesNo() { Id = "", Name = CommonResource.lblAll } }; this.branchClient.GetByTopBranchCompleted += new EventHandler <GetByTopBranchCompletedEventArgs>(searchCompleted); this.branchClient.DeleteBranchCompleted += new EventHandler <DeleteBranchCompletedEventArgs>(deleteCompleted); } catch (Exception) { this.messagePop.SetSingleError(CommonResource.errorCannotConnectServer); } }
private void ReLoad() { try { this.tlUserClient = new TLUSERClient(); this.branchClient = new BranchClient(); TLSYSROLEClient roleClient = new TLSYSROLEClient(); LoadBranch(); this.IsSingleData = true; roleClient.GetByTopTLSYSROLEAsync("", "", ""); roleClient.GetByTopTLSYSROLECompleted += (s, e) => { ObservableCollection <TL_SYSROLE> tempRole; if (e.Result != null && e.Result.Count > 0) { tempRole = e.Result; } else { tempRole = new ObservableCollection <TL_SYSROLE>(); } tempRole.Add(new TL_SYSROLE() { ROLE_ID = CommonResource.lblAll }); this.RoleData = tempRole; this.OnPropertyChanged("RoleData"); }; this.AuthData = new List <ItemYesNo>() { new ItemYesNo() { Id = "A", Name = CommonResource.lblApproved }, new ItemYesNo() { Id = "U", Name = CommonResource.lblDisApprove }, new ItemYesNo() { Id = "", Name = CommonResource.lblAll } }; this.tlUserClient.SearchTLUSERCompleted += new EventHandler <SearchTLUSERCompletedEventArgs>(searchTLUserCompleted); this.tlUserClient.DeleteTLUSERCompleted += new EventHandler <DeleteTLUSERCompletedEventArgs>(deletedCompleted); } catch (Exception ex) { this.messagePop.SetSingleError(ex.Message); } }
private void Reload() { try { this.tluserClient = new TLUSERClient(); this.branchClient = new BranchClient(); //CMBRANCHClient branchClient = new CMBRANCHClient(); TLSYSROLEClient roleClient = new TLSYSROLEClient(); this.IsAuto = Visibility.Collapsed.ToString(); this.IsCustomer = Visibility.Visible.ToString(); //LoadBranch(); this.branchClient.GetByParentBranchIDAsync(CurrentSystemLogin.CurrentUser.TLSUBBRID); roleClient.GetByTopTLSYSROLEAsync("", "", ""); roleClient.GetByTopTLSYSROLECompleted += (s, e) => { if (e.Result != null && e.Result.Count > 0) { this.RoleData = e.Result; } else { this.RoleData = new ObservableCollection <TL_SYSROLE>(); } }; this.tluserClient.InsertTLUSERCompleted += new EventHandler <InsertTLUSERCompletedEventArgs>(insertCompleted); this.tluserClient.UpdateTLUSERCompleted += new EventHandler <UpdateTLUSERCompletedEventArgs>(updateCompleted); this.tluserClient.InsertAllTLUSERCompleted += new EventHandler <InsertAllTLUSERCompletedEventArgs>(insertAllCompleted); this.branchClient.CM_BRANCH_LevelCompleted += new EventHandler <CM_BRANCH_LevelCompletedEventArgs>(getBranchCompleted); this.tluserClient.ApproveTLUSERCompleted += new EventHandler <ApproveTLUSERCompletedEventArgs>(approveComplete); this.branchClient.GetByParentBranchIDCompleted += new EventHandler <GetByParentBranchIDCompletedEventArgs>(getAllBranch); this.tluserClient.GetUserInfomationCompleted += new EventHandler <GetUserInfomationCompletedEventArgs>(getUserInfoComplete); this.IsError = Visibility.Collapsed.ToString(); this.IsOk = Visibility.Collapsed.ToString(); } catch (Exception ex) { this.messagePop.SetSingleError(ex.Message); } }
private void Load() { try { this.branchClient = new BranchClient(); this.departmentClient = new DEPARTMENTClient(); this.departmentTypeClient = new CM_DEPT_GROUPClient(); this.departmentTypeClient.SearchCM_DEPT_GROUPAsync(new CM_DEPT_GROUP_SearchResult(), 100); this.departmentClient.UpdateDEPARTMENTCompleted += new EventHandler <UpdateDEPARTMENTCompletedEventArgs>(updateCompleted); this.departmentClient.InsertDEPARTMENTCompleted += new EventHandler <InsertDEPARTMENTCompletedEventArgs>(insertCompleted); this.departmentClient.ApproveDEPARTMENTCompleted += new EventHandler <ApproveDEPARTMENTCompletedEventArgs>(approveCompleted); this.departmentClient.SearchDEPARTMENTCompleted += new EventHandler <SearchDEPARTMENTCompletedEventArgs>(getDepartmentCompleted); this.departmentTypeClient.SearchCM_DEPT_GROUPCompleted += new EventHandler <SearchCM_DEPT_GROUPCompletedEventArgs>(getGroupDepCompleted); } catch (Exception) { this.messagePop.SetSingleError(CommonResource.errorCannotConnectServer); } }
private void Load() { try { this.branchClient = new BranchClient(); this.branchClient.UpdateBranchCompleted += new EventHandler <UpdateBranchCompletedEventArgs>(updateCompleted); this.branchClient.InsertBranchCompleted += new EventHandler <InsertBranchCompletedEventArgs>(insetCompleted); this.branchClient.ApproveBranchCompleted += new EventHandler <ApproveBranchCompletedEventArgs>(approveCompleted); this.branchClient.GetByTopBranchCompleted += new EventHandler <GetByTopBranchCompletedEventArgs>(getBranchCompleted); this.BranchTypeData = new List <ItemData>() { new ItemData() { Id = "HS", Name = AssCommonResource.lblHeadquarter }, new ItemData() { Id = "KV", Name = AssCommonResource.lblRegion }, new ItemData() { Id = "CN", Name = AssCommonResource.lblBranch1 }, new ItemData() { Id = "PGD", Name = AssCommonResource.lblTransactionOffice } }; } catch (Exception) { this.messagePop.SetSingleError(CommonResource.errorCannotConnectServer); } }
private void ReLoad() { try { this.tlUserClient = new TLUSERClient(); this.branchClient = new BranchClient(); TLSYSROLEClient roleClient = new TLSYSROLEClient(); LoadBranch(); this.IsSingleData = true; roleClient.GetByTopTLSYSROLEAsync("", "", ""); roleClient.GetByTopTLSYSROLECompleted += (s, e) => { ObservableCollection<TL_SYSROLE> tempRole; if (e.Result != null && e.Result.Count > 0) tempRole = e.Result; else tempRole = new ObservableCollection<TL_SYSROLE>(); tempRole.Add(new TL_SYSROLE() { ROLE_ID = CommonResource.lblAll }); this.RoleData = tempRole; this.OnPropertyChanged("RoleData"); }; this.AuthData = new List<ItemYesNo>() { new ItemYesNo(){Id="A", Name=CommonResource.lblApproved}, new ItemYesNo(){Id="U", Name=CommonResource.lblDisApprove}, new ItemYesNo(){Id="", Name=CommonResource.lblAll} }; this.tlUserClient.SearchTLUSERCompleted += new EventHandler<SearchTLUSERCompletedEventArgs>(searchTLUserCompleted); this.tlUserClient.DeleteTLUSERCompleted += new EventHandler<DeleteTLUSERCompletedEventArgs>(deletedCompleted); } catch (Exception ex) { this.messagePop.SetSingleError(ex.Message); } }
//reload data from database private void Reload() { try { this.branchClient = new BranchClient(); branchClient.CM_BRANCH_LevelAsync(CurrentSystemLogin.CurrentUser.TLSUBBRID); branchClient.CM_BRANCH_LevelCompleted += (s, e) => { try { this.dicBranch = new Dictionary <string, ObservableCollection <CM_BRANCH> >(); this.dicTrans = new Dictionary <string, ObservableCollection <CM_BRANCH> >(); if (e.Result != null) { //Gan danh sach KV if (e.Result.RegionList != null) { this.KVData = e.Result.RegionList; } else { this.KVData = new ObservableCollection <CM_BRANCH>(); } //Luu danh sach chi nhanh vao dic if (e.Result.BranchList == null) { this.BranchData = new ObservableCollection <CM_BRANCH>(); } foreach (var item in e.Result.BranchList) { if (this.dicBranch.ContainsKey(item.FATHER_ID)) { this.dicBranch[item.FATHER_ID].Add(item); } else { this.dicBranch.Add(item.FATHER_ID, new ObservableCollection <CM_BRANCH>()); this.dicBranch[item.FATHER_ID].Add(item); } } //Luu danh sach PGD vao dic if (e.Result.TransList != null) { this.PGDData = new ObservableCollection <CM_BRANCH>(); } foreach (var item in e.Result.TransList) { if (this.dicTrans.ContainsKey(item.FATHER_ID)) { this.dicTrans[item.FATHER_ID].Add(item); } else { this.dicTrans.Add(item.FATHER_ID, new ObservableCollection <CM_BRANCH>()); this.dicTrans[item.FATHER_ID].Add(item); } } } else { this.KVData = new ObservableCollection <CM_BRANCH>(); this.BranchData = new ObservableCollection <CM_BRANCH>(); this.PGDData = new ObservableCollection <CM_BRANCH>(); } if (this.KVData.Count > 1) { this.KVData.Add(new CM_BRANCH() { BRANCH_ID = "", BRANCH_CODE = "", BRANCH_NAME = CommonResource.lblAll }); } foreach (var key in this.dicBranch.Keys) { if (this.dicBranch[key].Count > 1) { this.dicBranch[key].Add(new CM_BRANCH() { BRANCH_ID = "", BRANCH_CODE = "", BRANCH_NAME = CommonResource.lblAll }); } } foreach (var key in this.dicTrans.Keys) { if (this.dicTrans[key].Count > 1) { this.dicTrans[key].Add(new CM_BRANCH() { BRANCH_ID = "", BRANCH_CODE = "", BRANCH_NAME = CommonResource.lblAll }); } } this.OnPropertyChanged("KVData"); //Set gia tri mac dinh tren combobox if (this.KVData.Count > 0) { this.KVId = this.KVData[0].BRANCH_ID; } if (this.BranchData.Count > 0) { this.BranchId = this.BranchData[0].BRANCH_ID; } if (this.PGDData.Count > 0) { this.PGDId = this.PGDData[0].BRANCH_ID; } this.OnPropertyChanged("PGDId"); if (CurrentSystemLogin.CurrentUser.BRANCH_TYPE.Equals("HS")) { this.KVId = ""; this.OnPropertyChanged("KVId"); } else if (CurrentSystemLogin.CurrentUser.BRANCH_TYPE.Equals("KV")) { this.BranchId = ""; this.OnPropertyChanged("BranchId"); } else if (CurrentSystemLogin.CurrentUser.BRANCH_TYPE.Equals("CN")) { this.PGDId = ""; this.OnPropertyChanged("PGDId"); } } catch (Exception ex) { this.messagePop.SetSingleError(ex.Message); } }; this.branchClient.BranchSearchCompleted += new EventHandler <BranchSearchCompletedEventArgs>(searchCompleted); //this.branchClient.GetByTopBranchCompleted += new EventHandler<GetByTopBranchCompletedEventArgs>(searchCompleted); } catch (Exception) { this.messagePop.SetSingleError(CommonResource.errorCannotConnectServer); } }