public void GetEmpByStore() { if (LoggedUserInfo.Store != null) { StorePerRow = new TblStore().InjectFrom(LoggedUserInfo.Store) as TblStore; } StoreList = new SortableCollectionView <TblStore>(); if (LoggedUserInfo.AllowedStores != null && LoggedUserInfo.Company.Code != "HQ") { Client.SearchBysStoreNameAsync(new ObservableCollection <int>(LoggedUserInfo.AllowedStores), LoggedUserInfo.Iserial, null, null, LoggedUserInfo.DatabasEname); } Client.SearchBysStoreNameCompleted += (s, sv) => { StoreList = sv.Result; if (StoreList != null && StoreList.Count == 1) { StorePerRow = StoreList.FirstOrDefault(); } }; Loading = true; }
public TblAuthUser Authenticate(string _USerName, string _USerPassrword, out TblStore store) { using (var context = new WorkFlowManagerDBEntities()) { var authQuery = context.TblAuthUsers.Include("TblCompany1").Include("TblCompany2").Include("BarcodeDisplaySettingsHeader").Include("TblUserBrandSections.TblUserBrandSectionPermissions").FirstOrDefault(x => x.UserName.ToLower() == _USerName && x.UserPassword == _USerPassrword); if (authQuery != null) { Main.Iserial = authQuery.Iserial; Main.UserWinLogin = authQuery.User_Win_Login; Main.Domain = authQuery.User_Domain; if (authQuery.TblCompany1 != null && authQuery.TblCompany1.Ip != null) { if (authQuery.TblCompany1.Ip != null) { Main.Ip = authQuery.TblCompany1.Ip; } if (authQuery.TblCompany1.Port != null) { Main.Port = authQuery.TblCompany1.Port; } if (authQuery.TblCompany1.DbName != null) { Main.DatabaseName = authQuery.TblCompany1.DbName; } if (authQuery.Code != null) { Main.Code = authQuery.Code; } if (authQuery.TblCompany1.Code != "HQ") { using (var db = new ccnewEntities()) { if (authQuery.ActiveStore == null || authQuery.ActiveStore == 0) { store = null; } else { var user = Convert.ToInt32(authQuery.ActiveStore); store = db.TblStores.FirstOrDefault(x => x.iserial == user); } } } } } store = null; return(authQuery); } }
private void OKButton_Click(object sender, RoutedEventArgs e) { if (MainGrid.SelectedIndex != -1) { var newstore = new TblStore(); var row = MainGrid.SelectedItem as StoreForAllCompany; if (row != null) { newstore.iserial = row.Iserial; newstore.ENAME = row.Ename; newstore.aname = row.Aname; newstore.code = row.Code; } _userControl.SearchPerRow = newstore; DialogResult = true; } }