/// <summary> /// /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void cashDrawerListView_ItemSelectionChanged(object sender, ListViewItemSelectionChangedEventArgs e) { //Get the item that has its selection changed if (e == null) { return; } if (e.IsSelected) { //Get item ListViewItem selectedDrawer = e.Item; //Get item text string selectedDrawerText = selectedDrawer.Text; //Find the cash drawer int selectedCashDrawerIdx = this.cashDrawers.FindIndex( cvo => (cvo.Name.Equals(selectedDrawerText, StringComparison.OrdinalIgnoreCase))); if (selectedCashDrawerIdx >= 0) { CashDrawerVO selectedCashDrawer = this.cashDrawers[selectedCashDrawerIdx]; this.cashDrawerSelection = selectedCashDrawer; this.selectedCashDrawerID = selectedCashDrawer.Id; if (this.cashDrawerUserMap.ContainsKey(selectedCashDrawer)) { this.updateAssignedUserList(selectedCashDrawer); this.updateAvailableUserList(); } this.buttonDeleteDrawer.Enabled = true; } } }
/// <summary> /// /// </summary> /// <param name="cdIdx"></param> private void updateCashDrawerSelection(int cdIdx) { if (cdIdx < 0 || cdIdx >= this.cashDrawers.Count) { return; } this.cashDrawerSelection = this.cashDrawers[cdIdx]; int cnt = 0; foreach (ListViewItem lvi in this.cashDrawerListView.Items) { if (cashDrawerSelection != null && lvi.Text == this.cashDrawerSelection.Name) { lvi.Selected = true; this.cashDrawerListView_ItemSelectionChanged(this, new ListViewItemSelectionChangedEventArgs(lvi, cnt, true)); break; } /*else if (oldSelection != null && lvi.Text == oldSelection.Name) * { * lvi.Selected = false; * //this.cashDrawerListView_ItemSelectionChanged(this, new ListViewItemSelectionChangedEventArgs(lvi, cnt, false)); * }*/ cnt++; } }
public PawnStoreSetupData() { StoreData = new SiteId(); StoreCalendar = new List <ShopCalendarVO>(); StoreUsers = new List <UserVO>(); StoreSafe = new CashDrawerVO(); CashDrawers = new List <CashDrawerVO>(); CashDrawerUsers = new List <CashDrawerUserVO>(); EsbServices = new List <EsbServiceVO>(); DbServices = new List <DatabaseServiceVO>(); Workstations = new List <WorkstationVO>(); Peripherals = new List <PeripheralVO>(); PeripheralTypes = new List <PeripheralTypeVO>(DEFAULT_PERIPHERAL_SZ); PeripheralModelTypes = new List <PeripheralModelVO>(DEFAULT_PERIPHERAL_SZ); }
public ShopCashMgr() { InitializeComponent(); this.NavControlBox = new NavBox(); this.assignedUserSelection = null; this.availableUserSelection = null; this.cashDrawerSelection = null; this.cashDrawers = new List <CashDrawerVO>(); this.availableUsers = new List <CashDrawerUserVO>(); this.assignedPrimaryUsers = new List <CashDrawerUserVO>(); this.assignedAuxiliaryUsers = new List <CashDrawerUserVO>(); this.cashDrawerUserMap = new Dictionary <CashDrawerVO, PairType <CashDrawerUserVO, List <CashDrawerUserVO> > >(); this.cashDrawerDeleteMap = new Dictionary <CashDrawerVO, List <CashDrawerUserVO> >(); deleteMapping = new List <CashDrawerUserVO>(); updatedCashDrawerId = new List <string>(); }
/// <summary> /// /// </summary> /// <param name="cdVo"></param> private void updateAssignedUserList(CashDrawerVO cdVo) { if (cdVo == null) { return; } this.assignedUserListView.Items.Clear(); PairType <CashDrawerUserVO, List <CashDrawerUserVO> > mapping = this.cashDrawerUserMap[cdVo]; bool clearExistingList = true; if (mapping != null) { if (mapping.Left != null && mapping.Left.UserId != 0) { this.addUserToAssignedUserListView(mapping.Left, true); } if (CollectionUtilities.isNotEmpty(mapping.Right)) { foreach (CashDrawerUserVO cvo in mapping.Right) { if (cvo == null) { continue; } if (mapping.Left != null && mapping.Left.UserId == 0) { this.addUserToAssignedUserListView(cvo, true); } else { this.addUserToAssignedUserListView(cvo, false); } } } } }
/// <summary> /// /// </summary> /// <returns></returns> private bool retrieveCashDrawerDetails() { DesktopSession cds = GlobalDataAccessor.Instance.DesktopSession; this.cashDrawers = new List <CashDrawerVO>(); string storeNumber = cds.CurrentSiteId.StoreNumber; DataTable storeCashDrawerList; DataTable availCashDrawerUsersList; DataTable assignCashDrawerUsersList; DataTable auxCashDrawerUsersList; string errorCode; string errorText; if (!ShopProcedures.ExecuteGetCashDrawerDetails( GlobalDataAccessor.Instance.OracleDA, storeNumber, out storeCashDrawerList, out availCashDrawerUsersList, out assignCashDrawerUsersList, out auxCashDrawerUsersList, out errorCode, out errorText)) { MessageBox.Show("Cannot retrieve cash drawer details for this store"); return(false); } //Load cash drawers if (storeCashDrawerList != null && storeCashDrawerList.IsInitialized && storeCashDrawerList.Rows != null && storeCashDrawerList.Rows.Count > 0) { foreach (DataRow dR in storeCashDrawerList.Rows) { if (Utilities.GetStringValue(dR["name"]).Contains("SAFE") || Utilities.GetStringValue(dR["name"]).Contains("safe")) { continue; } CashDrawerVO cDrawer = new CashDrawerVO(); cDrawer.Id = Utilities.GetStringValue(dR["id"]); cDrawer.Name = Utilities.GetStringValue(dR["name"]); cDrawer.OpenFlag = Utilities.GetStringValue(dR["openflag"]); cDrawer.RegisterUserId = Utilities.GetStringValue(dR["registeruserid"]); cDrawer.NetName = Utilities.GetStringValue(dR["netname"]); cDrawer.BranchId = Utilities.GetStringValue(dR["branchid"]); this.cashDrawers.Add(cDrawer); } } //Load available cash drawer users this.availableUsers = new List <CashDrawerUserVO>(); if (availCashDrawerUsersList != null && availCashDrawerUsersList.IsInitialized && availCashDrawerUsersList.Rows != null && availCashDrawerUsersList.Rows.Count > 0) { foreach (DataRow dR in availCashDrawerUsersList.Rows) { CashDrawerUserVO cDrawUsr = getCashDrawerUser(dR); this.availableUsers.Add(cDrawUsr); } } //Load assigned cash drawer users if (assignCashDrawerUsersList != null && assignCashDrawerUsersList.IsInitialized && assignCashDrawerUsersList.Rows != null && assignCashDrawerUsersList.Rows.Count > 0) { foreach (DataRow dR in assignCashDrawerUsersList.Rows) { CashDrawerUserVO cDrawUsr = getCashDrawerUser(dR); this.assignedPrimaryUsers.Add(cDrawUsr); } } //Load auxiliary assigned cash drawer users if (auxCashDrawerUsersList != null && auxCashDrawerUsersList.IsInitialized && auxCashDrawerUsersList.Rows != null && auxCashDrawerUsersList.Rows.Count > 0) { foreach (DataRow dR in auxCashDrawerUsersList.Rows) { CashDrawerUserVO cDrawUsr = getCashDrawerUser(dR); cDrawUsr.ConnectedId = Utilities.GetStringValue(dR["ccduid"]); cDrawUsr.RegisterId = Utilities.GetStringValue(dR["cashdrawerid"]); this.assignedAuxiliaryUsers.Add(cDrawUsr); } } //Build user map this.buildInitalAssignedUserMap(); //Load data into shop cash mgmt form this.loadDataIntoForm(); return(true); }