private void Clear() { TXT_ROOM_NO.Clear(); CMB_ROOM_PKG.SelectedIndex = -1; CMB_ROOM_TYPE.SelectedIndex = -1; CMB_FLOOR.SelectedIndex = -1; TXT_DESCRIPTION.Clear(); room_id = 0; BTN_SAVE.Text = "SAVE"; TXT_ROOM_NO.Focus(); }
private void BTN_SAVE_Click(object sender, EventArgs e) { if (TXT_ROOM_NO.Text == string.Empty) { TXT_ROOM_NO.Focus(); MSGBOX mdg = new MSGBOX(MessageAlertHeder.Warning(), "PLEASE ENTER ROOM NO/NAME", MessageAlertImage.Warning()); mdg.ShowDialog(); } else if (CMB_ROOM_PKG.SelectedIndex < 0) { CMB_ROOM_PKG.Focus(); MSGBOX mdg = new MSGBOX(MessageAlertHeder.Warning(), "PLEASE SELECT ROOM PACKAGE", MessageAlertImage.Warning()); mdg.ShowDialog(); } else if (CMB_ROOM_TYPE.SelectedIndex < 0) { CMB_ROOM_TYPE.Focus(); MSGBOX mdg = new MSGBOX(MessageAlertHeder.Warning(), "PLEASE SELECT ROOM TYPE", MessageAlertImage.Warning()); mdg.ShowDialog(); } else if (CMB_FLOOR.SelectedIndex < 0) { CMB_FLOOR.Focus(); MSGBOX mdg = new MSGBOX(MessageAlertHeder.Warning(), "PLEASE SELECT THE FLOOR", MessageAlertImage.Warning()); mdg.ShowDialog(); } else { if (BTN_SAVE.Text == "SAVE") { string result = SAVE_ROOM(); if (result == "done") { MSGBOX mdg = new MSGBOX(MessageAlertHeder.Success(), "ROOM ADDED SUCCESSFULLY!", MessageAlertImage.Success()); mdg.ShowDialog(); DisableControls(); } } else if (BTN_SAVE.Text == "UPDATE") { string result = UPDATE_ROOM_DETAILS(); if (result == "done") { MSGBOX mdg = new MSGBOX(MessageAlertHeder.Success(), "ROOM DETAILS UPDATED SUCCESSFULLY!", MessageAlertImage.Success()); mdg.ShowDialog(); } } LOAD_ROOM_lIST(); } }