Exemplo n.º 1
0
        public bool insertKHForQL(string maKH, string tenKH, string gender, string address, string phone, string TP, DateTime ngayBD, MemoryStream picture)
        {
            My_DB      mydb    = new My_DB();
            SqlCommand command = new SqlCommand("insert into QLKH(MaKh,TenKH ,GioiTinh,DiaChi,DienThoai,ThuePhong,NgayBatDau,CMND)"
                                                + " Values(@MKH, @tkh, @gt,@adr, @phone,@TP,@date,@pic)", mydb.GetConnection);

            command.Parameters.Add("@MKH", SqlDbType.VarChar).Value   = maKH;
            command.Parameters.Add("@tkh", SqlDbType.NVarChar).Value  = tenKH;
            command.Parameters.Add("@gt", SqlDbType.NVarChar).Value   = gender;
            command.Parameters.Add("@adr", SqlDbType.NVarChar).Value  = address;
            command.Parameters.Add("@phone", SqlDbType.VarChar).Value = phone;
            command.Parameters.Add("@TP", SqlDbType.VarChar).Value    = TP;
            command.Parameters.Add("@date", SqlDbType.DateTime).Value = ngayBD;
            command.Parameters.Add("@pic", SqlDbType.Image).Value     = picture.ToArray();


            mydb.openConnection();
            if ((command.ExecuteNonQuery() == 1))
            {
                mydb.closeConnection();
                return(true);
            }
            else
            {
                mydb.closeConnection();
                return(false);
            }
        }
Exemplo n.º 2
0
        public bool deleteBaoCao(int id)
        {
            SqlCommand command = new SqlCommand("DELETE FROM BaoCaoNgay WHERE Id = @Id", mydb.GetConnection);

            command.Parameters.Add("@Id", SqlDbType.Int).Value = id;
            mydb.openConnection();
            if ((command.ExecuteNonQuery() == 1))
            {
                mydb.closeConnection();
                return(true);
            }
            else
            {
                mydb.closeConnection();
                return(false);
            }
        }
Exemplo n.º 3
0
        public bool updateTPhong(string maP)
        {
            My_DB      mydb    = new My_DB();
            SqlCommand command = new SqlCommand("UPDATE TTPhong SET TrangThai = @TP where MaPhong = @mp", mydb.GetConnection);

            command.Parameters.Add("@TP", SqlDbType.Int).Value     = 0;
            command.Parameters.Add("@mp", SqlDbType.VarChar).Value = maP;
            mydb.openConnection();
            if ((command.ExecuteNonQuery() == 1))
            {
                mydb.closeConnection();
                return(true);
            }
            else
            {
                mydb.closeConnection();
                return(false);
            }
        }
Exemplo n.º 4
0
        public bool updateNGayKTForQL(string MAKH, DateTime NgayKT)
        {
            SqlCommand command = new SqlCommand("UPDATE QLKH SET NgayKetThuc = @NKT WHERE MaKH = @Ma", mydb.GetConnection);

            command.Parameters.Add("@Ma", SqlDbType.VarChar).Value   = MAKH;
            command.Parameters.Add("@NKT", SqlDbType.DateTime).Value = NgayKT;

            mydb.openConnection();
            if ((command.ExecuteNonQuery() == 1))
            {
                mydb.closeConnection();
                return(true);
            }
            else
            {
                mydb.closeConnection();
                return(false);
            }
        }
Exemplo n.º 5
0
        public bool insertNhanVien(int id, string fname, string lname, DateTime bdate, string gender, string phone, string address, MemoryStream picture, int CaLamViec)
        {
            SqlCommand command = new SqlCommand("insert into TTNV(IdNhanVien , Fname, Lname, Bdate, Gender, Phone, Address, Picture,CaLamViec)"
                                                + " Values(@id, @fn, @ln,@bdt, @gdr, @phn, @adrs, @pic,@Ca)", mydb.GetConnection);

            command.Parameters.Add("@id", SqlDbType.Int).Value        = id;
            command.Parameters.Add("@fn", SqlDbType.NVarChar).Value   = fname;
            command.Parameters.Add("@ln", SqlDbType.NVarChar).Value   = lname;
            command.Parameters.Add("@bdt", SqlDbType.DateTime).Value  = bdate;
            command.Parameters.Add("@gdr", SqlDbType.NVarChar).Value  = gender;
            command.Parameters.Add("@phn", SqlDbType.NVarChar).Value  = phone;
            command.Parameters.Add("@adrs", SqlDbType.NVarChar).Value = address;
            command.Parameters.Add("@pic", SqlDbType.Image).Value     = picture.ToArray();
            command.Parameters.Add("@Ca", SqlDbType.Int).Value        = CaLamViec;


            mydb.openConnection();
            if ((command.ExecuteNonQuery() == 1))
            {
                mydb.closeConnection();
                return(true);
            }
            else
            {
                mydb.closeConnection();
                return(false);
            }
        }