private void tsbtnUpdateGuest_Click(object sender, EventArgs e) { int rowindex = dgvGuests.CurrentCell.RowIndex; List <string> cellsvalues = new List <string>(); for (int i = 0; i < 9; i++) { cellsvalues.Add(dgvGuests.Rows[rowindex].Cells[i].Value.ToString()); } AddUpdateGuestForm updateGuestForm = new AddUpdateGuestForm(); updateGuestForm.Text = "Update Guest"; updateGuestForm.btnOK.Text = "Update"; updateGuestForm.updateid = int.Parse(cellsvalues[0]); updateGuestForm.tbFName.Text = cellsvalues[1]; updateGuestForm.tbLName.Text = cellsvalues[2]; updateGuestForm.tbAddress.Text = cellsvalues[3]; updateGuestForm.tbCity.Text = cellsvalues[4]; updateGuestForm.tbState.Text = cellsvalues[5]; updateGuestForm.tbCountry.Text = cellsvalues[6]; updateGuestForm.tbPhone.Text = cellsvalues[7]; updateGuestForm.tbEmail.Text = cellsvalues[8]; updateGuestForm.changetype = true; updateGuestForm.ShowDialog(); this.guestSelectTableAdapter.Fill(this.hotel_BaseDataSet.GuestSelect); }
private void tsbtnEditProfile_Click(object sender, EventArgs e) { AddUpdateGuestForm updateprofileform = new AddUpdateGuestForm(); this.guestSelectTableAdapter.Fill(this.hotel_BaseDataSet.GuestSelect); foreach (DataRow r in hotel_BaseDataSet.GuestSelect.Rows) { if (r.Field <int>("ID") == User.guestID) { updateprofileform.tbFName.Text = r.Field <string>("FName"); updateprofileform.tbLName.Text = r.Field <string>("LName"); updateprofileform.tbAddress.Text = r.Field <string>("Address"); updateprofileform.tbCity.Text = r.Field <string>("City"); updateprofileform.tbState.Text = r.Field <string>("State"); updateprofileform.tbCountry.Text = r.Field <string>("Country"); updateprofileform.tbPhone.Text = r.Field <string>("Phone"); updateprofileform.tbEmail.Text = r.Field <string>("Email"); break; } } updateprofileform.updateid = User.guestID; updateprofileform.changetype = true; updateprofileform.tbFName.Text = User.fName; updateprofileform.tbLName.Text = User.lName; updateprofileform.Text = "Update Profile"; updateprofileform.btnOK.Text = "Update"; updateprofileform.ShowDialog(); }
private void tsbtnAddGuest_Click(object sender, EventArgs e) { AddUpdateGuestForm addguestform = new AddUpdateGuestForm(); addguestform.ShowDialog(); this.guestSelectTableAdapter.Fill(this.hotel_BaseDataSet.GuestSelect); }
static void Main() { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); AuthorizationForm auth = new AuthorizationForm(); auth.ShowDialog(); if (User.guestID == 0 && User.userTypeID == 1) { AddUpdateGuestForm addnewguest = new AddUpdateGuestForm(); addnewguest.tbFName.Text = User.fName; addnewguest.tbLName.Text = User.lName; addnewguest.Text = "Profile"; addnewguest.btnCancel.Visible = false; addnewguest.btnOK.Text = "OK"; addnewguest.ShowDialog(); } if (auth.logIn) { Application.Run(new MainForm()); } }