Example #1
0
        private void PopulateLookups()
        {
            // cmbFilterStorageTypes.DataSource = StorageType.GetDataTableWithAll;


            BLL.Shelf shelf = new BLL.Shelf();
            shelf.LoadForMergedView();
            gridShelfDetails.DataSource = shelf.DefaultView;

            lkStorageTypes.Properties.DataSource       = StorageType.AllStorageTypes;
            cmbStorageTypeFilter.Properties.DataSource = StorageType.AllStorageTypes;
            cmbStorageTypeFilter.EditValue             = StorageType.BulkStore;

            ps.LoadAll();
            gridPhysicalStore.DataSource = ps.DefaultView;

            psType.LoadAll();
            gridWarehouse.DataSource       = psType.DefaultView;
            lkPhysicalStoreType.DataSource = psType.DefaultView;

            lkWarehouse.Properties.DataSource = ps.DefaultView;
            lkEditWarehouse.DataSource        = ps.DefaultView;

            cluster.LoadAll();
            grdClusters.DataSource = cluster.DefaultView;
            lkCluster.DataSource   = cluster.DefaultView;

            gridShelves.DataSource = Shelf.AllShelves;
            gridShelvesView.ExpandAllGroups();
        }
 /// <summary>
 /// Gets the items on shelf.
 /// </summary>
 /// <param name="selectedRackID">The selected rack ID.</param>
 /// <returns></returns>
 public static DataTable GetItemsOnShelf(int selectedRackID)
 {
     string query = HCMIS.Repository.Queries.Shelf.SelectGetItemsOnShelf(selectedRackID);
     Shelf s = new Shelf();
     s.LoadFromRawSql(query);
     return s.DataTable;
 }
        private void lkStorageType_EditValueChanged(object sender, EventArgs e)
        {
            Shelf shlf = new Shelf();
            shlf.LoadShelvesByStorageType(lkStorageType.EditValue.ToString());
            lkRacks.Properties.DataSource = shlf.DefaultView;

            lkRacks.ItemIndex = 0;
        }
Example #4
0
        /// <summary>
        /// Gets the items on shelf.
        /// </summary>
        /// <param name="selectedRackID">The selected rack ID.</param>
        /// <returns></returns>
        public static DataTable GetItemsOnShelf(int selectedRackID)
        {
            string query = HCMIS.Repository.Queries.Shelf.SelectGetItemsOnShelf(selectedRackID);
            Shelf  s     = new Shelf();

            s.LoadFromRawSql(query);
            return(s.DataTable);
        }
        private void AddItem_Load(object sender, EventArgs e)
        {
            Shelf slf = new Shelf();
            DataTable dtSlf = slf.GetShelves();

            BLL.Program prog = new BLL.Program();
            prog.GetParentPrograms();
            cboPrograms.DataSource = prog.DefaultView;
            cboPrograms.SelectedIndex = -1;

            PopulateFields();

                ResetForHub();
        }
