Пример #1
0
        public bool update_khachhang(khachhang kh)
        {
            SqlCommand cmd = new SqlCommand();

            cmd.Connection  = cn.cnt;
            cmd.CommandType = CommandType.StoredProcedure;
            cmd.CommandText = @"update_khachhang";
            cmd.Parameters.AddWithValue("@id", kh.id);
            cmd.Parameters.AddWithValue("@ten", kh.name_kh);
            cmd.Parameters.AddWithValue("@gioitinh", kh.gioitinh);
            cmd.Parameters.AddWithValue("@ngaysinh", kh.ngaysinh);
            cmd.Parameters.AddWithValue("@diachi", kh.quequan);
            cmd.Parameters.AddWithValue("@phone", kh.sdt);
            cmd.Parameters.AddWithValue("@card", kh.sothe);
            cn.cnt.Open();
            int kp = cmd.ExecuteNonQuery();

            if (kp > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Пример #2
0
        public DataTable seach_khachhang_diachi(khachhang kh)
        {
            DataTable  dttb = new DataTable();
            SqlCommand cmd  = new SqlCommand();

            cmd.Connection  = cn.cnt;
            cmd.CommandType = CommandType.StoredProcedure;
            cmd.CommandText = @"seach_khachhang_diachi";
            cmd.Parameters.AddWithValue("@diachi", kh.quequan);

            SqlDataAdapter adt = new SqlDataAdapter(cmd);

            adt.Fill(dttb);

            return(dttb);
        }
Пример #3
0
        public bool delete_khachhang(khachhang kh)
        {
            SqlCommand cmd = new SqlCommand();

            cmd.Connection  = cn.cnt;
            cmd.CommandType = CommandType.StoredProcedure;
            cmd.CommandText = @"delete_khachhang";
            cmd.Parameters.AddWithValue("@id", kh.id);
            cn.cnt.Open();
            int kp = cmd.ExecuteNonQuery();

            if (kp > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Пример #4
0
        public DataTable seach_khachhang(khachhang kh)
        {
            DataTable  dttb = new DataTable();
            SqlCommand cmd  = new SqlCommand();

            cmd.Connection = cn.cnt;
            try
            {
                cmd.CommandType = CommandType.StoredProcedure;
                cmd.Parameters.AddWithValue("@name", kh.name_kh);
                cmd.CommandText = @"seach_khachhang";

                SqlDataAdapter adt = new SqlDataAdapter(cmd);

                adt.Fill(dttb);
            }
            catch (Exception)
            {
            }


            return(dttb);
        }