示例#1
0
        public bool suaChiTietCB(ChiTietChuyenBay ctCB)
        {
            SqlConnection sqlConnection = createConnection();

            try
            {
                sqlConnection.Open();
                string SQL = "UPDATE CHI_TIET_LICH_CHUYEN_BAY SET MaCB = '" + ctCB.MaCB + "', MaSBTrungGian = '" + ctCB.MaSBTrungGian + "', ThoiGianDung = '" + ctCB.ThoiGianDung + "', GhiChu = '" + ctCB.GhiChu + "' WHERE MaCT = '" + ctCB.MaCT + "'";

                SqlCommand cmd = new SqlCommand(SQL, sqlConnection);

                // Query và kiểm tra
                if (cmd.ExecuteNonQuery() > 0)
                {
                    return(true);
                }
            }
            catch (Exception e)
            {
                throw e;
            }
            finally
            {
                // Dong ket noi
                sqlConnection.Close();
            }
            return(false);
        }
示例#2
0
        public bool xoaChiTietCB(ChiTietChuyenBay ctCB)
        {
            SqlConnection sqlConnection = createConnection();

            try
            {
                sqlConnection.Open();
                string SQL = "DELETE CHI_TIET_LICH_CHUYEN_BAY WHERE MaCT = '" + ctCB.MaCT + "'";

                SqlCommand cmd = new SqlCommand(SQL, sqlConnection);

                // Query và kiểm tra
                if (cmd.ExecuteNonQuery() > 0)
                {
                    return(true);
                }
            }
            catch (Exception e)
            {
                throw e;
            }
            finally
            {
                // Dong ket noi
                sqlConnection.Close();
            }
            return(false);
        }
示例#3
0
        public bool themChiTietCB(ChiTietChuyenBay ctCB)
        {
            SqlConnection sqlConnection = createConnection();

            try
            {
                sqlConnection.Open();
                //SqlCommand cmd = new SqlCommand("INSERT INTO SAN_BAY(MaSB,TenSB) VALUES ('" + txtMaSB.Text + "',N'" + txtTenSB.Text + "')", con);
                string SQL = "INSERT INTO CHI_TIET_LICH_CHUYEN_BAY(MaCT, MaCB, MaSBTrungGian, ThoiGianDung, GhiChu) VALUES ('" + ctCB.MaCT + "', '" + ctCB.MaCB + "', '" + ctCB.MaSBTrungGian + "','" + ctCB.ThoiGianDung + "','" + ctCB.GhiChu + "')";

                SqlCommand cmd = new SqlCommand(SQL, sqlConnection);

                // Query và kiểm tra
                if (cmd.ExecuteNonQuery() > 0)
                {
                    return(true);
                }
            }
            catch (Exception e)
            {
                throw e;
            }
            finally
            {
                // Dong ket noi
                sqlConnection.Close();
            }
            return(false);
        }