private void btn_MakeReserve_Click(object sender, EventArgs e) { DateTime Date = DateTime.Now; int DateCompare = DateTime.Compare(tp_Date.Value, Date); int ReservationCount = _sql.Get_Count("Count_Reservations", new string[] { "std_Id" }, new string[] { _student.ID.ToString() }); if (CheckReservation() == true) { MessageBox.Show("Already Reserved"); } else if (DateCompare < 0) { MessageBox.Show("Select a valid Date"); } else if (ReservationCount >= 2) { MessageBox.Show("You already have 2 reservations"); } else { string spName = "Insert_Reservation"; string[] param = { "Date", "std_ID", "d_ID", "s_ID" }; object[] value = { tp_Date.Value.ToShortDateString(), _student.ID, cmb_Device.SelectedValue, cmb_TimeSlot.SelectedValue }; _sql.ProcessDB(spName, param, value); dgv_Reservations.Refresh(); _utils.Load_DataGrid(dgv_Reservations, _sql, "Get_Reservations"); } }
private void btn_CancelReserv_Click(object sender, EventArgs e) { string sp_Name = "Cancel_Reservation"; string[] param = { "r_id", "std_id" }; object[] value = { txt_ReservationId.Text, _student.ID }; _sql.ProcessDB(sp_Name, param, value); dgv_Reservations.Refresh(); _utils.Load_DataGrid(dgv_Reservations, _sql, "Get_Reservations"); }
private void dgv_Devices_CellContentClick(object sender, DataGridViewCellEventArgs e) { if (dgv_Devices.Columns[e.ColumnIndex].Name == "Delete") { object[] values = { Convert.ToInt32(dgv_Devices.CurrentRow.Cells[1].Value.ToString()) }; string[] param = { "d_Id" }; _sql.ProcessDB("sp_RemoveDevice", param, values); dgv_Devices.Refresh(); _utils.Load_DataGrid(dgv_Devices, _sql, "sp_getDevices"); } }
private void btn_PassConfrim_Click(object sender, EventArgs e) { String sp_Name = "sp_ChangePassword"; string[] param = { "std_Id", "std_Pass" }; string[] val = { _student.ID.ToString(), txt_ChangePass.Text }; if (!_validate.checkEmpty(val)) { _sql.ProcessDB(sp_Name, param, val); MessageBox.Show("Password Changed"); } else if (!(txt_ChangePass.Text.Equals(txt_ChangePassConfirm))) { MessageBox.Show("Passwords Not Same!"); } else { MessageBox.Show("Please Fill the fields"); } }
private void btn_ChangePass_click(object sender, EventArgs e) { string[] fields = { _admin.a_id.ToString(), txt_currrent.Text, txt_new.Text }; string[] param = { "a_ID", "a_Pass", "a_NewPass" }; string sp_Name = "sp_ChangeAdminPass"; if (!_validate.checkEmpty(fields)) { _sql.ProcessDB(sp_Name, param, fields); MessageBox.Show("Password Updated"); } else { MessageBox.Show("Failed"); } }
private void btn_SignUp_Click(object sender, EventArgs e) { InitVariables(); bool isValidEmail = vl.IsValidEmail(txt_Email.Text); bool emptyFlag = vl.checkEmpty(fields); bool isValidPhone = vl.IsValidPhone(txt_Phone.Text); bool isValidPass = vl.IsValidPassword(txt_Pass.Text); bool IdPresent = vl.IdPresent(txt_Id.Text); if (emptyFlag == false && isValidEmail && isValidPhone && IdPresent == false && isValidPass) { sql.ProcessDB(sp_Name, param, value); MessageBox.Show("You are Registered!"); } else if (IdPresent) { MessageBox.Show("You are already Registered"); } else if (!isValidPass) { MessageBox.Show("Password should be more then 6 characters!"); } }