protected void Unnamed2_Click1(object sender, EventArgs e) { FYPDataContext db = new FYPDataContext(); Image img = new Image(); var Laww = from x in db.LawnOwners where x.Area.Equals(SearchArea.Value) || Convert.ToInt32(x.SeatingCapacity) >= Convert.ToInt32(SearchCapacity.Value) select x.Id; var CoverImage = from x in db.Images where x.Name.Equals("Cover") select x.Id; var Imggg = (from x in db.Images join y in db.LawnOwners on x.LawnID equals y.Id where Laww.Contains(Convert.ToInt32(x.LawnID)) && //where x.Name.Equals(Convert.ToInt32("Cover".ToString())) CoverImage.Contains(x.Id) select new { x.Uimg, y.LawnName, y.SeatingCapacity, y.Address }); Repeater1.DataSource = Imggg; Repeater1.DataBind(); SearchCapacity.Value = SearchArea.Value = ""; }
protected void Page_Load(object sender, EventArgs e) { FYPDataContext db = new FYPDataContext(); var imm = from x in db.Images select x; Repeater1.DataSource = imm; Repeater1.DataBind(); }
protected void Page_Load(object sender, EventArgs e) { Label1.Text = Session["Name"].ToString(); FYPDataContext db = new FYPDataContext(); BookingInformation bk = new BookingInformation(); var chkdate = from x in db.BookingInformations where x.LawnName.Equals(Session["Name"].ToString()) select new { x.LawnName, x.UserName, x.Date }; grid1.DataSource = chkdate; grid1.DataBind(); }
protected void Button1_Click(object sender, EventArgs e) { FYPDataContext db = new FYPDataContext(); Image img = new Image(); var imageresult = from x in db.Images select x; GridView1.DataSource = imageresult; GridView1.DataBind(); }
protected void Page_Load(object sender, EventArgs e) { if (IsPostBack) { FYPDataContext db = new FYPDataContext(); BookingInformation BookInf = new BookingInformation(); String date = txtDate.Text; DateTime now1 = Convert.ToDateTime(txtDate.Text); var checkdate = (from x in db.BookingInformations where x.Date.Equals(date) & x.LawnName.Equals(txtOrgName.Text) select x).FirstOrDefault(); DateTime now = DateTime.Now.Date; if (now1.Day <= now.Day && now1.Month <= now.Month && now1.Year <= now.Year) { ScriptManager.RegisterStartupScript(this, this.GetType(), "popup", "alert('You have selected OLD Date or Current Date. Please Select tomorrow or Onward Date');", true); } else if (checkdate != null) { ScriptManager.RegisterStartupScript(this, this.GetType(), "popup", "alert('This Date Already has been taken');", true); } } if (!IsPostBack) { if (Session["BookingUser"] == null) { Session["CurrentURL"] = "" + HttpContext.Current.Request.Url.AbsolutePath + ""; string ddddd = HttpContext.Current.Request.Url.AbsolutePath + HttpContext.Current.Request.Url.AbsolutePath; // Response.Redirect(Session["CurrentURL"].ToString()); // Server.Transfer("UserSignIn.aspx"); Response.Redirect("UserSignIn.aspx"); } FYPDataContext db = new FYPDataContext(); BookingInformation bookinfo = new BookingInformation(); var info = (from x in db.LawnOwners where x.Address.Equals(Session["CheckAvail"].ToString()) select x).FirstOrDefault(); txtOrgName.Text = info.LawnName; txtGuests.Text = info.SeatingCapacity; Session["LawnOwnerEmail"] = info.Email; Session["LawnIDs"] = info.Id; Session["LCapa"] = info.SeatingCapacity; } }
protected void Page_Load(object sender, EventArgs e) { FYPDataContext db = new FYPDataContext(); Image img = new Image(); var imageresult = from x in db.Images where x.LawnID.Equals(Convert.ToInt32(Session["VVID"])) select x; GridView1.DataSource = imageresult; GridView1.DataBind(); }
protected void GridView1_RowDeleting(object sender, GridViewDeleteEventArgs e) { FYPDataContext db = new FYPDataContext(); Image img = new Image(); GridViewRow row = (GridViewRow)GridView1.Rows[e.RowIndex]; Label lbldeleteid = (Label)row.FindControl("lblImgId"); Label lblDeleteImageName = (Label)row.FindControl("lblImageName"); var gg = GridView1.DataSourceID[e.RowIndex]; var res = (from cc in db.Images where cc.Id.Equals(Convert.ToInt32(GridView1.DataSourceID[e.RowIndex])) select cc).First(); db.Images.DeleteOnSubmit(res); db.SubmitChanges(); }
protected void Unnamed3_Click(object sender, EventArgs e) { if (Page.IsValid) { FYPDataContext db = new FYPDataContext(); BookingInformation bookinfo = new BookingInformation(); //var info = (from x in db.LawnOwners // where x.Address.Equals(Session["Booking"].ToString()) // select x).FirstOrDefault(); bookinfo.LawnID = Convert.ToInt32(Session["LawnIDs"].ToString()); bookinfo.CustomerID = Convert.ToInt32(Session["BookingUser"].ToString()); bookinfo.LawnName = txtOrgName.Text; bookinfo.UserName = txtUser.Text; bookinfo.CNIC = txtCNIC.Text; bookinfo.Capcaity = Convert.ToInt32(Session["LCapa"].ToString()); bookinfo.Contact_No = txtContact.Text; bookinfo.Date = Convert.ToDateTime(txtDate.Text); db.BookingInformations.InsertOnSubmit(bookinfo); db.SubmitChanges(); String EmailID = Session["LawnOwnerEmail"].ToString(); MailMessage msg = new MailMessage(); msg.From = new MailAddress("*****@*****.**"); msg.Bcc.Add("*****@*****.**"); msg.Bcc.Add("*****@*****.**"); msg.To.Add(EmailID); msg.Body = "Your banquet is booked on" + Convert.ToDateTime(txtDate.Text) + ". You will recieve Token Money in two Days"; msg.Subject = "IqraEventManagementSystem"; msg.IsBodyHtml = true; SmtpClient smtp = new SmtpClient(); smtp.Host = "smtp.gmail.com"; smtp.EnableSsl = true; System.Net.NetworkCredential Networkcard = new System.Net.NetworkCredential(); Networkcard.UserName = "******"; Networkcard.Password = "******"; smtp.DeliveryMethod = SmtpDeliveryMethod.Network; smtp.UseDefaultCredentials = true; smtp.Credentials = Networkcard; smtp.Port = 587; smtp.Send(msg); ScriptManager.RegisterStartupScript(this, this.GetType(), "popup", "alert('Booking Completed');", true); } }
protected void Unnamed6_Click(object sender, EventArgs e) { if (Page.IsValid) { FYPDataContext db = new FYPDataContext(); User u = new User(); AllUser all = new AllUser(); var checkuser = (from x in db.AllUsers where x.Email_ID.Equals(txtEmail.Text) select x).FirstOrDefault(); if (checkuser == null) { u.Name = txtName.Text; u.Phone = txtPhoneNumber.Text; u.Email = txtEmail.Text; //u.Password = txtPassword.Text; all.Password = txtPassword.Text; all.Email_ID = txtEmail.Text; all.User_Role = "User"; db.AllUsers.InsertOnSubmit(all); db.Users.InsertOnSubmit(u); db.SubmitChanges(); Response.Write("Registration Scuessfully Complete"); txtPhoneNumber.Text = txtEmail.Text = txtName.Text = ""; ScriptManager.RegisterStartupScript(this, this.GetType(), "popup", "alert('Registration Completed');", true); //User u1 = new User(); //var checkuser2 = (from x in db.Users // where x.Email.Equals(txtEmail.Text) // select x).FirstOrDefault(); //Session["BookingUser"] = checkuser2.Id; Response.Redirect("Lawns.aspx"); } else { User_Error.Visible = true; txtPhoneNumber.Text = txtEmail.Text = txtName.Text = ""; } } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { FYPDataContext db = new FYPDataContext(); Image img = new Image(); var Laww = from x in db.LawnOwners // where x.Area.Equals(SearchArea.Text) select x.Id; //if (SearchArea != null) //{ // Laww = from x in db.LawnOwners // where x.Area.Equals(Convert.ToString( SearchArea.Text)) // select x.Id; //} //else { // Laww = from x in db.LawnOwners // where x.SeatingCapacity.Equals(SearchCapacity.Text) // select x.Id; //} var CoverImage = from x in db.Images where x.Name.Equals("Cover") select x.Id; var Imggg = (from x in db.Images join y in db.LawnOwners on x.LawnID equals y.Id where Laww.Contains(Convert.ToInt32(x.LawnID)) && //where x.Name.Equals(Convert.ToInt32("Cover".ToString())) CoverImage.Contains(x.Id) select new { x.Uimg, y.LawnName, y.SeatingCapacity, y.Address }); Repeater1.DataSource = Imggg; Repeater1.DataBind(); } }
protected void Unnamed1_Click(object sender, EventArgs e) { if (Page.IsValid) { FYPDataContext db = new FYPDataContext(); LawnOwner L = new LawnOwner(); AllUser all = new AllUser(); var checkVendor = (from x in db.AllUsers where x.Email_ID.Equals(txtEmailL.Text) select x).FirstOrDefault(); if (checkVendor == null) { L.LawnName = txtLawnName.Text; L.SeatingCapacity = txtSeating.Text; L.Address = txtAddress.Text; L.BankAcc = txtAcc.Text; L.Phone = txtphone.Text; //L.Email = txtEmailL.Text; all.Email_ID = txtEmailL.Text; all.Password = txtPass.Text; all.User_Role = "Vendor"; // L.Password = txtPass.Text; //L.ConfirmPassword = txtConfirmPass.Text; L.Area = txtArea.Text; db.AllUsers.InsertOnSubmit(all); db.LawnOwners.InsertOnSubmit(L); db.SubmitChanges(); Session["Address"] = txtAddress.Text; Session["Name"] = txtLawnName.Text; Response.Redirect("ImageUpload.aspx"); } else { Address_Error.Visible = true; } txtArea.Text = txtEmailL.Text = txtphone.Text = txtAcc.Text = txtAddress.Text = txtSeating.Text = txtLawnName.Text = ""; } }
protected void Unnamed_Click(object sender, EventArgs e) { string d = CheckAvailb.Text; FYPDataContext db = new FYPDataContext();//db.BookingInformations var chkLawnID = (from x in db.LawnOwners where x.Address.Equals(Session["CheckAvail"].ToString()) select x).FirstOrDefault(); int LID = chkLawnID.Id; var checkavail = (from x in db.BookingInformations where x.Date.Equals(d) && x.LawnID.Equals(LID) select x).FirstOrDefault(); if (checkavail != null) { ScriptManager.RegisterStartupScript(this, this.GetType(), "popup", "alert('This Date is already taken. Choose Another');", true); } else { ScriptManager.RegisterStartupScript(this, this.GetType(), "popup", "alert('This Date is Availible');", true); } }
protected void Unnamed3_Click(object sender, EventArgs e) { if (Page.IsValid) { FYPDataContext db = new FYPDataContext(); var userresult = (from x in db.AllUsers where x.Email_ID.Equals(txtSignInName.Text) & x.Password.Equals(txtpasswordSignIn.Text) select x).FirstOrDefault(); //var Vendor_result = (from x in db.LawnOwners // where x.LawnName.Equals(txtSignInName.Text) & x.Password.Equals(txtpasswordSignIn.Text) // select x).FirstOrDefault(); if (userresult == null) { ScriptManager.RegisterStartupScript(this, this.GetType(), "popup", "alert('UserName or Password is Incorrect');", true); } else if (Session["CurrentURL"] != null) { Response.Redirect(Session["CurrentURL"].ToString()); } else if (userresult.User_Role != "Vendor") { Session["BookingUser"] = userresult.Id; Response.Redirect("index.aspx"); } else if (userresult.User_Role == "User") { //Session["Name"] = Vendor_result.LawnName; //Session["VVID"] = Vendor_result.Id; Response.Redirect("VenderHome.aspx"); } } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { FYPDataContext db = new FYPDataContext(); var chkk = (from x in db.LawnOwners where x.Address.Equals(Session["CheckAvail"].ToString()) select x).FirstOrDefault(); LabelName.Text = chkk.LawnName.ToString(); LabelAdd.Text = chkk.Address.ToString(); lblcapacity.Text = chkk.SeatingCapacity.ToString(); int VIDD = Convert.ToInt32(chkk.Id); var chkpic = (from x in db.Images where x.LawnID.Equals(VIDD) select x);//.FirstOrDefault(); SliderRep.DataSource = chkpic; SliderRep.DataBind(); //lblrent.Text = chkk.Rent.ToString(); } }
protected void Button1_Click(object sender, EventArgs e) { FYPDataContext db = new FYPDataContext(); var ID = (from a in db.LawnOwners where a.Address.Equals(Session["Address"].ToString()) select a).FirstOrDefault(); Session["VVID"] = Convert.ToInt32(ID.Id); HttpFileCollection imagecollection = Request.Files; if (FileUpload1.HasFiles) { for (int i = 0; i < imagecollection.Count; i++) { String path = ""; Image upload = new Image(); HttpPostedFile uploadIma = imagecollection[i]; string Extension = System.IO.Path.GetExtension(uploadIma.FileName); if (Extension.ToLower() != ".png" && Extension.ToLower() != ".gif" && Extension.ToLower() != ".jpg" && Extension.ToLower() != ".jpeg") { ScriptManager.RegisterStartupScript(this, this.GetType(), "popup", "alert('Invalid Image Format');", true); } else { int File = uploadIma.ContentLength; if (File > 1048576) { ScriptManager.RegisterStartupScript(this, this.GetType(), "popup", "alert('Maximam File size is 1 MB');", true); } else { path = "uploadimages/" + Path.GetFileName("" + uploadIma.FileName); if (i == 0) { upload.Name = "Cover"; } else { upload.Name = ID.LawnName.ToString(); } upload.Uimg = path; upload.LawnID = Convert.ToInt32(ID.Id); db.Images.InsertOnSubmit(upload); db.SubmitChanges(); uploadIma.SaveAs(Server.MapPath("~/uploadimages/" + uploadIma.FileName)); ScriptManager.RegisterStartupScript(this, this.GetType(), "popup", "alert('File Uploaded Sucessfully!! :)');", true); PicSuccess.Visible = true; } } } Response.Redirect("VenderHome.aspx"); } else { ScriptManager.RegisterStartupScript(this, this.GetType(), "popup", "alert('Please Select Image First');", true); } }