Example #1
0
        private void LoadInventory()
        {
            List <StockInventoryItem> lstKVA = new List <StockInventoryItem>();
            List <StockVoltages>      lstStockVoltages;

            rblWindings.Items.Clear();
            rblWindings.DataSource = StockInventoryItem.GetAllItems().Select(r => r.Windings).Distinct().ToList().OrderBy(e => e);
            rblWindings.DataBind();
            rblWindings.SelectedIndex = 0;

            ddVoltage.Items.Clear();

            lstStockVoltages = StockVoltages.GetAllItems().Where(s => s.Windings == rblWindings.Items[0].Text).ToList();
            lstStockVoltages.Insert(0, new StockVoltages());
            ddVoltage.DataSource     = lstStockVoltages;
            ddVoltage.DataTextField  = "StockVoltageDisplay";
            ddVoltage.DataValueField = "StockVoltage";
            ddVoltage.DataBind();

            ddKVA.Items.Clear();
            lstKVA.Insert(0, new StockInventoryItem());
            ddKVA.DataSource     = lstKVA;
            ddKVA.DataTextField  = "sKVA";
            ddKVA.DataValueField = "KVA";
            ddKVA.DataBind();
        }
Example #2
0
        protected void ddVoltage_SelectedIndexChanged(object sender, EventArgs e)
        {
            List <StockInventoryItem> lstKVA = new List <StockInventoryItem>();

            ddKVA.Items.Clear();

            lstKVA = StockInventoryItem.GetAllItems().Select(r => r)
                     .Where(t => (t.Windings == rblWindings.SelectedItem.Text) && (t.Configuration == ddVoltage.SelectedItem.Value))
                     .Distinct(new StockInventoryItemComparer()).ToList();

            lstKVA.Insert(0, new StockInventoryItem());
            ddKVA.DataSource     = lstKVA;
            ddKVA.DataTextField  = "sKVA";
            ddKVA.DataValueField = "KVA";
            ddKVA.DataBind();

            lblNoInventoryData.Text = "";
        }