protected void btnadd_Click(object sender, EventArgs e) { string Doctor_image_name = ""; string path = ""; Doctor_image_name = Class1.GetRandomPassword(10) + ".jpg"; F1.SaveAs(Request.PhysicalApplicationPath + "/Admin/DoctorImages/" + Doctor_image_name.ToString()); path = "DoctorImages/" + Doctor_image_name.ToString(); SqlCommand cmd = con.CreateCommand(); cmd.CommandType = CommandType.Text; cmd.CommandText = "insert into DoctorTble(Name,Degree,Username,Email,DOB,Specialist,Department,Country,Address,Phone,ShortBio,Status,Image)values(@Name,@Degree,@Username,@Email,@DOB,@Specialist,@Department,@Country,@Address,@Phone,@ShortBio,@Status,@Image)"; cmd.Parameters.AddWithValue("@Name", txt_Name.Text.Trim()); cmd.Parameters.AddWithValue("@Degree", txt_Degree.Text.Trim()); cmd.Parameters.AddWithValue("@Username", txtUsername.Text.Trim()); cmd.Parameters.AddWithValue("@Email", txtEmail.Text.Trim()); cmd.Parameters.AddWithValue("@DOB", DOB.Text.Trim()); cmd.Parameters.AddWithValue("@Specialist", SpecialistDropDown.SelectedItem.Text); cmd.Parameters.AddWithValue("@Department", DepartmentCB.SelectedItem.Text); cmd.Parameters.AddWithValue("@Country", CountryCb.SelectedItem.Value); cmd.Parameters.AddWithValue("@Address", Address.Text.Trim()); cmd.Parameters.AddWithValue("@Phone", Phone.Text.Trim()); cmd.Parameters.AddWithValue("@ShortBio", txtBio.Text.Trim()); cmd.Parameters.AddWithValue("@Status", DropDownStatus.SelectedItem.Value); cmd.Parameters.AddWithValue("@Image", path); cmd.ExecuteNonQuery(); msg.Style.Add("display", "block"); clear(); }
protected void btnadd_Click(object sender, EventArgs e) { string Bed_image_name = ""; string path = ""; Bed_image_name = Class1.GetRandomPassword(10) + ".jpg"; F1.SaveAs(Request.PhysicalApplicationPath + "/Admin/BedImages/" + Bed_image_name.ToString()); path = "BedImages/" + Bed_image_name.ToString(); SqlCommand cmd = con.CreateCommand(); cmd.CommandType = CommandType.Text; cmd.CommandText = "insert into tblBed(SeatNO,FloorNo,Rent_Day,Room,Status,Type,Image)values(@SeatNO,@FloorNo,@Rent_Day,@Room,@Status,@Type,@Image)"; cmd.Parameters.AddWithValue("@SeatNO", Txtseatno.Text.Trim()); cmd.Parameters.AddWithValue("@FloorNO", FloorCB.SelectedItem.Text); cmd.Parameters.AddWithValue("@Rent_Day", Renttx.Text.Trim()); cmd.Parameters.AddWithValue("@Room", txtRoom.Text.Trim()); cmd.Parameters.AddWithValue("@Status", StatusCB.SelectedItem.Text); cmd.Parameters.AddWithValue("@Type", TypeCB.SelectedItem.Text); cmd.Parameters.AddWithValue("@Image", path); cmd.ExecuteNonQuery(); msg.Style.Add("display", "block"); clear(); }
protected void btnadd_Click(object sender, EventArgs e) { string book_image_name = Class1.GetRandomPassword(10) + ".jpg"; string books_pdf = ""; string book_video = ""; string path = ""; string path2 = ""; string path3 = ""; F1.SaveAs(Request.PhysicalApplicationPath + "/Libarian/bookimages/" + book_image_name.ToString()); path = "bookimages/" + book_image_name.ToString(); if (F2.FileName.ToString() != "") { books_pdf = Class1.GetRandomPassword(10) + ".pdf"; F1.SaveAs(Request.PhysicalApplicationPath + "/Libarian/book_pdf/" + books_pdf.ToString()); path2 = "book_pdf/" + books_pdf.ToString(); } if (F3.FileName.ToString() != "") { book_video = Class1.GetRandomPassword(10) + ".mp4"; F1.SaveAs(Request.PhysicalApplicationPath + "/Libarian/book_video/" + book_video.ToString()); path3 = "book_video/" + book_video.ToString(); } SqlCommand cmd = con.CreateCommand(); cmd.CommandType = CommandType.Text; cmd.CommandText = "insert into Book(bookstitle,booksimage, bookspdf,booksvideo, booksauthor,bookisbn,avaibleqty)values(@bookstitle,@booksimage, @bookspdf,@booksvideo,@booksauthor,@bookisbn,@avaibleqty)"; cmd.Parameters.AddWithValue("@bookstitle", Booktitle.Text.Trim()); cmd.Parameters.AddWithValue("@booksimage", path); cmd.Parameters.AddWithValue("@bookspdf", books_pdf); cmd.Parameters.AddWithValue("@booksvideo", book_video); cmd.Parameters.AddWithValue("@booksauthor", Bookauthor.Text.Trim()); cmd.Parameters.AddWithValue("@bookisbn", bookisbn.Text.Trim()); cmd.Parameters.AddWithValue("@avaibleqty", bookquantity.Text.Trim()); cmd.ExecuteNonQuery(); msg.Style.Add("display", "block"); }
protected void btnadd_Click(object sender, EventArgs e) { string path = ""; F1.SaveAs(Request.PhysicalApplicationPath + "/Student/payment_slip/" + F1.FileName.ToString()); path = "payment_slip/" + F1.FileName.ToString(); SqlCommand cmd = new SqlCommand("insert into PaymentSlip(StudentName,Year,Paymentslip)values(@StudentName,@Year,@Paymentslip)", con); cmd.Parameters.AddWithValue("@StudentName", txtname.Text.Trim()); cmd.Parameters.AddWithValue("@Year", DropDownList1.SelectedItem.Value); cmd.Parameters.AddWithValue("@Paymentslip", path.ToString()); cmd.ExecuteNonQuery(); msg.Style.Add("display", "block"); }
protected void btnadd_Click(object sender, EventArgs e) { string path = ""; F1.SaveAs(Request.PhysicalApplicationPath + "/Student/Assignment/" + F1.FileName.ToString()); path = "Assignment/" + F1.FileName.ToString(); SqlCommand cmd = new SqlCommand("insert into Assignment(Lecturername,Studentname,Assignment)values(@Lecturername,@Studentname,@Assignment)", con); cmd.Parameters.AddWithValue("@Lecturername", lecturerlist.SelectedItem.Value); cmd.Parameters.AddWithValue("@Studentname", txtfullname.Text.Trim()); cmd.Parameters.AddWithValue("@Assignment", path.ToString()); cmd.ExecuteNonQuery(); msg.Style.Add("display", "block"); }
protected void Button2_Click(object sender, EventArgs e) { F1.SaveAs(Request.PhysicalApplicationPath + "./Product_img/" + F1.FileName.ToString()); F2.SaveAs(Request.PhysicalApplicationPath + "./Product_img/" + F2.FileName.ToString()); F3.SaveAs(Request.PhysicalApplicationPath + "./Product_img/" + F3.FileName.ToString()); F4.SaveAs(Request.PhysicalApplicationPath + ".//" + F4.FileName.ToString()); a = "Product_img/" + F1.FileName.ToString(); b = "Product_img/" + F2.FileName.ToString(); c = "Product_img/" + F3.FileName.ToString(); d = "" + F4.FileName.ToString(); con.Open(); SqlCommand cmd = con.CreateCommand(); cmd.CommandType = CommandType.Text; cmd.CommandText = "insert into laptop values('" + TextBox1.Text + "','" + TextBox2.Text + "','" + TextBox3.Text + "','" + TextBox4.Text + "','" + TextBox5.Text + "','" + TextBox6.Text + "','" + TextBox7.Text + "','" + TextBox8.Text + "','" + TextBox9.Text + "','" + TextBox10.Text + "','" + TextBox11.Text + "','" + TextBox12.Text + "','" + b.ToString() + "','" + c.ToString() + "','" + a.ToString() + "','" + d.ToString() + "')"; cmd.ExecuteNonQuery(); con.Close(); }
protected void btnadd_Click(object sender, EventArgs e) { string book_image_name = ""; string books_pdf = ""; string book_video = ""; string path = ""; string path2 = ""; string path3 = ""; if (F1.FileName.ToString() != "") { book_image_name = Class1.GetRandomPassword(10) + ".jpg"; F1.SaveAs(Request.PhysicalApplicationPath + "/Libarian/bookimages/" + book_image_name.ToString()); path = "bookimages/" + book_image_name.ToString(); SqlCommand cmd = con.CreateCommand(); cmd.CommandType = CommandType.Text; cmd.CommandText = "Update Book SET bookstitle=@bookstitle ,booksimage=@booksimage,booksauthor=@booksauthor,bookisbn = @bookisbn,avaibleqty=@avaibleqty WHERE ID='" + id + "' "; cmd.Parameters.AddWithValue("@bookstitle", Booktitle.Text.Trim()); cmd.Parameters.AddWithValue("@booksimage", path); cmd.Parameters.AddWithValue("@booksauthor", Bookauthor.Text.Trim()); cmd.Parameters.AddWithValue("@bookisbn", bookisbn.Text.Trim()); cmd.Parameters.AddWithValue("@avaibleqty", bookquantity.Text.Trim()); cmd.ExecuteNonQuery(); } if (F2.FileName.ToString() != "") { books_pdf = Class1.GetRandomPassword(10) + ".pdf"; F1.SaveAs(Request.PhysicalApplicationPath + "/Libarian/book_pdf/" + books_pdf.ToString()); path2 = "book_pdf/" + books_pdf.ToString(); SqlCommand cmd = con.CreateCommand(); cmd.CommandType = CommandType.Text; cmd.CommandText = "Update Book SET bookstitle=@bookstitle ,bookspdf=@bookspdf,booksauthor=@booksauthor,bookisbn = @bookisbn,avaibleqty=@avaibleqty WHERE ID='" + id + "' "; cmd.Parameters.AddWithValue("@bookstitle", Booktitle.Text.Trim()); cmd.Parameters.AddWithValue("@bookspdf", path2); cmd.Parameters.AddWithValue("@booksauthor", Bookauthor.Text.Trim()); cmd.Parameters.AddWithValue("@bookisbn", bookisbn.Text.Trim()); cmd.Parameters.AddWithValue("@avaibleqty", bookquantity.Text.Trim()); cmd.ExecuteNonQuery(); } if (F3.FileName.ToString() != "") { book_video = Class1.GetRandomPassword(10) + ".mp4"; F1.SaveAs(Request.PhysicalApplicationPath + "/Libarian/book_video/" + book_video.ToString()); path3 = "book_video/" + book_video.ToString(); SqlCommand cmd = con.CreateCommand(); cmd.CommandType = CommandType.Text; cmd.CommandText = "Update Book SET bookstitle=@bookstitle ,booksvideo=@booksvideo,booksauthor=@booksauthor,bookisbn = @bookisbn,avaibleqty=@avaibleqty WHERE ID='" + id + "' "; cmd.Parameters.AddWithValue("@bookstitle", Booktitle.Text.Trim()); cmd.Parameters.AddWithValue("@booksvideo", book_video); cmd.Parameters.AddWithValue("@booksauthor", Bookauthor.Text.Trim()); cmd.Parameters.AddWithValue("@bookisbn", bookisbn.Text.Trim()); cmd.Parameters.AddWithValue("@avaibleqty", bookquantity.Text.Trim()); cmd.ExecuteNonQuery(); } if (F1.FileName.ToString() == "" && F2.FileName.ToString() == "" && F3.FileName.ToString() == "") { SqlCommand cmd = con.CreateCommand(); cmd.CommandType = CommandType.Text; cmd.CommandText = "Update Book SET bookstitle=@bookstitle,booksauthor=@booksauthor,bookisbn = @bookisbn,avaibleqty=@avaibleqty WHERE ID='" + id + "' "; cmd.Parameters.AddWithValue("@bookstitle", Booktitle.Text.Trim()); cmd.Parameters.AddWithValue("@booksauthor", Bookauthor.Text.Trim()); cmd.Parameters.AddWithValue("@bookisbn", bookisbn.Text.Trim()); cmd.Parameters.AddWithValue("@avaibleqty", bookquantity.Text.Trim()); cmd.ExecuteNonQuery(); } Response.Redirect("DisplayBook.aspx"); }
protected void B1_Click(object sender, EventArgs e) { int count = 0; int count2 = 0; if (IsReCaptchValid()) { SqlCommand cmd1 = con.CreateCommand(); cmd1.CommandType = CommandType.Text; cmd1.CommandText = "select * from Student where enrollmentno='" + enrollmentno.Text + "'"; cmd1.ExecuteNonQuery(); DataTable dt1 = new DataTable(); SqlDataAdapter da1 = new SqlDataAdapter(); da1.Fill(dt1); count = Convert.ToInt32(dt1.Rows.Count.ToString()); if (count > 0) { Response.Write("<script>alert('Enrollment ID already exist');</script>"); } else { SqlCommand cmd2 = con.CreateCommand(); cmd2.CommandType = CommandType.Text; cmd2.CommandText = "select * from Student where username='******'"; cmd2.ExecuteNonQuery(); DataTable dt2 = new DataTable(); SqlDataAdapter da2 = new SqlDataAdapter(); da1.Fill(dt2); count2 = Convert.ToInt32(dt2.Rows.Count.ToString()); if (count > 0) { Response.Write("<script>alert('User with username already exist');</script>"); } else { string randomno = Class1.GetRandomPassword(10) + ".jpg"; string path = ""; F1.SaveAs(Request.PhysicalApplicationPath + "/Student/studentimage/" + randomno.ToString()); path = "Student/studentimage/" + randomno.ToString(); SqlCommand cmd = con.CreateCommand(); cmd.CommandType = CommandType.Text; cmd.CommandText = "insert into Student(Firstname,Lastname,enrollmentno,username,password,email,contact,studentimage,approved)values(@Firstname,@Lastname,@enrollmentno,@username,@password,@email,@contact,@studentimage,@approved)"; cmd.Parameters.AddWithValue("@Firstname", firstname.Text.Trim()); cmd.Parameters.AddWithValue("@Lastname", Lastname.Text.Trim()); cmd.Parameters.AddWithValue("@enrollmentno", enrollmentno.Text.Trim()); cmd.Parameters.AddWithValue("@username", Username.Text.Trim()); cmd.Parameters.AddWithValue("@password", Password.Text.Trim()); cmd.Parameters.AddWithValue("@email", email.Text.Trim()); cmd.Parameters.AddWithValue("@contact", Contact.Text.Trim()); cmd.Parameters.AddWithValue("@studentimage", path); cmd.Parameters.AddWithValue("@approved", "pending"); cmd.ExecuteNonQuery(); Response.Write("<script>alert('Record inserted successfully');</script>"); } } } else { lblMessage1.Text = "this is invalid"; } }