Ejemplo n.º 1
0
        public DataTable LayTatCaNhanVien()
        {
            SqlConnection       connect   = new SqlConnection();
            SqlConnectionString constring = new SqlConnectionString();

            connect = SqlConnectionString.HamKetNoi();
            connect.Open();
            SqlCommand     cmd = new SqlCommand("sp_thongtinnhanvien", connect);
            DataTable      dtb = new DataTable();
            SqlDataAdapter da  = new SqlDataAdapter(cmd);

            da.Fill(dtb);
            connect.Close();
            return(dtb);
        }
Ejemplo n.º 2
0
        public DataTable LayTatCaSach()
        {
            SqlConnection       connect   = new SqlConnection();
            SqlConnectionString constring = new SqlConnectionString();

            connect = SqlConnectionString.HamKetNoi();
            connect.Open();
            SqlCommand     cmd = new SqlCommand("sp_loadthedocgia", connect);
            DataTable      dtb = new DataTable();
            SqlDataAdapter da  = new SqlDataAdapter(cmd);

            da.Fill(dtb);
            connect.Close();
            return(dtb);
        }
Ejemplo n.º 3
0
        public int XoaDocDia(string tendn)
        {
            SqlConnection       connect   = new SqlConnection();
            SqlConnectionString constring = new SqlConnectionString();

            connect = SqlConnectionString.HamKetNoi();
            connect.Open();
            SqlCommand cmd = new SqlCommand("sp_xoadocgia", connect);

            cmd.CommandType = CommandType.StoredProcedure;
            cmd.Parameters.Add("@hoten", SqlDbType.NVarChar);
            cmd.Parameters["@hoten"].Value = tendn;
            int k = cmd.ExecuteNonQuery();

            connect.Close();
            if (k > 0)
            {
                return(k);
            }
            return(0);
        }
Ejemplo n.º 4
0
        public int ThemNhanVien(DangNhap_DTO dtonv)
        {
            int                 k         = -1;
            SqlConnection       connect   = new SqlConnection();
            SqlConnectionString constring = new SqlConnectionString();

            connect = SqlConnectionString.HamKetNoi();
            connect.Open();
            SqlCommand cmd = new SqlCommand("sp_themnhanvien", connect);

            cmd.CommandType = CommandType.StoredProcedure;
            cmd.Parameters.Add("@tendn", SqlDbType.NVarChar);
            cmd.Parameters.Add("@pass", SqlDbType.NChar);
            cmd.Parameters.Add("@permiss", SqlDbType.Int);
            cmd.Parameters.Add("@diachi", SqlDbType.NVarChar);
            cmd.Parameters.Add("@sodienthoai", SqlDbType.NChar);
            cmd.Parameters.Add("@bophan", SqlDbType.NVarChar);
            cmd.Parameters.Add("@chucvu", SqlDbType.NVarChar);
            cmd.Parameters.Add("@bangcap", SqlDbType.NVarChar);
            cmd.Parameters.Add("@ngaysinh", SqlDbType.NChar);

            cmd.Parameters["@tendn"].Value       = dtonv._tendn;
            cmd.Parameters["@pass"].Value        = dtonv._pass;
            cmd.Parameters["@permiss"].Value     = dtonv._permiss;
            cmd.Parameters["@diachi"].Value      = dtonv._diachi;
            cmd.Parameters["@sodienthoai"].Value = dtonv._sodienthoai;
            cmd.Parameters["@bophan"].Value      = dtonv._bophan;
            cmd.Parameters["@chucvu"].Value      = dtonv._chucvu;
            cmd.Parameters["@bangcap"].Value     = dtonv._bangcap;
            cmd.Parameters["@ngaysinh"].Value    = dtonv._ngaysinh;

            k = cmd.ExecuteNonQuery();
            connect.Close();
            if (k > 0)
            {
                return(k);
            }

            return(0);
        }
Ejemplo n.º 5
0
        public int ThemDocGia(TheDocGia_DTO dtonv)
        {
            int                 k         = -1;
            SqlConnection       connect   = new SqlConnection();
            SqlConnectionString constring = new SqlConnectionString();

            connect = SqlConnectionString.HamKetNoi();
            connect.Open();
            SqlCommand cmd = new SqlCommand("sp_themdocgia", connect);

            cmd.CommandType = CommandType.StoredProcedure;
            cmd.Parameters.Add("@hoten", SqlDbType.NVarChar);
            cmd.Parameters.Add("@tennv", SqlDbType.NVarChar);
            cmd.Parameters.Add("@ngaysinh", SqlDbType.DateTime);
            cmd.Parameters.Add("@diachi", SqlDbType.NVarChar);
            cmd.Parameters.Add("@email", SqlDbType.NChar);
            cmd.Parameters.Add("@ngaylapthe", SqlDbType.DateTime);
            cmd.Parameters.Add("@maloai", SqlDbType.Int);

            cmd.Parameters["@hoten"].Value      = dtonv.Hoten;
            cmd.Parameters["@tennv"].Value      = dtonv.Tennv;
            cmd.Parameters["@ngaysinh"].Value   = dtonv.Ngaysinh;
            cmd.Parameters["@diachi"].Value     = dtonv.Diachi;
            cmd.Parameters["@email"].Value      = dtonv.Email;
            cmd.Parameters["@ngaylapthe"].Value = dtonv.Ngaylapthe;
            cmd.Parameters["@maloai"].Value     = dtonv.Maloai;

            k = cmd.ExecuteNonQuery();
            connect.Close();
            if (k > 0)
            {
                return(k);
            }

            return(0);
        }