示例#1
0
        private void AddNewDoctor_Load(object sender, EventArgs e)
        {
            hospitalEntities     Hospital             = new hospitalEntities();
            List <Specification> DocSpecilizationList = Hospital.Specifications.ToList();
            DataTable            DT = new DataTable();

            DT.Columns.Add("SpecificationId");
            DT.Columns.Add("SpecificationName");
            Com_Specification.DataSource = DT;
            foreach (var item in DocSpecilizationList)
            {
                DT.Rows.Add(item.SpecificationId, item.SpecificationName);
            }
            Com_Specification.DisplayMember = DT.Columns [1].ColumnName;
            Com_Specification.ValueMember   = DT.Columns [0].ColumnName;

            List <ScientificDegree> DocDegreeList = Hospital.ScientificDegrees.ToList();
            DataTable DT1 = new DataTable();

            DT1.Columns.Add("ScientificDegreeId");
            DT1.Columns.Add("ScientificDegreeName");
            foreach (var item in DocDegreeList)
            {
                DT1.Rows.Add(item.ScientificDegreeId, item.ScientificDegreeName);
            }
            Com_Degree.DataSource    = DT1;
            Com_Degree.DisplayMember = DT1.Columns[1].ColumnName;
            Com_Degree.ValueMember   = DT1.Columns[0].ColumnName;
        }
示例#2
0
        private void But_Search_Click(object sender, EventArgs e)
        {
            hospitalEntities Hospital = new hospitalEntities();
            List <Supplier>  SupList  = Hospital.Suppliers.ToList();
            var FilterList            = (from s in SupList
                                         where s.SupplierName.Contains("" + txt_SearchText.Text + "")
                                         select new { s.SupplierName, s.SupplierId }).ToList();


            dataGridView1.DataSource            = FilterList;
            dataGridView1.Columns[1].Visible    = false;
            dataGridView1.Columns[0].HeaderText = "اسم المورد";
        }