Exemplo n.º 1
0
        private void selectedItem()
        {
            LOAIPHONG lp = (from i in db.LOAIPHONGs where i.MaLoaiPhong == comboBox2.SelectedValue select i).FirstOrDefault();

            if (comboBox2.SelectedValue != null)
            {
                string pathI = comboBox2.SelectedValue.ToString();
                Bitmap bmp   = GetImageByName(pathI);
                pictureBox1.Image = bmp;
                txtthongtin.Text  = lp.TrangBi;
            }
        }
Exemplo n.º 2
0
 public Confirm(HOADON obj, string status)
 {
     InitializeComponent();
     db = new QuanLyHomestayEntities();
     lOAIPHONGBindingSource.DataSource = db.LOAIPHONGs.ToList();
     if (status.Equals("add"))
     {
         bindingSource1.DataSource = obj;
         hd = obj;
         LOAIPHONG p = (from i in db.LOAIPHONGs where i.MaLoaiPhong == obj.MaLoaiPhong select i).FirstOrDefault();
         textBox1.Text = p.TenLoaiPhong;
         this.status   = status;
     }
     else if (status.Equals("edit"))
     {
         bindingSource1.DataSource = obj;
         hd = obj;
         db.HOADONs.Attach(hd);
         unlock();
         this.status = status;
     }
 }