protected void btnOk_Click(object sender, EventArgs e) { try { int selected_userId; UserClass uc = new UserClass(); PatientClass pc = new PatientClass(); UserPatientClass upc = new UserPatientClass(); LogUserClass luc = new LogUserClass(); LogPatientClass lpc = new LogPatientClass(); /*Delete Users' and Patient's record * Insert values on Log_UsersWholeFieldWithName and Log_PatientWholeFieldWithName table*/ /*Getting userId from username from Users table*/ DataTable dt = uc.SelectAllUsersFromUsername(Session["selectedRow_Username"].ToString()); if (dt.Rows.Count > 0) { Session["selected_userId"] = dt.Rows[0]["userId"].ToString(); selected_userId = Convert.ToInt32(Session["selected_userId"]); /*Getting patientRecord from userId from Patient table*/ DataTable dtPatient = pc.SelectAllPatientFromUserId(selected_userId); if (dtPatient.Rows.Count > 0) { Session["selected_patientId"] = dtPatient.Rows[0]["patientId"].ToString(); int selected_patientId = Convert.ToInt32(Session["selected_patientId"]); String selected_patientFirstName = dtPatient.Rows[0]["patientFirstName"].ToString(); String selected_patientMiddleName = dtPatient.Rows[0]["patientMiddleName"].ToString(); String selected_patientLastName = dtPatient.Rows[0]["patientLastName"].ToString(); Session["selected_patientName"] = selected_patientFirstName + " " + selected_patientMiddleName + " " + selected_patientLastName; luc.insertOn_Log_UsersWholeFieldWithName_WithDeleteOperation(selected_userId, Session["selectedRow_Username"].ToString()); lpc.insertOn_Log_PatientWholeFieldWithName_WithDeleteOperation(selected_userId, selected_patientId, Session["selected_patientName"].ToString()); uc.delete_UsersFrom_userId(selected_userId); pc.delete_PatientFrom_userId(selected_userId); } //else { ltrMessage.Text = "Error 2nd if"; } } //else { ltrMessage.Text += "Error 1st if"; } } catch (Exception ex) { ltrMessage.Text = ex.Message; } finally { ltrDelMsg.Visible = false; btnOk.Visible = false; loadData(); } }
protected void btnRegister_Click(object sender, EventArgs e) { try { /*Check normal conditions*/ /*Passwords matching checking*/ if (txtboxPassword.Text != txtboxConfirmPassword.Text) { ltrMessage.Text = "The Passwords did not match!"; } /*2 emails matching checking*/ else if (txtboxEmail.Text == txtboxSecEmail.Text) { ltrMessage.Text = "The 2 Email addresses you provided should not be same!"; } /*2 contacts matching checking*/ else if (txtboxContact.Text == txtboxSecContact.Text) { ltrMessage.Text = "The 2 Contact Numbers you provided should not be same!"; } else { ltrMessage.Text = ""; /*Putting Country as Nepal by default*/ String country; if (txtboxCountry.Text == "") { country = "Nepal"; //Console.WriteLine("Went to this condition!"); } else { country = txtboxCountry.Text; } UserEntryUserClass ueuc = new UserEntryUserClass(); LogUserClass luc = new LogUserClass(); LogEntryUserClass leuc = new LogEntryUserClass(); String entryUserDesignation = txtboxDesignation.Text; String entryUserHospital = dropdownlist_Hospital.SelectedValue; dropdownlist_Hospital.Items.Insert(0, entryUserHospital); int entryUserRegisteredby = Convert.ToInt32(Session["userId"]);; String entryUserInactiveOrActive = "Active"; ueuc.RegisterEntryUser_Users(txtboxUsername.Text, txtboxPassword.Text, txtboxEmail.Text, txtboxSecEmail.Text); ueuc.RegisterEntryUser_EntryUser(entryUserDesignation, entryUserHospital, entryUserRegisteredby, entryUserInactiveOrActive, txtboxUsername.Text, txtboxFirstName.Text, txtboxMiddleName.Text, txtboxLastName.Text, txtboxDob.Text, dropdownlistGender.Text, txtboxContact.Text, txtboxSecContact.Text, txtboxHouseAdd.Text, txtboxDistrict.Text, txtboxCity.Text, country); String username = txtboxUsername.Text; luc.insertOn_Log_UsersWholeField_WithInsertOperation(username); leuc.insertOn_Log_EntryUserWholeField_WithInsertOperation(username); Response.Redirect("EntryUserForm_OtherUserMaster.aspx"); } } catch (Exception ex) { ltrMessage.Text = ex.Message; } }
protected void btnRegister_Click(object sender, EventArgs e) { try { UserPatientClass upc = new UserPatientClass(); LogUserClass luc = new LogUserClass(); LogPatientClass lpc = new LogPatientClass(); /*Check normal conditions*/ //1. Checking Patient Age Group if not <1 DateTime currentDateNTime = DateTime.Now; int currentYear = currentDateNTime.Year; //Getting current year DateTime dob; dob = Convert.ToDateTime(txtboxDob.Text); int dobYear = dob.Year; //Getting dob year int age = currentYear - dobYear; if (age < 1) { ltrMessage.Text = "Invalid Date of Birth!"; } /*Passwords matching checking*/ else if (txtboxPassword.Text != txtboxConfirmPassword.Text) { ltrMessage.Text = "The Passwords did not match!"; } /*2 emails matching checking*/ else if (txtboxEmail.Text == txtboxSecEmail.Text) { ltrMessage.Text = "The 2 Email addresses you provided should not be same!"; } /*2 contacts matching checking*/ else if (txtboxContact.Text == txtboxSecContact.Text) { ltrMessage.Text = "The 2 Contact Numbers you provided should not be same!"; } else { ltrMessage.Text = ""; upc.RegisterPatient_Users(txtboxUsername.Text, txtboxPassword.Text, txtboxEmail.Text, txtboxSecEmail.Text); /*Putting Country as Nepal by default*/ String country; if (txtboxCountry.Text == "") { country = "Nepal"; //Console.WriteLine("Went to this condition!"); } else { country = txtboxCountry.Text; } upc.RegisterPatient_Patient(txtboxUsername.Text, txtboxFirstName.Text, txtboxMiddleName.Text, txtboxLastName.Text, txtboxDob.Text, dropdownlistGender.Text, txtboxContact.Text, txtboxSecContact.Text, txtboxHouseAdd.Text, txtboxDistrict.Text, txtboxCity.Text, country); String username = txtboxUsername.Text; luc.insertOn_Log_UsersWholeField_WithInsertOperation(username); lpc.insertOn_Log_PatientWholeField_WithInsertOperation(username); Session["username"] = txtboxUsername.Text; Response.Redirect("Home_Patient.aspx"); //ltrMessageGreen.Text = "New Account registered!"; //txtboxUsername.Text = ""; //txtboxPassword.Text = ""; //txtboxEmail.Text = ""; //txtboxSecEmail.Text = ""; //txtboxFirstName.Text = ""; //txtboxMiddleName.Text = ""; //txtboxLastName.Text = ""; //txtboxDob.Text = ""; //dropdownlistGender.Text = ""; //txtboxContact.Text = ""; //txtboxSecContact.Text = ""; //txtboxHouseAdd.Text = ""; //txtboxDistrict.Text = ""; //txtboxCity.Text = ""; //txtboxCountry.Text = ""; //txtboxFirstName.Focus(); } } catch (Exception ex) { ltrMessage.Text = ex.Message; } }