Exemplo n.º 1
0
        public bool TaoTaiKhoan(TaiKhoan tk)
        {
            string sql = @"INSERT INTO TaiKhoan VALUES('" + tk.Username + "', '" + tk.Password + "', " + tk.UserId + ")";

            try
            {
                var result = false;
                da.Connect();
                result = da.ExecuteNonQuery(sql) > 0;
                da.Disconnet();
                return(result);
            }
            catch (Exception)
            {
                return(false);
            }
        }
Exemplo n.º 2
0
        public bool ThemSanPham(SanPham sp)
        {
            string sql = @"INSERT INTO SanPham VALUES(N'" + sp.MaSp + "', N'" + sp.TenSp + "', " + sp.BaoHanh + ", Gia = " + sp.Gia + ")";

            try
            {
                var result = false;
                da.Connect();
                result = da.ExecuteNonQuery(sql) > 0;
                da.Disconnet();
                return(result);
            }
            catch (Exception e)
            {
                MessageBox.Show(e.Message);
                return(false);
            }
        }
Exemplo n.º 3
0
        public bool ThemNhaCungCap(NhaCungCap ncc)
        {
            string sql = @"INSERT INTO NhaCungCap VALUES(N'" + ncc.MaNCC + "', N'" + ncc.TenNCC + "', N'" + ncc.DiaChi + "', N'" + ncc.Sdt + "', N'" + ncc.Email + "', N'" + ncc.Website + "')";

            try
            {
                var result = false;
                da.Connect();
                result = da.ExecuteNonQuery(sql) > 0;
                da.Disconnet();
                return(result);
            }
            catch (Exception e)
            {
                MessageBox.Show(e.Message);
                return(false);
            }
        }