private void lkStoreLocation_EditValueChanged(object sender, EventArgs e)
        {
            int storeID = Convert.ToInt16(lkStoreLocation.EditValue);

            BLL.PhysicalStore phyStores = new BLL.PhysicalStore();
            phyStores.LoadAll();
            lkPhysicalStores.Properties.DataSource = phyStores.DefaultView;
            LoadMisplacedItems(storeID);
        }
 /// <summary>
 /// Generates the matrix for A new user.
 /// </summary>
 /// <param name="userID">The user ID.</param>
 public void GenerateMatrixForANewUser(int userID)
 {
     BLL.PhysicalStore phyStore = new PhysicalStore();
     phyStore.LoadAll();
     while (!phyStore.EOF)
     {
         BLL.UserPhysicalStore usrPhyStore = new UserPhysicalStore();
         usrPhyStore.AddNew();
         usrPhyStore.UserID = userID;
         usrPhyStore.PhysicalStoreID = phyStore.ID;
         usrPhyStore.CanAccess = false;
         usrPhyStore.IsDefault = false;
         usrPhyStore.Save();
         phyStore.MoveNext();
     }
 }
 public static bool DoesItNeedToBeRefreshed(int userID)
 {
     BLL.PhysicalStore phyStore = new PhysicalStore();
     phyStore.LoadAll();
     while (!phyStore.EOF)
     {
         BLL.UserPhysicalStore usrPhyStore = new UserPhysicalStore();
         usrPhyStore.LoadAllByUserAndStoreID(userID, phyStore.ID);
         if (usrPhyStore.RowCount == 0)
         {
             return true;
         }
         phyStore.MoveNext();
     }
     return false;
 }
 public static bool DoesItNeedToBeRefreshed(int userID)
 {
     BLL.PhysicalStore phyStore = new PhysicalStore();
     phyStore.LoadAll();
     while (!phyStore.EOF)
     {
         BLL.UserPhysicalStore usrPhyStore = new UserPhysicalStore();
         usrPhyStore.LoadAllByUserAndStoreID(userID, phyStore.ID);
         if (usrPhyStore.RowCount == 0)
         {
             return(true);
         }
         phyStore.MoveNext();
     }
     return(false);
 }
 /// <summary>
 /// Generates the matrix for A new user.
 /// </summary>
 /// <param name="userID">The user ID.</param>
 public void GenerateMatrixForANewUser(int userID)
 {
     BLL.PhysicalStore phyStore = new PhysicalStore();
     phyStore.LoadAll();
     while (!phyStore.EOF)
     {
         BLL.UserPhysicalStore usrPhyStore = new UserPhysicalStore();
         usrPhyStore.AddNew();
         usrPhyStore.UserID          = userID;
         usrPhyStore.PhysicalStoreID = phyStore.ID;
         usrPhyStore.CanAccess       = false;
         usrPhyStore.IsDefault       = false;
         usrPhyStore.Save();
         phyStore.MoveNext();
     }
 }
 /// <summary>
 /// Renews the matrix for A user.
 /// </summary>
 /// <param name="userID">The user ID.</param>
 public void RenewMatrixForAUser(int userID)
 {
     BLL.PhysicalStore phyStore = new PhysicalStore();
     phyStore.LoadAll();
     while (!phyStore.EOF)
     {
         BLL.UserPhysicalStore usrPhyStore = new UserPhysicalStore();
         this.LoadByUserAndStoreID(userID, phyStore.ID);
         if (this.RowCount == 0)
         {
             usrPhyStore.AddNew();
             usrPhyStore.UserID          = userID;
             usrPhyStore.PhysicalStoreID = phyStore.ID;
             usrPhyStore.CanAccess       = false;
             usrPhyStore.IsDefault       = false;
             usrPhyStore.Save();
         }
         phyStore.MoveNext();
     }
 }
 /// <summary>
 /// Renews the matrix for A user.
 /// </summary>
 /// <param name="userID">The user ID.</param>
 public void RenewMatrixForAUser(int userID)
 {
     BLL.PhysicalStore phyStore = new PhysicalStore();
     phyStore.LoadAll();
     while (!phyStore.EOF)
     {
         BLL.UserPhysicalStore usrPhyStore = new UserPhysicalStore();
         this.LoadByUserAndStoreID(userID, phyStore.ID);
         if (this.RowCount == 0)
         {
             usrPhyStore.AddNew();
             usrPhyStore.UserID = userID;
             usrPhyStore.PhysicalStoreID = phyStore.ID;
             usrPhyStore.CanAccess = false;
             usrPhyStore.IsDefault = false;
             usrPhyStore.Save();
         }
         phyStore.MoveNext();
     }
 }
 private void lkStoreLocation_EditValueChanged(object sender, EventArgs e)
 {
     int storeID = Convert.ToInt16(lkStoreLocation.EditValue);
     BLL.PhysicalStore phyStores = new BLL.PhysicalStore();
     phyStores.LoadAll();
     lkPhysicalStores.Properties.DataSource = phyStores.DefaultView;
     LoadMisplacedItems(storeID);
 }
        private void RefreshUserPhysicalStoreGrid(int userID)
        {
            BLL.PhysicalStore phyStores = new PhysicalStore();
            phyStores.LoadAll();
            BLL.UserPhysicalStore userPhyStore = new UserPhysicalStore();
            userPhyStore.LoadAllEntriesByUserID(userID);

            if (BLL.UserPhysicalStore.DoesItNeedToBeRefreshed(userID))
            {
                BLL.UserPhysicalStore usrPhyStore = new UserPhysicalStore();
                usrPhyStore.RenewMatrixForAUser(userID);

            }

            if (userPhyStore.RowCount == 0)
            {
                BLL.UserPhysicalStore usrPhyStore = new UserPhysicalStore();
                usrPhyStore.GenerateMatrixForANewUser(userID);
                RefreshUserPhysicalStoreGrid(userID);
            }
            else if (userPhyStore.RowCount >= phyStores.RowCount)
            {
                grdUserPhysicalStoreMatrix.DataSource = userPhyStore.DefaultView;
                lcUserPhysicalStoreMatrix.Visibility = DevExpress.XtraLayout.Utils.LayoutVisibility.Always;
            }
            else
            {
                BLL.UserPhysicalStore usrStore = new UserPhysicalStore();
                usrStore.RenewMatrixForAUser(userID);
                RefreshUserPhysicalStoreGrid(userID);
            }
        }
        /// <summary>
        /// Creates the default quaranteen.
        /// </summary>
        private static void CreateDefaultQuaranteen()
        {
            // create the quaranteen type shelf
            PhysicalStore ps = new PhysicalStore();
            ps.LoadAll();

            Shelf shlf = new Shelf();
            shlf.AddNew();

            shlf.ShelfCode = "A";
            shlf.StoreID = ps.ID;
            shlf.ShelfStorageType = Convert.ToInt32(StorageType.Quaranteen);
            shlf.Width = shlf.Height = shlf.Length = 1;
            shlf.Save();

            shlf.SavePalletLocationsInShelf(1, 1);
            shlf.SaveDimentions(1, 1, 1);
        }