Exemple #1
0
        private void button1_Click(object sender, EventArgs e)   // Search Button
        {
            DataClasses1DataContext dbCon = new DataClasses1DataContext();
            int    roomNumber             = Int32.Parse(searchTxt.Text);
            RoomTB rb = dbCon.RoomTBs.SingleOrDefault(x => x.roomNumber == roomNumber);

            if (rb != null)
            {
                sRoomNoTxt.Text     = rb.roomNumber.ToString();
                sPriceTxt.Text      = rb.price.ToString();
                sStatusTxt.Text     = rb.status.ToString();
                sRoomNoTxt.ReadOnly = true;
                sPriceTxt.ReadOnly  = true;
                sStatusTxt.ReadOnly = true;

                sRoomNoTxt.Visible = true;
                sPriceTxt.Visible  = true;
                sStatusTxt.Visible = true;

                roomNoLabel.Visible = true;
                priceLabel.Visible  = true;
                statusLable.Visible = true;
            }
            else
            {
                MessageBox.Show("Data Not found");
            }
        }
        private void button2_Click(object sender, EventArgs e)      // confitm button
        {
            try
            {
                DataClasses1DataContext dbCon = new DataClasses1DataContext();
                customer cr = new customer();
                cr.name       = nameTxt.Text;
                cr.password   = Convert.ToInt32(passwordTxt.Text);
                cr.phone      = phoneTxt.Text;
                cr.Address    = addressTxt.Text;
                cr.date       = Convert.ToDateTime(dateTimePickerTxt.Text);
                cr.roomNumber = Convert.ToInt32(roomIdTxt.Text);
                RoomTB rm = dbCon.RoomTBs.SingleOrDefault(x => x.roomNumber == Convert.ToInt32(roomIdTxt.Text));
                if (rm != null)
                {
                    balance = Convert.ToDouble(rm.price);     // traking room price
                    if (MessageBox.Show("Are you want to confirm Room with price : " + balance + " ?", "BookingConfirmation", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                    {
                        dbCon.customers.InsertOnSubmit(cr);
                        dbCon.SubmitChanges();

                        this.Hide();
                        Form10 f10 = new Form10();
                        f10.Show();

                        transection tn = new transection();  // transection entry
                        tn.customerId = cr.customerId;
                        tn.balance    = balance;
                        dbCon.transections.InsertOnSubmit(tn);
                        dbCon.SubmitChanges();

                        record rd = new record();        // record entry
                        rd.customerId = cr.customerId;
                        rd.roomId     = Convert.ToInt32(cr.roomNumber);
                        rd.date       = cr.date;
                        cId           = cr.customerId; // traking customerId
                        dbCon.records.InsertOnSubmit(rd);
                        dbCon.SubmitChanges();
                        // MessageBox.Show("Data added to record");
                    }
                }
                else
                {
                    MessageBox.Show("There is no room in this content");
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("Data aren't insert correctly", "Error Message", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Exemple #3
0
        private void btnAdd_Click(object sender, EventArgs e)
        {
            DataClasses1DataContext dbCon = new DataClasses1DataContext();
            RoomTB rm = new RoomTB();

            rm.roomNumber = Int32.Parse(roomNoTxt.Text);
            rm.price      = Convert.ToDouble(priceTxt.Text);
            rm.status     = comboBox1.SelectedItem.ToString();
            dbCon.RoomTBs.InsertOnSubmit(rm);
            dbCon.SubmitChanges();
            MessageBox.Show("Room Added !!");
            this.roomTBTableAdapter.Fill(this.dBLinqDataSet3.RoomTB);
            roomNoTxt.Text = null;
            priceTxt.Text  = null;
            comboBox1.Text = null;
        }
Exemple #4
0
        private void btnDelete_Click(object sender, EventArgs e)
        {
            DataClasses1DataContext dbCon = new DataClasses1DataContext();
            int    roomNumber             = Int32.Parse(roomNoTxt.Text);
            RoomTB rb = dbCon.RoomTBs.SingleOrDefault(x => x.roomNumber == roomNumber);

            if (rb != null)
            {
                dbCon.RoomTBs.DeleteOnSubmit(rb);
                dbCon.SubmitChanges();
                MessageBox.Show("Data deleted ", "DeleteMessage");
                this.roomTBTableAdapter.Fill(this.dBLinqDataSet3.RoomTB);
                roomNoTxt.Text = null;
                priceTxt.Text  = null;
                comboBox1.Text = null;
            }
            else
            {
                MessageBox.Show("Data not found !!", "ErrorMessage", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Exemple #5
0
        private void btnUpdate_Click(object sender, EventArgs e)
        {
            DataClasses1DataContext dbCon = new DataClasses1DataContext();
            int    roomNumber             = Int32.Parse(roomNoTxt.Text);
            RoomTB rb = dbCon.RoomTBs.SingleOrDefault(x => x.roomNumber == roomNumber);

            if (rb != null)
            {
                rb.price  = Convert.ToDouble(priceTxt.Text);
                rb.status = comboBox1.SelectedItem.ToString();
                dbCon.SubmitChanges();
                MessageBox.Show("Data Updated !!");
                this.roomTBTableAdapter.Fill(this.dBLinqDataSet3.RoomTB);
                roomNoTxt.Text = null;
                priceTxt.Text  = null;
                comboBox1.Text = null;
            }
            else
            {
                MessageBox.Show("RoomNumber Can't Update ", "Error Message", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
 partial void DeleteRoomTB(RoomTB instance);
 partial void UpdateRoomTB(RoomTB instance);
 partial void InsertRoomTB(RoomTB instance);