Beispiel #1
0
        /////// Sửa thành viên

        public bool suaGia(GiaTourDTO l)
        {
            try
            {
                _conn.Open();
                string     SQL = string.Format("UPDATE GIATOUR SET GIATIEN = {0} WHERE MAGIA = '{1}'", l.GiaTien1, l.MaGia1);
                SqlCommand cmd = new SqlCommand(SQL, _conn);

                if (cmd.ExecuteNonQuery() > 0)
                {
                    return(true);
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
            }
            finally
            {
                // Dong ket noi
                _conn.Close();
            }

            return(false);
        }
Beispiel #2
0
 private void button2_Click(object sender, EventArgs e)
 {
     if (txtMagia.Text != "" && txtGia.Text != "")
     {
         GiaTourDTO dto = new GiaTourDTO(txtMagia.Text, txtMatour.Text, float.Parse(txtGia.Text), txtBd.Text, txtKt.Text);
         if (bus1.suaGia(dto))
         {
             MessageBox.Show("Sửa thành công");
             dataGridView1.DataSource = bus.XemGiaTheoTour(txtMatour.Text);
         }
         else
         {
             MessageBox.Show("Sửa thất bại");
         }
     }
     txtMatour.Text = "";
     txtMagia.Text  = "";
 }
Beispiel #3
0
 private void btnAdd_Click(object sender, EventArgs e)
 {
     if (cbbMaTour.GetItemText(cbbMaTour.SelectedItem) != "" && txtBD.Text != "" && txtMa.Text != "" && txtGia.Text != "" && txtKT.Text != "")
     {
         String     maTour = cbbMaTour.GetItemText(cbbMaTour.SelectedItem);
         GiaTourDTO DTO    = new GiaTourDTO(txtMa.Text, maTour, float.Parse(txtGia.Text), txtBD.Text, txtKT.Text);
         if (bus.themGia(DTO))
         {
             MessageBox.Show("Thêm thành công");
             BangGia.DataSource = bus.getGiaTour();
         }
         else
         {
             MessageBox.Show("Thêm ko thành công");
         }
     }
     else
     {
         MessageBox.Show("Xin hãy nhập đầy đủ");
     }
 }
Beispiel #4
0
        public bool themGia(GiaTourDTO t)
        {
            try
            {
                _conn.Open();
                string     SQL = string.Format("INSERT INTO GIATOUR(MAGIA, GIATIEN, TGBD, TGKT, MATOUR) VALUES ('{0}', {1}, '{2}', '{3}', '{4}')", t.MaGia1, t.GiaTien1, t.TGBD1, t.TGKT1, t.MaTour1);
                SqlCommand cmd = new SqlCommand(SQL, _conn);
                if (cmd.ExecuteNonQuery() > 0)
                {
                    return(true);
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
            }
            finally
            {
                _conn.Close();
            }

            return(false);
        }
Beispiel #5
0
 public bool suaGia(GiaTourDTO l)
 {
     return(dal.suaGia(l));
 }
Beispiel #6
0
 public bool themGia(GiaTourDTO l)
 {
     return(dal.themGia(l));
 }