Esempio n. 1
0
        public static bool InsertRoomBill(RoomBillDTO bill)
        {
            try
            {
                if (connection.State != ConnectionState.Open)
                {
                    connection.Open();
                }

                var command = new SqlCommand("ThemHoaDon", connection);
                command.CommandType = CommandType.StoredProcedure;
                command.Parameters.Add(new SqlParameter("@TenKhach", bill.CustomerName));
                command.Parameters.Add(new SqlParameter("@DiaChi", bill.CustomerAddress));
                command.Parameters.Add(new SqlParameter("@NgayHoaDon", bill.BillDate));
                command.Parameters.Add(new SqlParameter("@TriGia", bill.BillCost));
                command.ExecuteNonQuery();
                return(true);
            }
            catch
            {
                return(false);
            }
            finally
            {
                connection.Close();
            }
        }
Esempio n. 2
0
        public RoomBillDTO GetBillPayer()
        {
            var bill = new RoomBillDTO();

            bill.CustomerName    = this.tbBillCustomerName.Text;
            bill.CustomerAddress = this.rtbBillCustomerAddress.Text;
            bill.BillDate        = DateTime.ParseExact(this.deBillDate.Text, "d/M/yyyy", CultureInfo.InvariantCulture).ToString("M/d/yyyy");
            return(bill);
        }
Esempio n. 3
0
        private void BtnCreate_Click(object sender, EventArgs e)
        {
            if (this.tbChange.Text[0] == '-')
            {
                MessageBox.Show(
                    "Số tiền nhận chưa đủ tiền thanh toán",
                    "THANH TOÁN HOÁ ĐƠN THẤT BẠI",
                    MessageBoxButtons.OK,
                    MessageBoxIcon.Warning);
            }
            else
            {
                var BillDate = DateTime.ParseExact(this.tbBillDate.Text, "d/M/yyyy", CultureInfo.InvariantCulture);

                var bill = new RoomBillDTO();
                bill.BillDate        = DateTime.ParseExact(this.tbBillDate.Text, "d/M/yyyy", CultureInfo.InvariantCulture).ToString("d");
                bill.CustomerName    = this.tbBillCustomer.Text;
                bill.CustomerAddress = this.tbBillAddress.Text;
                bill.BillCost        = Convert.ToInt64(this.tbBillPrice.Text.Replace(",", ""));
                RoomBillBUS.InsertBill(bill);

                foreach (DataGridViewRow row in this.dgvBillData.Rows)
                {
                    var roomID = row.Cells["PaidRoomID"].Value.ToString();
                    var price  = Convert.ToInt64(row.Cells["PaidRoomTotalPrice"].Value.ToString().Replace(",", ""));
                    RoomLeaseBUS.InsertRoomLeasePayment(roomID, price);
                }

                MainForm mainForm = (MainForm)Owner;
                mainForm.ReLoadRoomData();
                mainForm.ReLoadAvailableRoom();
                mainForm.ReCreateBill();

                MessageBox.Show(
                    "Thanh toán hoá đơn thành công",
                    "THANH TOÁN HOÁ ĐƠN THÀNH CÔNG",
                    MessageBoxButtons.OK,
                    MessageBoxIcon.Information);

                this.Close();
            }
        }
Esempio n. 4
0
 public static bool InsertBill(RoomBillDTO bill)
 {
     return(RoomBillDAO.InsertRoomBill(bill));
 }