public frmNhaCungCap_Them_CapNhat()
        {
            InitializeComponent();
                flag =0;
                dtoNCC = new VNhaCungCap_DTO();
                busNguyenLieu = new VNguyenLieu_BUS();
                busNCC = new VNhaCungCap_BUS();
                busChiTietNCC = new VChiTietNCC_BUS();

                dtNguyenLieu_Source = new DataTable();
                dtNguyenLieuChon_Source = new DataTable();
                dtNguyenLieuChon_Source.Columns.Add("TenNL", System.Type.GetType("System.String"));
                dtNguyenLieuChon_Source.Columns.Add("MaNL", System.Type.GetType("System.Int32"));
                dtNguyenLieuChon_Source.Columns.Add("Gia", System.Type.GetType("System.Double"));

                dtChiTietNCC = new DataTable();
                DtChiTietNCC.Columns.Add("MaNL", System.Type.GetType("System.Int32"));
                DtChiTietNCC.Columns.Add("MaNCC", System.Type.GetType("System.Int32"));
                DtChiTietNCC.Columns.Add("Gia", System.Type.GetType("System.Double"));
        }
Exemplo n.º 2
0
        public int InsertNhaCungCap(int mode, VNhaCungCap_DTO ncc, DataTable ChiTiet)
        {
            String store = "SPoV_InsertNhaCungCap";
            CreateCommand_StoreName(store);
            cm.Parameters.Add("@MaNCC", SqlDbType.Int).Direction = ParameterDirection.Output;
            cm.Parameters.Add("@TenNCC", SqlDbType.NVarChar);
            cm.Parameters.Add("@sdt", SqlDbType.NVarChar);
            cm.Parameters.Add("@DiaChi", SqlDbType.NVarChar);
            cm.Parameters.Add("@DiemUuTien", SqlDbType.Int);
            cm.Parameters.Add("@ChiTiet", SqlDbType.Structured);

            cm.Parameters["@TenNCC"].Value = ncc.TenNCC;
            cm.Parameters["@sdt"].Value = ncc.sdt;
            cm.Parameters["@DiaChi"].Value = ncc.DiaChi;
            cm.Parameters["@DiemUuTien"].Value = ncc.DiemUuTien;
            cm.Parameters["@ChiTiet"].Value = ChiTiet;

            ExecuteInsertUpdateDelete();
            return (int)cm.Parameters["@MaNCC"].Value;
        }
Exemplo n.º 3
0
 public int UpdatetNhaCungCap(int mode, VNhaCungCap_DTO ncc, DataTable ChiTiet)
 {
     return daoNhaCungCap.UpdateNhaCungCap( mode,ncc,ChiTiet);
 }
Exemplo n.º 4
0
 public int InsertNhaCungCap(int mode, VNhaCungCap_DTO ncc, DataTable ChiTiet)
 {
     return daoNhaCungCap.InsertNhaCungCap( mode,ncc,ChiTiet);
 }
Exemplo n.º 5
0
 private List<VNhaCungCap_DTO> ConvertToList(DataTable dt)
 {
     List<VNhaCungCap_DTO> ls = new List<VNhaCungCap_DTO>();
     foreach (DataRow row in dt.Rows)
     {
         VNhaCungCap_DTO ncc = new VNhaCungCap_DTO();
         ncc.MaNCC = (int)row.ItemArray[0];
         ncc.TenNCC = row.ItemArray[1].ToString();
         ncc.sdt = row.ItemArray[2].ToString();
         ncc.DiaChi = row.ItemArray[3].ToString();
         ncc.DiemUuTien = (int)row.ItemArray[4];
         ls.Add(ncc);
     }
     return ls;
 }