Example #6
0
        internal void LoadLabel()
        {
            Shelf shelf = new Shelf();
            shelf.LoadByPrimaryKey(this.ShelfID);
            this.Label = shelf.ShelfCode;
            
            ShelfRowColumn src = new ShelfRowColumn();
            src.LoadColumnsForShelf(this.ShelfID,this.Column);
            this.Label = this.Label;
            this.Label += "-" + src.Label;

            src.LoadRowForShelf(this.ShelfID, this.Row);
            this.Label += "-" + src.Label;

        }
        /// <summary>
        /// Saves the pallet locations in shelf.
        /// </summary>
        /// <param name="rows">The rows.</param>
        /// <param name="cols">The cols.</param>
        public void SavePalletLocationsInShelf(int rows, int cols)
        {
            // preserve the id of this shelf
            int id = this.ID;
            ShelfRowColumn src = new ShelfRowColumn();
            // check if the existing rows are null;
            if (this.IsColumnNull("Rows")) this.Rows = 0;
            if (this.IsColumnNull("Columns")) this.Columns = 0;
            this.Save();
            bool isColumnsChanged = (this.Columns != cols);
            bool isRowsChanged = (this.Rows != rows);

            PalletLocation pl = new PalletLocation();

            // Fix the row and columns if there are any new additions
            for (int i = this.Columns; i < cols; i++)
            {
                src.AddNew();
                src.ShelfID = id;
                src.Type = "Column";
                src.Index = i;
                src.Label = (i + 1).ToString();
                src.Save();
            }
            for (int i = this.Rows; i < rows; i++)
            {

                src.AddNew();
                src.ShelfID = id;
                src.Type = "Row";
                src.Index = i;
                src.Label = getChar(i).ToString();
                src.Save();
            }

            if (rows > this.Rows)
            {
                for (int i = this.Rows; i < rows; i++)
                {
                    for (int j = 0; j < cols; j++)
                    {
                        pl.AddNew();
                        pl.Column = j;
                        pl.Row = i;
                        pl.StorageTypeID = this.ShelfStorageType;
                        pl.ShelfID = id;
                        pl.LoadLabel();
                        pl.IsFullSize = true;
                        pl.IsExtended = false;
                        pl.IsEnabled = true;
                        pl.Width = this.Width;
                        pl.Height = 1;
                        pl.Length = 1;
                        pl.AvailableVolume = 0;
                        pl.UsedVolume = 0;
                        pl.Save();
                    }
                }
            }
            else if (rows < this.Rows)
            {
                this.LoadFromRawSql(HCMIS.Repository.Queries.Shelf.DeleteSavePalletLocationsInShelf(rows, id));
                this.LoadFromRawSql(HCMIS.Repository.Queries.Shelf.DeleteShelfRowColumnSavePalletLocationsInShelf(rows, id));
            }
            // if we have lost it for //rows < this.Rows
            this.LoadByPrimaryKey(id);

            if (cols > this.Columns)
            {

                for (int i = this.Columns; i < cols; i++)
                {

                    for (int j = 0; j < this.Rows; j++)
                    {

                        {
                            pl.AddNew();
                            pl.Column = i;
                            pl.Row = j;
                            pl.StorageTypeID = this.ShelfStorageType;
                            pl.ShelfID = id;
                            pl.LoadLabel();
                            pl.IsFullSize = true;
                            pl.IsExtended = false;
                            pl.IsEnabled = true;
                            pl.Width = this.Width;
                            pl.Height = 1;
                            pl.Length = 1;
                            pl.AvailableVolume = 0;
                            pl.UsedVolume = 0;
                            pl.Save();
                        }
                    }
                }
            }
            else if (cols < this.Columns)
            {
                this.LoadFromRawSql(HCMIS.Repository.Queries.Shelf.DeletePalletLocationSavePalletLocationsInShelf(cols, id));
                this.LoadFromRawSql(HCMIS.Repository.Queries.Shelf.DeleteFromShelfRowColumnSavePalletLocationsInShelf(cols, id));
            }
            this.FlushData();
            this.LoadByPrimaryKey(id);
            this.Rows = rows;
            this.Columns = cols;
            this.Save();

            if (isColumnsChanged)
            {
                FixLengthOfPalletLocations();
            }
            if (isRowsChanged)
            {
                FixHeightOfPalletLocations();
            }
            // make the approprait entry in the pick list locations
            if (this.ShelfStorageType.ToString() == StorageType.PickFace)
            {
                PickFace.FixPickFaceEntries();
            }

            FixVolume();

            //Find all Shelf pallet locations
            Shelf shelf = new Shelf();
            shelf.LoadFromRawSql(HCMIS.Repository.Queries.Shelf.SelectSavePalletLocationsInShelf(id));
            while (!shelf.EOF)
            {
                PalletLocation plc = new PalletLocation();
                plc.LoadByPrimaryKey(shelf.ID);
                plc.Label = string.Format("{0}-{1}-{2}", this.ShelfCode, plc.Column + 1, getChar(plc.Row));
                plc.Save();
                shelf.MoveNext();
            }
        }
        /// <summary>
        /// Gets the free in.
        /// </summary>
        /// <param name="selectedRackID">The selected rack ID.</param>
        /// <returns></returns>
        public static DataView GetFreeIn(int selectedRackID)
        {
            Shelf slf = new Shelf();
            slf.LoadByPrimaryKey(selectedRackID);

            string query = HCMIS.Repository.Queries.PalletLocation.SelectGetFreeIn(slf.ShelfStorageType, slf.ID);

            PalletLocation pl = new PalletLocation();
            pl.LoadFromRawSql(query);
            return pl.DefaultView;
        }
 private void lkStorageType_EditValueChanged(object sender, EventArgs e)
 {
     int storageTypeID = Convert.ToInt32(lkStorageType.EditValue);
     Shelf shlf = new Shelf();
     chartControl1.DataSource = shlf.GetUtilization(storageTypeID);
 }
        private void xpButton12_Click(object sender, EventArgs e)
        {
            Shelf slf = new Shelf();

            if(txtShelf.Text=="")
            {
                XtraMessageBox.Show("Please enter the bin code", "Error", MessageBoxButtons.OK,
                                    MessageBoxIcon.Error);
                return;
            }

            if (_shelfId != 0)
                slf.LoadByPrimaryKey(_shelfId);
            else
                slf.AddNew();
            slf.ShelfCode = txtShelf.Text;
            //slf.ShelfStorageType = int.Parse(cboType.SelectedItem.ToString());
            slf.Save();
            DataTable dtSlf = slf.GetShelves();
            PopulateShelves(dtSlf.DefaultView);
            ResetLocations();
            XtraMessageBox.Show("Bin Location Record Updated.", "Confirmation", MessageBoxButtons.OK,
                                MessageBoxIcon.Information);
        }
        /// <summary>
        /// Load the drop downs and tables
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void HospitalSettings_Load(object sender, EventArgs e)
        {
            Supplier sup = new Supplier();
            sup.LoadAll();
            PopulateSupplier(sup);

            Stores str = new Stores();
            str.LoadAll();
            PopulateStores(str);

            Shelf slf = new Shelf();
            DataTable dtSlf = slf.GetShelves();
            PopulateShelves(dtSlf.DefaultView);

            ReceivingUnits recUnit = new ReceivingUnits();
            recUnit.LoadAll();
            PopulateReceivingUnit(recUnit);

            DataTable dtdumin = new DataTable();
            dtdumin.Columns.Add("Value");
            dtdumin.Columns.Add("Month");
            object[] objdumin01 = { 0.25, "1 Weeks" };
            dtdumin.Rows.Add(objdumin01);
            object[] objdumin0 = { 0.5, "2 Weeks" };
            dtdumin.Rows.Add(objdumin0);
            object[] objdumin1 = { 0.75, ("3 Weeks") };
            dtdumin.Rows.Add(objdumin1);
            object[] objdumin2 = { 1, (1 + " Month") };
            dtdumin.Rows.Add(objdumin2);
            object[] objdumin3 = { 2, (2 + " Month") };
            dtdumin.Rows.Add(objdumin3);
            cboDUMin.DataSource = dtdumin;

            DataTable dtdumax = new DataTable();
            dtdumax.Columns.Add("Value");
            dtdumax.Columns.Add("Month");
            object[] objdumax01 = { 0.25, "1 Weeks" };
            dtdumax.Rows.Add(objdumax01);
            object[] objdumax010 = { 0.5, "2 Weeks" };
            dtdumax.Rows.Add(objdumax010);
            object[] objdumax011 = { 0.75, ("3 Weeks") };
            dtdumax.Rows.Add(objdumax011);
            object[] objdumax012 = { 1, (1 + " Month") };
            dtdumax.Rows.Add(objdumax012);
            object[] objdumax013 = { 2, (2 + " Month") };
            dtdumax.Rows.Add(objdumax013);
            cboDUMax.DataSource = dtdumax;
        }
        /// <summary>
        /// Prepares the Item Policy Form
        /// Loads combo boxes and populates fields
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void ItemPolicy_Load(object sender, EventArgs e)
        {
            Shelf slf = new Shelf();
            DataTable dtSlf = slf.GetShelves();

            Programs prog = new Programs();
            prog.GetParentPrograms();
            cboPrograms.DataSource = prog.DefaultView;
            cboPrograms.SelectedIndex = -1;

            if(VisibilitySetting.HandleUnits ==2)
            {
                txtQuantityPerPack.Enabled = false;
                txtText.Enabled = false;
                listBox1.Visible = true;
            }
            else if (VisibilitySetting.HandleUnits == 3)
            {
                txtQuantityPerPack.Enabled = true;
                txtText.Enabled = true;
                listBox1.Visible = true;
            }
            else
            {
                txtQuantityPerPack.Enabled = true;
                txtText.Enabled = true;
                listBox1.Hide();
            }
            PopulateFields();
        }
        private void OnFilterStorageTypeChanged(object sender, EventArgs e)
        {
            // populate the shelf grid

            Shelf s = new Shelf();
            if ( cmbStorageTypeFilter.EditValue != null && cmbStorageTypeFilter.EditValue.ToString() != "")
            {
                s.LoadForMergedView(cmbStorageTypeFilter.EditValue.ToString());
                gridShelfDetails.DataSource = s.DefaultView;
                s.LoadShelvesByStorageType(cmbStorageTypeFilter.EditValue.ToString());
            }
            else
            {
                s.LoadForMergedView();
                s.LoadAllShelves();
            }

            // populate the shelf combo box.
            cmbShelfCodes.Properties.DataSource = s.DefaultView;
            cmbShelfCodes.EditValue = null;
        }
 private void OnFilterByShelfChanged(object sender, EventArgs e)
 {
     Shelf s = new Shelf();
     if (cmbShelfCodes.EditValue != null && cmbShelfCodes.EditValue.ToString() != "")
     {
         s.LoadForMergedViewByShelfID(Convert.ToInt32(cmbShelfCodes.EditValue));
         gridShelfDetails.DataSource = s.DefaultView;
     }
     else
     {
         OnFilterStorageTypeChanged(new object(), new EventArgs());
     }
 }
 private void lkStorageTypes_EditValueChanged(object sender, EventArgs e)
 {
     DataRow dr = gridViewPhysicalStores.GetFocusedDataRow();
     int id = Convert.ToInt32(dr["ID"]);
     BLL.Shelf shelf = new Shelf();
     shelf.LoadByPrimaryKey(id);
     if (shelf.RowCount > 0)
     {
         shelf.ShelfStorageType = Convert.ToInt32(lkStorageTypes.EditValue);
         shelf.Save();
     }
     //BLL.PhysicalStore phStore = new PhysicalStore();
     //phStore.LoadByPrimaryKey(id);
     //phStore.PhysicalStoreTypeID = Convert.ToInt32(lkStorageTypes.EditValue);
     //phStore.Save();
     PopulateLookups();
 }
        internal void LoadLabel()
        {
            Shelf shelf = new Shelf();
            shelf.LoadByPrimaryKey(this.ShelfID);
            this.Label = shelf.ShelfCode;

            ShelfRowColumn src = new ShelfRowColumn();
            src.LoadColumnsForShelf(this.ShelfID,this.Column);
            this.Label = this.Label;
            this.Label += "-" + src.Label;

            src.LoadRowForShelf(this.ShelfID, this.Row);
            this.Label += "-" + src.Label;
        }
        private void LossAndAdjustment_Load(object sender, EventArgs e)
        {
            colWriteOff.Visible = false;
            btnAdjustment.Visible = false;
            btnCommit.Visible = false;

            SetPermission();
            BindQuarantine();
            // load the item categories

            lkCategories.Properties.DataSource = BLL.CommodityType.GetAllTypes();
            lkStore.SetupActivityEditor().SetDefaultActivity();

            Shelf shelf = new Shelf();
            shelf.LoadAllShelves();
            //lkRacks.Properties.DataSource = shelf.DefaultView;

            Item itms = new Item();
            gridItemList.DataSource = itms.GetAllItems(1);

            LossAndAdjustmentReason dr = new LossAndAdjustmentReason();
            dr.LoadAll();
            lkDisposalReasons1.DataSource = dr.DefaultView;
            lkDisposalReason2.DataSource = dr.DefaultView;
            lkDisposalReason2.NullText = "Select Reason";
            newpalletlocationrepositoryItemGridLookUpEdit.NullText = "Select New Pallet Location";

            if(!BLL.Settings.UseNewUserManagement)
            {
                // adjust the buttons according to previlages
                if (CurrentContext.LoggedInUser.UserType == UserType.Constants.FINANCE ||
                    CurrentContext.LoggedInUser.UserType == UserType.Constants.SUPER_ADMINISTRATOR)
                {
                    colWriteOff.Visible = true;
                    btnAdjustment.Visible = true;
                    btnCommit.Visible = true;
                    gridColAdjustments.Visible = true;
                }
                else
                {

                }
            }
            // set the default category
            lkCategories.ItemIndex = 0;
            lkCategories_EditValueChanged(null, null);
        }
        private void PopulateLookups()
        {
            // cmbFilterStorageTypes.DataSource = StorageType.GetDataTableWithAll;

            BLL.Shelf shelf = new BLL.Shelf();
            shelf.LoadForMergedView();
            gridShelfDetails.DataSource = shelf.DefaultView;

            lkStorageTypes.Properties.DataSource = StorageType.AllStorageTypes;
            cmbStorageTypeFilter.Properties.DataSource = StorageType.AllStorageTypes;
            cmbStorageTypeFilter.EditValue = StorageType.BulkStore;

            ps.LoadAll();
            gridPhysicalStore.DataSource = ps.DefaultView;

            psType.LoadAll();
            gridWarehouse.DataSource = psType.DefaultView;
            lkPhysicalStoreType.DataSource = psType.DefaultView;

            lkWarehouse.Properties.DataSource = ps.DefaultView;
            lkEditWarehouse.DataSource = ps.DefaultView;

            cluster.LoadAll();
            grdClusters.DataSource = cluster.DefaultView;
            lkCluster.DataSource = cluster.DefaultView;

            gridShelves.DataSource = Shelf.AllShelves;
            gridShelvesView.ExpandAllGroups();
        }
        private void cmbStorageType_SelectedIndexChanged(object sender, EventArgs e)
        {
            layoutStackStored.Visibility = DevExpress.XtraLayout.Utils.LayoutVisibility.Never;
            gridPickfaceLocationsContainer.Visibility = DevExpress.XtraLayout.Utils.LayoutVisibility.Never;
            isStorageTypeChanged = true;
            if (cmbStorageType.SelectedValue.ToString() == StorageType.BulkStore)
            {
                layoutStackStored.Visibility = DevExpress.XtraLayout.Utils.LayoutVisibility.Always;
                gridPickfaceLocationsContainer.Text = "Preffered Pallet Locations";
                // Bind it if possible.
                if (itemId != 0)
                {
                    PalletLocation pl = new PalletLocation();
                    pl.LoadPreferredLocationsFor(itemId);
                    lstPreferredPalletLocation.DataSource = pl.DefaultView;

                   // lstPreferredPalletLocation.DataSource = ipr.DefaultView;
                    gridPickfaceLocationsContainer.Visibility = DevExpress.XtraLayout.Utils.LayoutVisibility.Never;
                    grpPrefferedLocation.Visibility = DevExpress.XtraLayout.Utils.LayoutVisibility.Always;

                    // Bind Pickface Location

                    DataTable dt = pf.GetPalletLocationsForItemLookup(itemId);
                    DataRow drw = dt.NewRow();
                    //drw["ID"] = null;
                    drw["Label"] = "No Pick Face Location Set";
                    dt.Rows.Add(drw);
                    lkRepositoryPickFaces.DataSource = dt;

                    //pf.PalletLocationForItem(itemId);
                    pf.LoadPalletLocationForItemGrid(itemId);
                    gridPickfaceLocations.DataSource = pf.DefaultView;
                }
                layoutControlItem10.Visibility = DevExpress.XtraLayout.Utils.LayoutVisibility.Always;

            }
            else
            {

                grpPrefferedLocation.Text = @"Fixed Locations";
                grpPrefferedLocation.Visibility = DevExpress.XtraLayout.Utils.LayoutVisibility.Never;
                gridPickfaceLocationsContainer.Visibility = DevExpress.XtraLayout.Utils.LayoutVisibility.Never;
            }

            Shelf slf = new Shelf();
            slf.LoadShelvesByStorageType(cmbStorageType.SelectedValue.ToString());
            cmbRack.DataSource = slf.DefaultView;
        }
