protected override ICollection <Domain.Client> GetData()
        {
            ICollection <Domain.Client> clients = new Collection <Domain.Client>();
            var dbClients = new BLL.Institution();

            dbClients.LoadAll();
            while (!dbClients.EOF)
            {
                clients.Add(new Domain.Client {
                    ClientID = dbClients.ID, ClientName = dbClients.Name, Woreda = dbClients.WoredaName, Zone = dbClients.ZoneName, Region = dbClients.RegionName, InstitutionType = dbClients.InstitutionTypeName
                });
                dbClients.MoveNext();
            }
            return(clients);
        }
 private void btnAddReceivingUnit_Click(object sender, EventArgs e)
 {
     int ActiveStatus;
         int regionId = Convert.ToInt32(lkRegion.EditValue);
         int woredaID = Convert.ToInt32(lkWoreda.EditValue);
         int zoneID = Convert.ToInt32(lkZone.EditValue);
         int ruType = Convert.ToInt32(lkType.EditValue);
         int ownershipType = Convert.ToInt32(lkOwnership.EditValue);
         if (lkActive.Text.ToString().Equals("Active"))
             ActiveStatus = 1;
         else if (lkActive.Text.ToString().Equals("InActive"))
             ActiveStatus = 0;
         else
             ActiveStatus = -1;
      //   ReceivingUnitsForm con = new ReceivingUnitsForm(regionId, woredaID, zoneID, ruType, ownershipType, ActiveStatus);
      //   con.ShowDialog();
         Institution recUnit = new Institution();
         recUnit.LoadAll();
         LoadReceivingUnits();
 }
        private void ReceiveingForm_Load(object sender, EventArgs e)
        {
            SetPermissions();
            LoadDecimalFormatings();
            //Bind ReceiptType
            cboReceiveType.Properties.DataSource = ReceiptType.GetAllReceiptTypesForReceive();
            cboReceiveType.EditValue = ReceiptType.CONSTANTS.STANDARD_RECEIPT;

            //Bind the Receiving units Types Lookup
            InstitutionType institutionsTypes = new InstitutionType();
            institutionsTypes.LoadAll();
            institutionsTypes.Sort = "Name ASC";
            lkType.Properties.DataSource = institutionsTypes.DefaultView;
            lkType.EditValue = InstitutionType.Constants.HEALTH_CENTER;
            //---

            //Bind the Ownership Type Lookup
            LoadOwnershipType();
            lkOwnership.EditValue = OwnershipType.Constants.Public;
            LoadReceivingUnits();
            //----------------------------
            // reset the receiving date
            dtRecDate.Value = DateTimeHelper.ServerDateTime;
            // Load the logical stores and populate the combo boxes
            //lkStoreType.Properties.DataSource = BLL.StoreType.GetStoreTypesForAUser(NewMainWindow.UserId).DefaultView;
            lkAccounts.SetupActivityEditor().SetDefaultActivity();

            // Load the possible suppliers and populate

            // Load all occupied Pallet location list for the consolidate lookup editManuf2
            repoLKConsolidate.DataSource = PalletLocation.GetAllOccupied();

            // load the receiving unit's to the combo box
            Institution rus = new Institution();
            rus.LoadAll();
            lkFacilitySelection.Properties.DataSource = rus.DefaultView;

            lkStorageType.DataSource = StorageType.AllStorageTypes;

            // bulkPalletLocationLookup.DataSource = PalletLocation.GetAllFree(StorageType.BulkStore);
            nonBulkPalletLocationLookup.DataSource = PalletLocation.GetAllFreeNonBulk();
            //OnSelectedFilterChanged(new object(), new DevExpress.XtraEditors.Controls.ChangingEventArgs(null,"Drug"));

            // load all item Units
            ItemUnit itemUnit = new ItemUnit();
            itemUnit.LoadAll();
            editUnits.DataSource = itemUnit.DefaultView;

            lkCategories.Properties.DataSource = BLL.CommodityType.GetAllTypes();
            lkCategories.ItemIndex = 0;

            // Get the default who's receiving this
            txtReceivedBy.Text = CurrentContext.LoggedInUserName;

            // for RDF, Hide the packs column on receipt
            if (BLL.Settings.IsRdfMode)
            {
                colPacks.Visible = false;
            }

            //lcDeliveryNoteCheck.Visibility = BLL.Settings.HandleDeliveryNotes ? DevExpress.XtraLayout.Utils.LayoutVisibility.Always : DevExpress.XtraLayout.Utils.LayoutVisibility.Never;
            colPricePerPack.Visible = !BLL.Settings.HandleGRV && srm != true;
            lcRefNoInput.Visibility =
                lcRefNo.Visibility =
                    BLL.Settings.HandleGRV
                        ? DevExpress.XtraLayout.Utils.LayoutVisibility.Never
                        : DevExpress.XtraLayout.Utils.LayoutVisibility.Always;

            if (BLL.Settings.IsCenter)
            {
                colShipper.Visible = false;
                colPercentReceived.Visible = true;
                colPrintedDate.Visible = false;
                PalletizeTab.PageVisible = false;
                txtPassCode.Enabled = false;
                lcPassCode .Visibility = DevExpress.XtraLayout.Utils.LayoutVisibility.Always;
                tabReceiveTabs.TabPages[3].Text = "Step Three - Store Selection";
            }

            //Load the allowed Warehouses
            DataView PossibleWarehouses = BLL.Warehouse.getActiveWarehouseWithCluster(CurrentContext.UserId);
            lkWarehouse.Properties.DataSource = PossibleWarehouses;
            if (PossibleWarehouses.Count > 0)
            {
                lkWarehouse.EditValue = ((DataView)lkWarehouse.Properties.DataSource)[0]["ID"];
            }

            //Load IsElectronicReceiveOnly Setting
            LoadIsPOElectronicSetting();
        }
        public DataTable GetIssuesByReceivingUnit(int storeId, int routeId, int type, DateTime sdate, DateTime edate,int storeid)
        {
            //This function does not look efficient.
            var rus = new Institution();
            rus.LoadAll();
            rus.GetAllUnderRoute(routeId);

            string theFrom = "";
            int i = 0;
            while (!rus.EOF)
            {
                theFrom += HCMIS.Repository.Queries.Item.GetFromClauseFor_GetIssueByReceivingUnitsFilterByDateRange(rus.ID, i,sdate,edate, storeid);
                i++;
                rus.MoveNext();
            }
            string select = "";
            rus.Rewind();
            for (int j = 0; j < i; j++)
            {
                select = HCMIS.Repository.Queries.Item.GetSelectClauseFor_GetIssueByReceivingUnits(select, rus.Name, j);
                rus.MoveNext();
            }
            var query = HCMIS.Repository.Queries.Item.SelectGetIssuesByReceivingUnit(type, select, theFrom);
            Item ite =new Item();
            ite.LoadFromRawSql(query);
            return ite.DataTable;
        }
        private void DistributionReport_Load(object sender, EventArgs e)
        {
            dtFromFacilitySupply.Text = dtToTopFacilities.Text =  dtFrom.Text = @"7/7/2010";
            btnRefresh_Click(null, null);
            Institution institution = new Institution();

            institution.LoadAll();
            gridFacilities.DataSource = institution.DefaultView;

            gridTopFacilities.DataSource = BLL.Institution.GetTopReceivingUnits();
            //TODO: add a combo box for selection and change this 1 whenever that combo is changed
            gridItemList.DataSource = Item.GetActiveItemsByCommodityType(1, null);
            lkStoreType.SetupModeEditor().SetDefaultMode();
        }
 private void LoadReceivingUnits()
 {
     Institution rUnit = new Institution();
         rUnit.LoadAll();
         lkForHub.Properties.DataSource = rUnit.DefaultView;
 }
        private void lkType_EditValueChanged(object sender, EventArgs e)
        {
            if (lkAccountType.EditValue == null || lkAccountType.EditValue.ToString() == "")
            {
                return;
            }

            layoutForFacility.Text = "For Hub";
            layoutFromStore.Visibility = DevExpress.XtraLayout.Utils.LayoutVisibility.Never;

            Institution rUnits = new Institution();
            rUnits.LoadAll();
            lkForHub.Properties.DataSource = rUnits.DefaultView;

            lkForHub.Properties.NullText = "Select Hub to Transfer to";
            lkForHub.EditValue = null;

            ResetOrder();
            BindMainOrderGrid();
            PopulateItemsList();
        }
        private void MultiFacilityRequisition_Load(object sender, EventArgs e)
        {
            BLL.Institution institution = new Institution();
            institution.LoadAll();
            institution.AddColumn("IsSelected", typeof (bool));

            // bind the selected faciliteies to the selected grid
            _selectedFacilities = institution.DefaultView.Table.Clone();
            gridSelected.DataSource = _selectedFacilities;

            // bind the source table
            gridChoices.DataSource = institution.DefaultView;
        }