private void GetDSSPandLoaiSP() { data_dssp = new DataTable(); data_dssp.Columns.Add("Mã SP", typeof(int)); data_dssp.Columns.Add("Tên", typeof(string)); data_dssp.Columns.Add("Loại", typeof(int)); spbus = new SANPHAMBUS(); //Khoi tao SANPHAMBUS de goi ham duoi controller List <SANPHAM> lst_sp = new List <SANPHAM>(); lst_sp = spbus.GetList(); foreach (SANPHAM sp in lst_sp) { data_dssp.Rows.Add(sp.ID, sp.TENSP, sp.IDLOAISP); // Add tung sanpham co trong DSSP vao data table } dsspgv_dh.DataSource = data_dssp; //gan du lieu cho data gridview cho dssp dsspgv_dh.Columns["Loại"].Visible = false; //==========================================================// List <LOAISP> lst_lsp = new List <LOAISP>(); lst_lsp = lspbus.GetList(); LOAISP tatca = new LOAISP(); tatca.ID = 0; tatca.TENLOAI = "Tất Cả"; lst_lsp.Add(tatca); cbb_lsp_dh.DataSource = lst_lsp; cbb_lsp_dh.DisplayMember = "TENLOAI"; cbb_lsp_dh.ValueMember = "ID"; cbb_lsp_dh.SelectedValue = 0; }
private void LoadDSSPvaLoaiSP() { //Khoi tao datatable San Pham data_dssp_xk = new DataTable(); data_dssp_xk.Columns.Add("ID", typeof(int)); data_dssp_xk.Columns.Add("Tên", typeof(string)); data_dssp_xk.Columns.Add("SL Tồn ", typeof(int)); data_dssp_xk.Columns.Add("Loại", typeof(int)); SANPHAMBUS spbus = new SANPHAMBUS(); //Khoi tao SANPHAMBUS de goi ham duoi controller LOAISPBUS lspbus = new LOAISPBUS(); List <SANPHAM> lst_sp = new List <SANPHAM>(); lst_sp = spbus.GetList(); foreach (SANPHAM sp in lst_sp) { data_dssp_xk.Rows.Add(sp.ID, sp.TENSP, sp.SLTON, sp.IDLOAISP); } dsspgv_xuatkho.DataSource = data_dssp_xk; //dsspgv_xuatkho.Columns["ID"].Width = 50; dsspgv_xuatkho.Columns["Loại"].Visible = false; //==========================================================// List <LOAISP> lst_lsp = new List <LOAISP>(); lst_lsp = lspbus.GetList(); cbb_lsp_xk.DataSource = lst_lsp; cbb_lsp_xk.DisplayMember = "TENLOAI"; cbb_lsp_xk.ValueMember = "ID"; }
private void btn_laydulieu_lsp_Click(object sender, EventArgs e) { LOAISPBUS lspbus = new LOAISPBUS(); List <LOAISP> lsp = new List <LOAISP>(); lsp = lspbus.GetList(); loaidgv.DataSource = lsp; loaidgv.Columns[1].HeaderText = "Tên Loại"; }
private void LoadDSSPvaLoaiSP() { //Khoi tao datatable San Pham data_dssp = new DataTable(); data_dssp.Columns.Add("ID", typeof(int)); data_dssp.Columns.Add("Tên", typeof(string)); data_dssp.Columns.Add("Đơn giá", typeof(int)); data_dssp.Columns.Add("SL bán", typeof(int)); data_dssp.Columns.Add("Loại", typeof(int)); //data_dssp_xk = new DataTable(); //data_dssp_xk.Columns.Add("ID", typeof(int)); //data_dssp_xk.Columns.Add("Tên", typeof(string)); //data_dssp_xk.Columns.Add("SL Tồn ", typeof(int)); //data_dssp_xk.Columns.Add("Loại", typeof(int)); SANPHAMBUS spbus = new SANPHAMBUS(); //Khoi tao SANPHAMBUS de goi ham duoi controller LOAISPBUS lspbus = new LOAISPBUS(); List <SANPHAM> lst_sp = new List <SANPHAM>(); lst_sp = spbus.GetList(); foreach (SANPHAM sp in lst_sp) { data_dssp.Rows.Add(sp.ID, sp.TENSP, sp.GIATIEN, sp.SLBAYBAN, sp.IDLOAISP);// Add tung sanpham co trong DSSP vao data table //data_dssp_xk.Rows.Add(sp.ID, sp.TENSP, sp.SLTON, sp.IDLOAISP); } dsspgv.DataSource = data_dssp; //gan du lieu cho data gridview cho dssp dsspgv.Columns["Loại"].Visible = false; //dsspgv_xuatkho.DataSource = data_dssp_xk; ////dsspgv_xuatkho.Columns["ID"].Width = 50; //dsspgv_xuatkho.Columns["Loại"].Visible = false; //==========================================================// List <LOAISP> lst_lsp = new List <LOAISP>(); lst_lsp = lspbus.GetList(); LOAISP tatca = new LOAISP(); tatca.ID = 0; tatca.TENLOAI = "Tất Cả"; lst_lsp.Add(tatca); cbloaisp.DataSource = lst_lsp; cbloaisp.DisplayMember = "TENLOAI"; cbloaisp.ValueMember = "ID"; }
private void LoadLSP() { LOAISPBUS lspbus = new LOAISPBUS(); List <LOAISP> lsp = new List <LOAISP>(); lsp = lspbus.GetList(); cbb_maloai.DataSource = lsp; cbb_maloai.ValueMember = "ID"; cbb_maloai.DisplayMember = "TENLOAI"; cbb_loaisp_ds.DataSource = cbb_maloai.DataSource; cbb_loaisp_ds.ValueMember = "ID"; cbb_loaisp_ds.DisplayMember = "TENLOAI"; cbb_lsp_ds_tk.DataSource = cbb_maloai.DataSource; cbb_lsp_ds_tk.ValueMember = "ID"; cbb_lsp_ds_tk.DisplayMember = "TENLOAI"; //----------------------// }