Exemplo n.º 1
0
 private void BindStocks()
 {
     using (MedicalDBEntityModelConnection context = new MedicalDBEntityModelConnection())
     {
         stockDetails = context.GET_StockDetails().ToList();
         if (stockDetails.Count > 0)
         {
             Dictionary <string, string> item = new Dictionary <string, string>();
             foreach (var s in stockDetails)
             {
                 item.Add(s.S_Id.ToString(), s.S_Name);
             }
             cboIName.DataSource                    = new BindingSource(item, null);
             cboIName.DisplayMember                 = "Value";
             cboIName.ValueMember                   = "Key";
             cboItemName.DataSource                 = new BindingSource(item, null);
             cboItemName.DisplayMember              = "Value";
             cboItemName.ValueMember                = "Key";
             this.cboIName.SelectedIndexChanged    += new System.EventHandler(cboIName_SelectedIndexChanged);
             this.cboItemName.SelectedIndexChanged += new System.EventHandler(cboItemName_SelectedIndexChanged);
             dgViewStock.DataSource                 = stockDetails;
             dgViewStock.Columns[0].Visible         = false;
         }
         else
         {
             cboIName.DataSource    = null;
             cboItemName.DataSource = null;
             dgViewStock.DataSource = null;
         }
     }
 }
Exemplo n.º 2
0
 private void BindStocks()
 {
     using (MedicalDBEntityModelConnection context = new MedicalDBEntityModelConnection())
     {
         stockdetails = context.GET_StockDetails().ToList();
         Dictionary <string, string> item = new Dictionary <string, string>();
         foreach (var s in stockdetails)
         {
             item.Add(s.S_Id.ToString(), s.S_Name);
         }
         cmbItemName.DataSource                 = new BindingSource(item, null);
         cmbItemName.DisplayMember              = "Value";
         cmbItemName.ValueMember                = "Key";
         this.cmbItemName.SelectedIndexChanged += new System.EventHandler(cmbItemName_SelectedIndexChanged);
     }
 }