Example #20
0
        /// <summary>
        /// Saves the pallet locations in shelf.
        /// </summary>
        /// <param name="rows">The rows.</param>
        /// <param name="cols">The cols.</param>
        public void SavePalletLocationsInShelf(int rows, int cols)
        {
            // preserve the id of this shelf
            int            id  = this.ID;
            ShelfRowColumn src = new ShelfRowColumn();

            // check if the existing rows are null;
            if (this.IsColumnNull("Rows"))
            {
                this.Rows = 0;
            }
            if (this.IsColumnNull("Columns"))
            {
                this.Columns = 0;
            }
            this.Save();
            bool isColumnsChanged = (this.Columns != cols);
            bool isRowsChanged    = (this.Rows != rows);

            PalletLocation pl = new PalletLocation();

            // Fix the row and columns if there are any new additions
            for (int i = this.Columns; i < cols; i++)
            {
                src.AddNew();
                src.ShelfID = id;
                src.Type    = "Column";
                src.Index   = i;
                src.Label   = (i + 1).ToString();
                src.Save();
            }
            for (int i = this.Rows; i < rows; i++)
            {
                src.AddNew();
                src.ShelfID = id;
                src.Type    = "Row";
                src.Index   = i;
                src.Label   = getChar(i).ToString();
                src.Save();
            }

            if (rows > this.Rows)
            {
                for (int i = this.Rows; i < rows; i++)
                {
                    for (int j = 0; j < cols; j++)
                    {
                        pl.AddNew();
                        pl.Column        = j;
                        pl.Row           = i;
                        pl.StorageTypeID = this.ShelfStorageType;
                        pl.ShelfID       = id;
                        pl.LoadLabel();
                        pl.IsFullSize      = true;
                        pl.IsExtended      = false;
                        pl.IsEnabled       = true;
                        pl.Width           = this.Width;
                        pl.Height          = 1;
                        pl.Length          = 1;
                        pl.AvailableVolume = 0;
                        pl.UsedVolume      = 0;
                        pl.Save();
                    }
                }
            }
            else if (rows < this.Rows)
            {
                this.LoadFromRawSql(HCMIS.Repository.Queries.Shelf.DeleteSavePalletLocationsInShelf(rows, id));
                this.LoadFromRawSql(HCMIS.Repository.Queries.Shelf.DeleteShelfRowColumnSavePalletLocationsInShelf(rows, id));
            }
            // if we have lost it for //rows < this.Rows
            this.LoadByPrimaryKey(id);

            if (cols > this.Columns)
            {
                for (int i = this.Columns; i < cols; i++)
                {
                    for (int j = 0; j < this.Rows; j++)
                    {
                        {
                            pl.AddNew();
                            pl.Column        = i;
                            pl.Row           = j;
                            pl.StorageTypeID = this.ShelfStorageType;
                            pl.ShelfID       = id;
                            pl.LoadLabel();
                            pl.IsFullSize      = true;
                            pl.IsExtended      = false;
                            pl.IsEnabled       = true;
                            pl.Width           = this.Width;
                            pl.Height          = 1;
                            pl.Length          = 1;
                            pl.AvailableVolume = 0;
                            pl.UsedVolume      = 0;
                            pl.Save();
                        }
                    }
                }
            }
            else if (cols < this.Columns)
            {
                this.LoadFromRawSql(HCMIS.Repository.Queries.Shelf.DeletePalletLocationSavePalletLocationsInShelf(cols, id));
                this.LoadFromRawSql(HCMIS.Repository.Queries.Shelf.DeleteFromShelfRowColumnSavePalletLocationsInShelf(cols, id));
            }
            this.FlushData();
            this.LoadByPrimaryKey(id);
            this.Rows    = rows;
            this.Columns = cols;
            this.Save();

            if (isColumnsChanged)
            {
                FixLengthOfPalletLocations();
            }
            if (isRowsChanged)
            {
                FixHeightOfPalletLocations();
            }
            // make the approprait entry in the pick list locations
            if (this.ShelfStorageType.ToString() == StorageType.PickFace)
            {
                PickFace.FixPickFaceEntries();
            }

            FixVolume();

            //Find all Shelf pallet locations
            Shelf shelf = new Shelf();

            shelf.LoadFromRawSql(HCMIS.Repository.Queries.Shelf.SelectSavePalletLocationsInShelf(id));
            while (!shelf.EOF)
            {
                PalletLocation plc = new PalletLocation();
                plc.LoadByPrimaryKey(shelf.ID);
                plc.Label = string.Format("{0}-{1}-{2}", this.ShelfCode, plc.Column + 1, getChar(plc.Row));
                plc.Save();
                shelf.MoveNext();
            }
        }
        private bool IsPutawayValid()
        {
            // Check if there is any Empty Put away location
            Dictionary<int, string> keyed = new Dictionary<int, string>();
            Boolean isValid = true;

            // Validate Non Palletized locations
            foreach (DataRow dr in _dtPutAwayNonPalletized.Rows)
            {
                dr.ClearErrors();
                if (dr["PutAwayLocation"] == null || dr["PutAwayLocation"].ToString() == "")
                {
                    dr.SetColumnError("PutAwayLocation", "Cannot be null");
                    isValid = false;
                }
                if (dr["Palletized Quantity"] == null || dr["Palletized Quantity"].ToString() == "")
                {
                    dr.SetColumnError("Palletized Quantity", "Cannot be null");
                    isValid = false;
                }
            }

            //validate Palletized putaway
            foreach (DataRow dr in _dtPutAwayPalletized.Rows)
            {
                dr.ClearErrors();
                if (dr["PutAwayLocation"] == null)
                {
                    dr.SetColumnError("PutAwayLocation", "Cannot be null");
                    isValid = false;
                }
                else
                {
                    //If it is not free, different pallets cannot be put on the same location.
                    int putAwayLocation = int.Parse(dr["PutAwayLocation"].ToString());
                    BLL.PalletLocation pl = new PalletLocation();
                    pl.LoadByPrimaryKey(putAwayLocation);
                    BLL.Shelf shelf = new Shelf();
                    shelf.LoadByPrimaryKey(pl.ShelfID);

                    if (shelf.ShelfStorageType.ToString() != BLL.StorageType.Free)
                    {
                        try
                        {
                            keyed.Add(Convert.ToInt32(dr["PutAwayLocation"]), "");
                        }
                        catch
                        {
                            dr.SetColumnError("PutAwayLocation", "Different Pallets put on the same Location");
                            isValid = false;
                        }
                    }
                    else
                    {
                        ////If the location type is free.  We allow consolidation
                        DataRow[] rows =
                            _dtPalletizedItemList.Select(string.Format("PalletNumber={0}", dr["PalletNumber"].ToString()));
                        foreach (DataRow row in rows)
                        {
                            row["Consolidate"] = true;
                            row["IsStoredInFreeStorageType"] = true;
                        }
                    }
                }

            }
            return isValid;
        }
        private void gridBinLocationView_FocusedRowChanged(object sender,
                                                           DevExpress.XtraGrid.Views.Base.FocusedRowChangedEventArgs e)
        {
            DataRow dr = gridBinLocationView.GetFocusedDataRow();

            if (dr != null)
            {
                int selected = Convert.ToInt32(dr["ID"]);
                Shelf slf = new Shelf();
                slf.LoadByPrimaryKey(selected);
                if (slf.RowCount > 0)
                {
                    txtShelf.Text = slf.ShelfCode;
                    if (!slf.IsColumnNull("StoreID"))
                        cboStore.SelectedValue = slf.StoreID.ToString();
                    if (!slf.IsColumnNull("ShelfStorageType"))
                    {
                        cboType.SelectedValue = slf.ShelfStorageType;
                    }
                    shelfId = slf.ID;
                }
                btnLocationsave.Text = "Update";
            }
        }
        /// <summary>
        /// Update the form based on the selected shelf
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void listView1_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (lstShelfs.SelectedItems.Count > 0)
            {
                int selected = Convert.ToInt32(lstShelfs.SelectedItems[0].Tag);
                Shelf slf = new Shelf();
                slf.LoadByPrimaryKey(selected);
                txtShelf.Text = slf.ShelfCode;
                cboStore.SelectedValue = slf.StoreID.ToString();
                if (slf.IsColumnNull("ShelfStorageType"))
                {
                    slf.ShelfStorageType = 1;
                }

                cboType.SelectedValue = slf.ShelfStorageType;

                _shelfId = slf.ID;
                btnLocationsave.Text = "Update";
            }
        }
        private void HospitalSettings_Load(object sender, EventArgs e)
        {
            SetPermissions();

            Supplier sup = new Supplier();
            sup.LoadAll();
            PopulateSupplier(sup);

            PopulateStores();

            Shelf slf = new Shelf();
            DataTable dtSlf = slf.GetShelves();
            PopulateShelves(dtSlf.DefaultView);

            LoadIssueLocations();

            AdjustLabelsForHub();
        }
 private void lkStorageType2_EditValueChanged(object sender, EventArgs e)
 {
     Shelf shlf = new Shelf();
     int storageType = Convert.ToInt32(lkStorageType2.EditValue);
     shlf.LoadShelvesByStorageType(storageType.ToString());
     lkRackID2.Properties.DataSource = shlf.DefaultView;
     if (shlf.RowCount > 0)
     {
         lkRackID2.EditValue = shlf.ID;
         //lookUpEdit1_EditValueChanged(new object(), new EventArgs());
     }
 }
 private void btnSaveShelf_Click(object sender, EventArgs e)
 {
     Shelf slf = new Shelf();
     if (shelfId != 0)
         slf.LoadByPrimaryKey(shelfId);
     else
         slf.AddNew();
     slf.ShelfCode = txtShelf.Text;
     slf.ShelfStorageType = int.Parse(cboType.SelectedItem.ToString());
     slf.Save();
     DataTable dtSlf = slf.GetShelves();
     PopulateShelves(dtSlf.DefaultView);
     ResetLocations();
 }
 private void lkStorageType2_EditValueChanged(object sender, EventArgs e)
 {
     Shelf shlf = new Shelf();
     int storageType = Convert.ToInt32(lkStorageType2.EditValue);
     shlf.LoadShelvesByStorageType(storageType.ToString(),(int)lkPhysicalStore.EditValue);
     lkRackID2.Properties.DataSource = shlf.DefaultView;
     if (shlf.RowCount > 0)
     {
         lkRackID2.EditValue = shlf.ID;
     }
     else
     {
         gridItemMovementView.Columns.Clear();
         gridItemDetailByLocation.DataSource = null;
     }
 }
        /// <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);
        }