コード例 #1
0
 public dau_sach(dau_sach obj)
 {
     id                 = obj.id;
     ma_dau_sach        = obj.ma_dau_sach;
     ten_dau_sach       = obj.ten_dau_sach;
     id_loai_sach       = obj.id_loai_sach;
     tom_tat            = obj.tom_tat;
     id_nxb             = obj.id_nxb;
     so_luong_cuon_sach = obj.so_luong_cuon_sach;
     nam_xuat_ban       = obj.nam_xuat_ban;
     id_tac_gia         = obj.id_tac_gia;
     id_tinh_trang      = obj.id_tinh_trang;
     loai_sach          = obj.loai_sach;
     nha_xuat_ban       = obj.nha_xuat_ban;
 }
コード例 #2
0
        public DauSach_Sua(Models.dau_sach ds)
        {
            InitializeComponent();
            //id_dau_sach_sua.Text = ds.id.ToString();

            this.dau_sach_ins     = ds;
            ma_dau_sach_sua.Text  = ds.ma_dau_sach.ToString();
            ten_dau_sach_sua.Text = ds.ten_dau_sach.ToString();
            loai_sach_sua.Text    = ds.loai_sach.ten_loai.ToString();
            tom_tat_sua.Text      = ds.tom_tat.ToString();
            nxb_sua.Text          = ds.id_nxb.ToString();
            nam_xuat_ban_sua.Text = ds.nam_xuat_ban.ToString();
            tac_gia_sua.Text      = ds.id_tac_gia.ToString();
            tinh_trang_sua.Text   = ds.id_tinh_trang.ToString();

            //combobox
            var list_category = db.loai_sach.ToList().Select(i => new loai_sach(i)).ToList();

            loai_sach_sua.DataSource    = list_category;
            loai_sach_sua.DisplayMember = "ten_loai";
            loai_sach_sua.ValueMember   = "id";
            loai_sach_sua.SelectedValue = ds.loai_sach.id;

            //combobox
            var list_nxb = db.nha_xuat_ban.ToList().Select(i => new nha_xuat_ban(i)).ToList();

            nxb_sua.DataSource    = list_nxb;
            nxb_sua.DisplayMember = "ten_nxb";
            nxb_sua.ValueMember   = "id";
            nxb_sua.SelectedValue = ds.nha_xuat_ban.id;

            //combobox
            var list_tac_gia = db.tac_gia.ToList().Select(i => new tac_gia(i)).ToList();

            tac_gia_sua.DataSource    = list_tac_gia;
            tac_gia_sua.DisplayMember = "ho_ten";
            tac_gia_sua.ValueMember   = "id";
            tac_gia_sua.SelectedValue = ds.tac_gia.id;

            //combobox
            var list_tinh_trang = db.trang_thai.ToList().Select(i => new trang_thai(i)).ToList();

            tinh_trang_sua.DataSource    = list_tinh_trang;
            tinh_trang_sua.DisplayMember = "ten_trang_thai";
            tinh_trang_sua.ValueMember   = "id";
            tinh_trang_sua.SelectedValue = ds.trang_thai.id;
        }