protected void feedback(object sender, EventArgs e) { myDAL objmyDAl = new myDAL(); String eventid = textBox1.Text; // myDAL objmyDAl1 = new myDAL(); // String email = textBox22.Text; // String em = (string)Session["uemail"]; // myDAL objmyDAl2 = new myDAL(); //String g = textBox1.Text; //myDAL objmyDAl13 = new myDAL(); String comments = txtComment.Text; myDAL objmyDAl3 = new myDAL(); String rating = textBox2.Text; // float gg = TextBox2.Text; DataTable DT = new DataTable(); int found; // found = objmyDAl.login_DAL(InputName); // found = objmyDAl.login_DAL(InputName); found = objmyDAl.feedback_DAL(eventid, ee, comments, rating, ref DT); // found = objmyDAl.Signupp_DAL(InputName,ln,g,phone,u,pass,credit,add,email, ref DT); if (found == -1) { Message.Text = "There was some error"; } else if (found == 0) { Message.Text = "Successfully regsiterd"; // SearchResultGrid.DataSource = DT; // SearchResultGrid.DataBind(); } else if (found == 1) { Message.Text = "FeedBack already submited"; } }
protected void LoginButton_Click(object sender, EventArgs e) { myDAL objmyDAl = new myDAL(); String InputUser = username.Text; String Password = password.Text; int found; found = objmyDAl.VerifyLogin(InputUser, Password); userMsg.Text = ""; passMsg.Text = ""; if (username.Text == "admin") { if (password.Text == "admin") { Response.Redirect("AdminPanel.aspx"); } else { passMsg.Text = "The password is incorrect!"; } } else if (found == 2) { Session["CurrentUser"] = username.Text; Session["UserProfile"] = Session["CurrentUser"]; Response.Redirect("HomePage.aspx"); } else if (found == 0) { userMsg.Text = "Username does not exist!"; } else if (found == 1) { passMsg.Text = "The password is incorrect!"; } }
protected void Book(object sender, EventArgs e) { myDAL objmyDAL = new myDAL(); int UserId = (int)Session["ID"]; string ShowId = null; int TicketsNo = 0; Int32.TryParse(TextBox5.Text, out TicketsNo); string CinemaID = DropDownList4.SelectedValue.ToString(); Session["CinemaID"] = CinemaID; string MovieID = Session["MovieID"].ToString(); string TimeDate = DropDownList2.SelectedValue.ToString(); string Screen = DropDownList5.SelectedValue.ToString(); objmyDAL.ReturnShowId(ref ShowId, CinemaID, MovieID, TimeDate, Screen); int TicketsAvaialable = objmyDAL.GetTickets(ShowId); if (TicketsAvaialable >= TicketsNo) { int Price = 0; Int32.TryParse(TextBox1.Text, out Price); Price = Price * TicketsNo; int found = objmyDAL.UserRecordInsert(UserId, ShowId, TicketsNo, Price); if (found == 1) { Status.Text = "Booking Successful!"; Session["ShowID"] = ShowId; Session["Tickets"] = TicketsNo; Session["Price"] = Price; Response.AddHeader("REFRESH", "2;FoodYesOrNo.aspx"); } else { Status.Text = "Booking UnSuccessful"; } } }
public void validate_amount_bal(object sender, EventArgs e) { string amount = TextBox1.Text.ToString(); if (IsDigitsOnly(amount) && !string.IsNullOrEmpty(amount) && amount.Length < 8) { myDAL objmydal = new myDAL(); int ac = 0; Int32.TryParse(Session["AccountNo"].ToString(), out ac); int am = 0; Int32.TryParse(amount, out am); int b = objmydal.validate_amount_dal(ac, am); if (b == 0) { label1.Text = "Withdrawal Successful"; } else if (b == -1) { label1.Text = "Error in execution"; } else if (b == 1) { label1.Text = "Not enough balance in your account"; } else if (b == 2) { label1.Text = "Not enough cash in dispenser"; } } else { label1.Text = "Incorrect Amount"; } }
//-----------------------Function1--------------------------// protected void pendingFeedback(object sender, EventArgs e) { myDAL objmyDAl = new myDAL(); int pid = (int)Session["idoriginal"]; string dName = ""; string timings = ""; int aID = 0; int status = objmyDAl.isFeedbackPending(pid, ref dName, ref timings, ref aID); if (status == -1) { Feedback.Text = "There was some error in retrieving the Pending Feedbacks."; } else if (status == 0) { Feedback.Text = "There are no pending feedbacks"; } else { Session["aID"] = aID; FDoctor.Text = "Your feedback for the appointment with Doctor " + dName + " is pending. Kindly give it."; FTimings.Text = "The Appointment Timings were : " + timings; //Make the things visible -- Magic O.O -- Message.Visible = true; List.Visible = true; button1.Visible = true; return; } }
private void finish(object sender, RoutedEventArgs e) { Trainee trainee = new Trainee(); trainee.ID = iDTextBox.Text; trainee.FirstName = firstNameTextBox.Text; trainee.LastName = lastNameTextBox.Text; trainee.Birthday = birthdayDatePicker.SelectedDate.Value.Date; //email MailAddress email = new MailAddress(EmailTextBox.Text); trainee.Email = email; String city = cityTextBox.Text; String street = streetTextBox.Text; int number = int.Parse(numberTextBox.Text); trainee.Address = new Address { Number = number, Street = street, City = city }; trainee.Gender = (Gender)genderComboBox.SelectedItem; trainee.PhoneNumber = phoneNumberTextBox.Text; //Trainee-specific stuff trainee.VehicleType = (VehicleType)vehicleComboBox.SelectedItem; trainee.Gearbox = (Gearbox)gearboxComboBox.SelectedItem; trainee.DrivingSchool = (DrivingSchool)drivingSchoolComboBox.SelectedItem; trainee.DrivingInstructor = drivingInstructorTextBox.Text; trainee.NumDrivingLessonsPassed = int.Parse(numDrivingLessonsPassedTextBox.Text); Console.WriteLine(trainee); //add trainee myDAL md = new myDAL(); md.UpdateTrainee(trainee); Console.WriteLine(md.GetTrainees()); this.Close(); }
protected void AddCategoryOnClick(Object sender, EventArgs e) { myDAL objmyDAL = new myDAL(); String InputCid = CID.Text; String InputCname = CName.Text; int found = 0; found = objmyDAL.AddCategory_DAL(InputCid, InputCname); if (found == -1) { Message.Text = "Category exists already"; } else { if (found == 1) { Message.Text = "Category Added Successfully"; } } loadCategories(); loadCategoriesList(); }
protected void Unnamed1_Click(object sender, EventArgs e) { string userName = txtuser.Text; string password = txtpass.Text; myDAL objMyDal = new myDAL(); int found; found = objMyDal.login(userName, password); if (found == 1) { Application["userName"] = txtuser.Text; Application["prices"] = 0; Response.Redirect("customerDashboard.aspx"); } else { Label1.Text = "Password is incorrect"; Label1.Visible = true; } }
/*THIS FUNTION WILL LOAD THE INFORMATION OF ALL Patient AND BIND THEM TO THE GRID*/ protected void LoadGrid(string SearchQuery) { myDAL objmyDaL = new myDAL(); DataTable table = new DataTable(); objmyDaL.LoadPatient(ref table, SearchQuery); if (table != null && table.Rows.Count > 0) { table.Columns["Name"].ColumnName = "病人姓名"; table.Columns["Phone"].ColumnName = "聯絡電話"; dgvPatientListInfo.DataSource = table; dgvPatientListInfo.DataBind(); } else { Msg.Text = "No Pateints to show"; } ClearData(); }
public void saveindatabase(object sender, EventArgs e) { myDAL objmyDAL = new myDAL(); int found; int did = (int)Session["idoriginal"]; string disease = Disease.Text; string progres = progress.Text; string prescrip = Prescription.Text; int appid = (int)Session["appointid"]; found = objmyDAL.update_prescription_DAL(did, appid, disease, progres, prescrip); if (found != 1) { Response.Write("<script>alert('There was some error');</script>"); } else { { Response.Write("<script>alert('Information Successfully Updated');</script>"); } } }
protected void Logout_Click(object sender, EventArgs e) { myDAL objmyDAl = new myDAL(); //String InputName = Name.Text; String InputEmail = Request.Form["Email"]; String InputPassword = Request.Form["Password"]; string found; found = objmyDAl.Logout_DAL(Session["username"].ToString()); if (found != "User Name not Present") { Session["username"] = null; Response.Redirect("Index.aspx"); // SearchResultGrid.DataSource = DT; // SearchResultGrid.DataBind(); } else { Message1.Text = "Error is " + found; } }
protected void loginAccount_Click(object sender, EventArgs e) { myDAL objmyDAl = new myDAL(); //String InputName = Name.Text; String InputEmail = Request.Form["Email"]; String InputPassword = Request.Form["Password"]; string found; found = objmyDAl.loginAccount_DAL(InputEmail, InputPassword); if (found != "User already Logged In" && found != "Invalid Password" && found != "Invalid Email") { Session["username"] = found; Response.Redirect("WebForm3.aspx"); } else { ClientScript.RegisterStartupScript(this.GetType(), "Alert", "ShowError();", true); // Session["error"] = Er.Text = found; //Response.Redirect("WebForm4.aspx"); } }
protected void StaffRegister(object sender, EventArgs e) { Response.Write("<script>alert('There was some error in retrieving the Patient's Info.');</script>"); if (Page.IsValid) { myDAL objmyDAL = new myDAL(); int salary = Convert.ToInt32(Salary.Text); string gender = Request.Form["Gender"].ToString(); if (objmyDAL.AddStaff(Name.Text, BirthDate.Text, Phone.Text, gender[0], Address.Text, salary, Qual.Text, Designation.Text) == 1) { Response.BufferOutput = true; Msg.Visible = true; Msg.Text = Designation.Text + " Added Succesfully"; flushInformation(); } else { Response.Write("<script>alert('There was some error in retrieving the Patient's Info.');</script>"); } } }
protected void update_username(object sender, EventArgs e) { String contact_number = Session["Contact_number"].ToString(); String new_name = TextBox1.Text; myDAL objmyDal = new myDAL(); int found = 0; found = objmyDal.update_username(contact_number, new_name); if (found == 0) { //user not exist //TextBox1.Text = ""; ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alertMessage", "alert('User did not exists')", true); } else if (found == 1) { //user exist // TextBox1.Text = ""; ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alertMessage", "alert('UserName updated Successfully')", true); } }
protected void Page_Load(object sender, EventArgs e) { ee = (string)Session["uemail"]; if (ee == null) { Response.Redirect("login.aspx"); } myDAL objmyDAl = new myDAL(); DataTable DT = new DataTable(); int found; found = objmyDAl.SearchStudentByName123_DAL(ref DT); if (found != 1) { Message.Text = "There was some error"; } else { Message.Text = "Following Messages are found"; SearchResultGrid.DataSource = DT; SearchResultGrid.DataBind(); } }
protected void load_tours_catalogue() { myDAL obj = new myDAL(); SqlDataReader reader = obj.get_tours(); int id, price; string departure, destination, reference_image; if (reader.HasRows) { while (reader.Read()) { id = reader.GetInt32(0); departure = reader.GetString(1); destination = reader.GetString(2); reference_image = reader.GetString(3); price = reader.GetInt32(4); display_tour(id, departure, destination, reference_image, price); } } }
//-----------------------Function1--------------------------// protected void freeSlots(object sender, EventArgs e) { myDAL objmyDAl = new myDAL(); DataTable DT = new DataTable(); string dID1 = (string)Session["dID"]; int dID = Convert.ToInt32(dID1); int pID = (int)Session["idoriginal"]; int status = objmyDAl.getFreeSlots(dID, pID, ref DT); if (status == -1) { PAppointment.Text = "There was some error in retrieving the Doctors's Free Slots."; } else if (status == 0) { PAppointment.Text = "There is currently no free slot of this doctor."; } else if (status > 0) { PAppointment.Text = "The following are the " + status + " free slots of this doctor for today :"; PAppointmentGrid.DataSource = DT; PAppointmentGrid.DataBind(); } return; }
protected void SentHEVideoData_Click(object sender, EventArgs e) { int vid = int.Parse((hfUploadVideoID.Value == "" ? "0" : hfUploadVideoID.Value)); string VideoTitle, VideoURL, UploadDate; string VideoCategories = ""; VideoTitle = txtVideoTitle.Text; foreach (ListItem SelectItem in SelectCategories.Items) { if (SelectItem.Selected == true) { VideoCategories = SelectItem.Text; } } VideoURL = txtVideoURL.Text; UploadDate = lblUploadDate.Text; string mes = ""; myDAL objmyDAL = new myDAL(); objmyDAL.insertHealthEducationVideoDatas(vid, VideoTitle, VideoCategories, VideoURL, UploadDate, ref mes); if (mes != "") { Response.Write("<script>alert('" + mes.ToString() + "');</script>"); } else { Response.Write("<script>alert('影片 : " + txtVideoTitle.Text + " 已成功儲存到資料庫!!');</script>"); } LoadHealthEducationVideoList(); ClearData(); }
/*EVENT HANDLER FOR DELETE BUTTON IN GRID*/ protected void DeleteDoctor_Click(Object sender, GridViewDeleteEventArgs e) { GridViewRow row = Manage.Rows[e.RowIndex]; string id = row.Cells[1].Text; myDAL objDAL = new myDAL(); if (Doctor.Checked == true) { if (objDAL.DeleteDoctor(Convert.ToInt32(id)) == 1) { Msg.Text = " Doctor No: " + id + " Deleted"; LoadGrid("", "DOCTOR"); } else { Msg.Text = "there was some error"; } } else if (Patient.Checked == true) { { Msg.Text = "You are not Authorized to Delete a Patient"; } } else { if (objDAL.DeleteStaff(Convert.ToInt32(id)) == 1) { Msg.Text = "Staff No: " + id + " Deleted "; LoadGrid("", "OTHERSTAFF"); } else { Msg.Text = "There was some Error"; } } }
//-----------------------Function2--------------------------// protected void giveFeedback(object sender, EventArgs e) { myDAL objmyDAl = new myDAL(); int aID = (int)Session["aID"]; int rating = Convert.ToInt32(List.SelectedItem.Value); int status = objmyDAl.givePendingFeedback(aID); if (status == -1) { F.Text = "There was some error."; } else if (status == 0) { F.Text = "Thank you for your feedback :)"; } return; }
//-----------------------Function1--------------------------// protected void deptInfo(object sender, EventArgs e) { myDAL objmyDAl = new myDAL(); DataTable DT = new DataTable(); int status = objmyDAl.getdeptInfo(ref DT); if (status == -1) { TDept.Text = "There was some error in retrieving the Departments Information."; } else { TDept.Text = "Note : Following departments are available at our clinic : "; TDeptGrid.DataSource = DT; TDeptGrid.DataBind(); } return; }
protected void UnfollowUser_Click(object sender, EventArgs e) { IEnumerator myEnum = (sender as Button).Parent.Controls.GetEnumerator(); LinkButton myLink; String fUsername = "", currentUser = Session["CurrentUser"].ToString(); while (myEnum.MoveNext()) { if (myEnum.Current is LinkButton) { myLink = (LinkButton)myEnum.Current; fUsername = myLink.Text; } } myDAL objmyDAl = new myDAL(); fUsername = fUsername.Substring(1, fUsername.Length - 1); objmyDAl.UnfollowUser(currentUser, fUsername); Response.Write("<script>alert('You Unfollowed the user!');</script>"); Response.Redirect("Profile.aspx"); }
protected void Page_Load(object sender, EventArgs e) { myDAL objmyDAl = new myDAL(); String currentUser = Session["CurrentUser"].ToString(), userProfile = Session["UserProfile"].ToString(); int privacyType = objmyDAl.CheckIsFollower(userProfile, currentUser); if (Session["CurrentUser"].ToString() == Session["UserProfile"].ToString()) { privacyType = 1; } String blocked = Session["UserProfile"].ToString(); String blocker = Session["CurrentUser"].ToString(); int blockCheck = objmyDAl.CheckIsBlocked(blocked, blocker); if (blockCheck == 1) { privacyType = 2; } ShowProfileBox(privacyType); if (privacyType == 1 && Session["ProfileViewType"].ToString() == "TweetView") { ShowUserTweets(); } else if (privacyType == 1 && Session["ProfileViewType"].ToString() == "FollowerView") { ShowUserFollowers(); } else if (privacyType == 1 && Session["ProfileViewType"].ToString() == "FollowingView") { ShowUserFollowing(); } }
protected void complain(object sender, EventArgs e) { String p_contact_number = Session["Contact_number"].ToString(); String d_contact = TextBox3.Text; String complain = TextBox2.Text; myDAL obj = new myDAL(); int found = obj.complain(p_contact_number, d_contact, complain); if (found == 0) { //user not exist ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alertMessage", "alert('NO complete ride exists with ratings to give complain')", true); } else if (found == 1) { //user exist ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alertMessage", "alert('Complain Added Successfully')", true); } else if (found == 2) { //user exist ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alertMessage", "alert('Complain is already exists')", true); } }
protected void addAirline(object sender, EventArgs e) { try { if (airName.Text == "") { throw new System.ArgumentException("Airline Name cannot be empty", ""); } myDAL obj = new myDAL(); int res = 0; res = obj.addAirline_DAL(airName.Text); if (res == 0) { throw new System.ArgumentException("Something went wrong.", ""); } Response.Redirect("detailAir.aspx"); showErrors.Text = "<div style=\"color:green\">Airline added successfully!</div>"; } catch (Exception ex) { showErrors.Text = ex.Message; } }
protected void hostlogin(object sender, EventArgs e) { try { if (Convert.ToInt32(inputNameh.Text) > 10) { throw new System.ArgumentException("Your Admin Number is incorrect. We have a limit of 10 Admins only.", ""); } if (inputPassh.Text.Length < 5) { throw new System.ArgumentException("Password must be at least 5 characters long.", ""); } myDAL obj = new myDAL(); int res = 0; string email = ""; int usertype = 1; res = obj.admin_login_DAL(Convert.ToInt32(inputNameh.Text), inputPassh.Text, ref email); if (res == 0) { throw new System.ArgumentException("Login Failed! Your username or password is incorrect.", ""); } showErrorsh.Text = "<div style=\"color:green\">Logged in successfully!</div>"; Session["adminname"] = inputNameh.Text; Session["type"] = usertype; Session["newlyCreated"] = null; Response.Redirect("AdminloggedIn.aspx"); } catch (Exception ex) { showErrorsh.Text = ex.Message; } }
protected void createTourSaveButton_Click(object sender, EventArgs e) { CreateTourError.InnerText = ""; string departure = Departure.Text; string destination = Destination.Text; string ddate = Ddate.Text; string dtime = Dtime.Text; string adate = Adate.Text; string atime = Atime.Text; string rdate = Rdate.Text; string rtime = Rtime.Text; string number_of_days = numDays.Text; string total_seats = TotalSeats.Text; string pps = PPS.Text; string tourguide = TourGuide.Text; string busnumber = BusNum.Text; string reference_image = ReferenceImage.Text; myDAL obj = new myDAL(); obj.create_tour(departure, destination, ddate, dtime, adate, atime, rdate, rtime, pps, number_of_days, tourguide, busnumber, total_seats, reference_image); Response.Redirect("Admin.aspx"); }
protected void Unnamed6_Click(object sender, EventArgs e) { //cart = (Cart)(Session["cart"]); prices = (int)Application["prices"]; string user; int price; if (Application["userName"] != null) { user = Application["userName"].ToString(); } else { user = "******"; } price = cart.price; myDAL objMyDal = new myDAL(); objMyDal.checkout(user, price); }
protected void add_rooms(object sender, EventArgs e) { object Email1 = Session["username"]; if (Email1 == null) { Response.Redirect("../Admin Login/adminLogin.aspx"); return; } myDAL objmydal = new myDAL(); string category = DropDownList2.SelectedValue.ToString(); string status = stat12.Value.ToString(); int discount = 0; int done = objmydal.add_room(category, status, discount); if (done == 1) { Label1.Text = "Room added"; } else { Label1.Text = "Room not added"; } }
protected void AddProduct_Click(object sender, EventArgs e) { myDAL objmyDAL = new myDAL(); String InputPname = Pname.Text; int InputPstock = Convert.ToInt32(Pstock.Text); int InputPrice = Convert.ToInt32(Price.Text); String InputCat = category.Text; String InputEmail = Session["user"].ToString(); int found; found = objmyDAL.AddProduct_DAL(InputPname, InputEmail, InputPstock, InputPrice, InputCat); if (found == -1) { MessageBP.Text = "Unsuccessful. Try Again"; } else { if (found == 1) { MessageBP.Text = "Product added successfully"; } } }