public bool insert_doanhThuWash(doanhThuWashDTO doanhThu)
        {
            try
            {
                this.openConnection();

                SqlCommand cmd = new SqlCommand("INSERT INTO REVENUE_WASH (id, timeOut, totalFee)" +
                                                "VALUES (@id, @timeOut, @totalFee)", this.getConnection);
                cmd.Parameters.Add("@id", SqlDbType.NChar).Value         = doanhThu.id;
                cmd.Parameters.Add("@timeOut", SqlDbType.DateTime).Value = doanhThu.timeOut;
                cmd.Parameters.Add("@totalFee", SqlDbType.Int).Value     = doanhThu.totalFee;
                if (cmd.ExecuteNonQuery() == 1)
                {
                    return(true);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("Error: ", ex.Message);
            }
            finally
            {
                this.closeConnection();
            }
            return(false);
        }
Beispiel #2
0
 private void btnThanhToan_Click(object sender, EventArgs e)
 {
     try
     {
         if (this.dgvWash.CurrentRow != null)
         {
             string          id              = this.dgvWash.CurrentRow.Cells[0].Value.ToString();
             int             totalFee        = this.vehWashBUS.getWash_fee(id);
             doanhThuWashDTO doanhThuWashDTO = new doanhThuWashDTO(id, DateTime.Now, totalFee);
             if (this.dtWashBUS.insert_doanhThuWash(doanhThuWashDTO) && this.vehWashBUS.DeleteVehicleWash(id) && this.vehicleBUS.UpdateStatusVehicle(id, "WASH", 0))
             {
                 MessageBox.Show("Thanh toán thành công dịch vụ", "Info Wash", MessageBoxButtons.OK, MessageBoxIcon.Information);
                 if (!this.checkOtherService(id))
                 {
                     if (this.vehicleBUS.DelVehicle(id))
                     {
                         MessageBox.Show("Xóa Thành Công Trong Bảng VEHICLE", "Info Wash", MessageBoxButtons.YesNo, MessageBoxIcon.Information);
                     }
                     else
                     {
                         MessageBox.Show("Xóa Không Thành Công Trong Bảng VEHICLE", "Info Wash", MessageBoxButtons.YesNo, MessageBoxIcon.Information);
                     }
                 }
                 this.cbTypeFilter.SelectedIndex = 3;
                 DataTable table = this.vehWashBUS.getAllVehicleWash();
                 if (table != null)
                 {
                     this.designDataGridView(table, 2, 3);
                     this.lbCount.Text = "Số Lượng Xe: " + this.dgvWash.Rows.Count;
                 }
                 else
                 {
                     this.dgvWash.DataSource = null;
                     this.lbCount.Text       = "Số Lượng Xe: " + this.dgvWash.Rows.Count;
                 }
             }
             else
             {
                 MessageBox.Show("Thanh toán không thành công", "Info Wash", MessageBoxButtons.OK, MessageBoxIcon.Error);
             }
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }
Beispiel #3
0
 //insert
 public bool insert_doanhThuWash(doanhThuWashDTO washDTO)
 {
     return(this.dtWashDAl.insert_doanhThuWash(washDTO));
 }