using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; using System.Data.SqlClient; using System.Configuration; using System.Data; using System.IO; using System.Web.UI.HtmlControls; using AjaxControlToolkit; public partial class Event_Organization_Detail : System.Web.UI.Page { PublicMethods clsPublicMethods = new PublicMethods(); EMUPDataContext dbEmup = new EMUPDataContext(); MailServicesCls clsMail = new MailServicesCls(); Logic obj = new Logic(); protected int GalleryId; protected string GalleryName; public string strEventName; protected string latti { get; set; } protected string longi { get; set; } protected string city { get; set; } private string strTitle; protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { try { if (Request.QueryString["Id"] != null) { litAID.Text = Convert.ToString((Request.QueryString["Id"])); } else { strTitle = Page.RouteData.Values["AdOrganizerDetail"].ToString(); litAID.Text = strTitle.Substring(strTitle.LastIndexOf('-') + 1); } } catch { strTitle = Page.RouteData.Values["AdOrganizerDetail"].ToString(); litAID.Text = strTitle.Substring(strTitle.LastIndexOf('-') + 1); } //strTitle = Page.RouteData.Values["AdOrganizerDetail"].ToString(); //litAID.Text = strTitle.Substring(strTitle.LastIndexOf('-') + 1); GetData(Convert.ToInt16(litAID.Text)); // required fields GetAdImages(); //GetGallery(Convert.ToInt16(Request.QueryString["Id"])); BindBrochure(); GetServices(); GetRating(Convert.ToInt16(litAdid.Text)); GetComments(Convert.ToInt16(litAdid.Text)); //Int32 startzip = 0; //Int32 endzip = 0; //string zipcode; string strLoc = ""; string strIP = string.Empty; strIP = Request.ServerVariables["HTTP_X_FORWARDED_FOR"]; if (string.IsNullOrEmpty(strIP)) strIP = Request.ServerVariables["REMOTE_ADDR"]; litiP.Text = strIP; if (string.IsNullOrEmpty(strIP)) litiP.Text = Request.ServerVariables["REMOTE_ADDR"]; try { //try //{ // BindGridViewListings(Convert.ToDouble(32.7766642), Convert.ToDouble(-96.7969879)); //} //catch (Exception ex) //{ // BindGridViewListings(); //} //try //{ // BindGridViewListings(convert.todouble(29.7604), convert.todouble(95.3698)); //} //catch //{ // BindGridViewListings(); //} // Not Required Query String Sloc //if (Request.QueryString["Sloc"] != null) //{ //try //{ // BindGridViewListings(Convert.ToDouble(Session["lat"]), Convert.ToDouble(Session["long"])); //} //catch (Exception ex) //{ // BindGridViewListings(); //} //try //{ // BindGridViewListings(Convert.ToDouble(Server.HtmlEncode(Request.Cookies["locInfo"]["lat"])), Convert.ToDouble(Server.HtmlEncode(Request.Cookies["locInfo"]["long"]))); //} //catch //{ // BindGridViewListings(); //} // //string strcity = Convert.ToString(Convert.ToString(Request.QueryString["Sloc"])).Split(',')[0]; //Session["loc"] = strcity; ////Session["Sloc"] = (Convert.ToString(Request.QueryString["Sloc"]).Split(',')[0], Convert.ToString(Request.QueryString["Sloc"].Substring(Request.QueryString["Sloc"].LastIndexOf(',') + 1))); //string strstate = Convert.ToString(Convert.ToString(Request.QueryString["Sloc"])).Split(',')[1]; //strLoc = strcity + "," + strstate; //Session["Sloc"] = strLoc; //clsPublicMethods.GetLatLong(Convert.ToString(Request.QueryString["Sloc"]).Split(',')[0], Convert.ToString(Request.QueryString["Sloc"].Substring(Request.QueryString["Sloc"].LastIndexOf(',') + 1))); //BindGridViewListings(Convert.ToDouble(clsPublicMethods.salti), Convert.ToDouble(clsPublicMethods.slong)); ////BindRelatedAds(Convert.ToDouble(clsPublicMethods.salti), Convert.ToDouble(clsPublicMethods.slong)); ////BindUserAds(Convert.ToDouble(clsPublicMethods.salti), Convert.ToDouble(clsPublicMethods.slong)); // } if (Request.Cookies["locInfo"] != null) { try { BindGridViewListings(Convert.ToDouble(Server.HtmlEncode(Request.Cookies["locInfo"]["lat"])), Convert.ToDouble(Server.HtmlEncode(Request.Cookies["locInfo"]["long"]))); } catch (Exception ex) { BindGridViewListings(); } //Session["loc"] = Convert.ToString(Server.HtmlEncode(Request.Cookies["locInfo"]["loc"])); //Session["Sloc"] = Convert.ToString(Server.HtmlEncode(Request.Cookies["locInfo"]["Sloc"])); //BindGridViewListings(Convert.ToDouble(Server.HtmlEncode(Request.Cookies["locInfo"]["lat"])), Convert.ToDouble(Server.HtmlEncode(Request.Cookies["locInfo"]["long"]))); ////BindRelatedAds(Convert.ToDouble(Server.HtmlEncode(Request.Cookies["locInfo"]["lat"])), Convert.ToDouble(Server.HtmlEncode(Request.Cookies["locInfo"]["long"]))); ////BindUserAds(Convert.ToDouble(Server.HtmlEncode(Request.Cookies["locInfo"]["lat"])), Convert.ToDouble(Server.HtmlEncode(Request.Cookies["locInfo"]["long"]))); } else if (Convert.ToString(Session["loc"]) != "") { try { BindGridViewListings(Convert.ToDouble(Session["lat"]), Convert.ToDouble(Session["long"])); } catch (Exception ex) { BindGridViewListings(); } //string strcity = Convert.ToString(Convert.ToString(Session["Sloc"])).Split(',')[0]; //Session["loc"] = strcity; //string strstate = Convert.ToString(Convert.ToString(Session["Sloc"])).Split(',')[1]; ////clsPublic.GetLatLong(Convert.ToString(Session["Sloc"])); //clsPublicMethods.GetLatLong(Convert.ToString(Session["Sloc"]).Split(',')[0], Convert.ToString(Session["Sloc"]).Split(',')[1]); ////BindGrids(startzip, endzip); ////BindRelatedAds(Convert.ToDouble(clsPublicMethods.salti), Convert.ToDouble(clsPublicMethods.slong)); //BindGridViewListings(Convert.ToDouble(clsPublicMethods.salti), Convert.ToDouble(clsPublicMethods.slong)); ////BindUserAds(Convert.ToDouble(clsPublicMethods.salti), Convert.ToDouble(clsPublicMethods.slong)); } else { DataTable dt = clsPublicMethods.GetLocation(strIP); lblCity.Text = dt.Rows[0]["cityName"].ToString(); HttpCookie hcLoc = new HttpCookie("locInfo"); hcLoc.Values["loc"] = Convert.ToString(lblCity.Text); hcLoc.Values["lat"] = Convert.ToString(dt.Rows[0]["latitude"].ToString()); hcLoc.Values["long"] = Convert.ToString(dt.Rows[0]["longitude"].ToString()); hcLoc.Values["Sloc"] = dt.Rows[0]["cityName"].ToString() + "," + Convert.ToString(dt.Rows[0]["regionName"].ToString()); hcLoc.Expires = DateTime.Now.AddDays(1); hcLoc.Domain = ".jhalak.com"; Response.Cookies.Add(hcLoc); Session["loc"] = lblCity.Text; Session["lat"] = Convert.ToString(dt.Rows[0]["latitude"].ToString()); Session["long"] = Convert.ToString(dt.Rows[0]["longitude"].ToString()); Session["Sloc"] = dt.Rows[0]["cityName"].ToString() + "," + Convert.ToString(dt.Rows[0]["regionName"].ToString()); //hcLoc.Domain = ".jhalak.com"; Response.Cookies.Add(hcLoc); try { BindGridViewListings(Convert.ToDouble(dt.Rows[0]["latitude"].ToString()), Convert.ToDouble(dt.Rows[0]["longitude"].ToString())); } catch { BindGridViewListings(); } ////// //DataTable dt = clsPublicMethods.GetLocation(strIP); //lblCity.Text = dt.Rows[0]["City"].ToString() + "," + dt.Rows[0]["RegionCode"].ToString() + "," + dt.Rows[0]["CountryName"].ToString(); //Session["Sloc"] = dt.Rows[0]["City"].ToString() + "," + dt.Rows[0]["RegionCode"].ToString(); //Session["loc"] = dt.Rows[0]["City"].ToString(); //clsPublicMethods.GetLatLong(Convert.ToString(dt.Rows[0]["City"].ToString()), Convert.ToString(dt.Rows[0]["RegionCode"].ToString())); ////BindRelatedAds(Convert.ToDouble(clsPublicMethods.salti), Convert.ToDouble(clsPublicMethods.slong)); //BindGridViewListings(Convert.ToDouble(clsPublicMethods.salti), Convert.ToDouble(clsPublicMethods.slong)); ////BindUserAds(Convert.ToDouble(clsPublicMethods.salti), Convert.ToDouble(clsPublicMethods.slong)); } } catch { //BindUserAds(); BindGridViewListings(); //BindRelatedAds(); } city = Convert.ToString(Session["loc"]); Page.MetaDescription = "Indian Organizers in " + Convert.ToString(Session["loc"]) + lblOrganization.Text; FBMetaTags(); } foreach (ListItem item in chkServices.Items) { litServices.Text = litServices.Text + "
   " + item.Text + "
"; litSer.Text = litSer.Text + " " + item.Text; } if (Convert.ToString(litServices.Text) == "") { divServices.Visible = false; } else { divServices.Visible = true; } //if (gvServiceProviderPremium.Items.Count > 0) //{ // gvServceListing.Visible = false; //} //else //{ // gvServceListing.Visible = true; //} } private void GetData(int Id) { var objg = from objS in dbEmup.Event_Oraganization_Creates where objS.AdId == Id select objS; var result = objg.First(); litUserName.Text = Convert.ToString(result.UserDet.Name); lblTitle.Text = Convert.ToString(result.UserAdsDet.AdTitle); lblLocation.Text = Convert.ToString(result.UserAdsDet.Location); lblCity.Text = Convert.ToString(result.UserAdsDet.City); lblCategory.Text = Convert.ToString(result.UserAdsDet.CategoryDet.Categoryname); lblSubCategory.Text = Convert.ToString(result.UserAdsDet.SubCategoryDet.SubCategory); lblSubCategory.Text = Convert.ToString(result.UserAdsDet.SubCategoryDet.SubCategory); // sId = Convert.ToString(result.UserAdsDet.SubCategoryId); litUserId.Text = Convert.ToString(result.UserAdsDet.UserEmailId); litUserSerNo.Text = Convert.ToString(result.UserDet.UserSerNo); litCatId.Text = Convert.ToString(result.UserAdsDet.CategoryId); litSubCatId.Text = Convert.ToString(result.UserAdsDet.SubCategoryId); if (result.PostedBy != null) { lblPostedBy.Text = result.PostedBy.ToString(); } lblDesc.Text = result.UserAdsDet.Description.ToString(); lblLocation.Text = result.UserAdsDet.Location.ToString(); litUserId.Text = result.UserAdsDet.UserEmailId.ToString(); imgOrgLogo.ImageUrl = "LoadPhoto.aspx?UserId=" + litUserSerNo.Text; lblOrgabnizer.Text = Convert.ToString(result.UserAdsDet.UserDet.Name); lblOrganization.Text = Convert.ToString(result.UserAdsDet.UserDet.BusinessName); lblOrgEmail.Text = Convert.ToString(result.UserAdsDet.UserEmailId); lblOrgWebsite.Text = Convert.ToString(result.UserAdsDet.UserDet.Website); lblOrgContactNo.Text = Convert.ToString(result.UserAdsDet.UserDet.ContactNo); litImageUrl.Text = Convert.ToString(result.UserAdsDet.ImageUrl); litAdid.Text = Convert.ToString(result.AdId); if (result.UserAdsDet.AdType == "Free") { divAdType.Visible = false; } else { divAdType.Visible = true; } this.Title = lblSubCategory.Text + " " + lblTitle.Text + " " + lblLocation.Text; if (result.UserAdsDet.Description == "") { divDesc.Visible = false; } else { divDesc.Visible = true; } if (result.Broachure == null) { divBrochure.Visible = false; } else { divBrochure.Visible = true; } Page.Title = "Indian event Organizations, Desi event Organizations in " + lblCity.Text + "-" + lblTitle.Text; // litPostedOn.Text = GetTimeAgo(DateTime.Now.ToUniversalTime().Date.ToString(), result.UserAdsDet.CreatedDate.ToString()); latti = Convert.ToString(result.UserAdsDet.Altitude); longi = Convert.ToString(result.UserAdsDet.Longitude); #region video display if (result.UserAdsDet.VideoUrl != "") { litUrl.Text = Convert.ToString(result.UserAdsDet.VideoUrl); litUrl.Text = litUrl.Text.Replace("https://youtu.be/", ""); litUrl.Text = litUrl.Text.Replace("https://www.youtube.com/watch?v=", ""); litUrl.Text = "https://www.youtube.com/embed/" + Convert.ToString(litUrl.Text); ifrmVideoUrl.Attributes.Add("src", Convert.ToString(litUrl.Text.Trim())); } else { divVideo.Visible = false; } if (result.Broachure == null) { gvBrochure.Visible = false; } else { gvBrochure.Visible = true; } #endregion } protected void DownloadFile(object sender, EventArgs e) { int AdId = int.Parse((sender as LinkButton).CommandArgument); byte[] bytes; string fileName; string constr = ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString; using (SqlConnection con = new SqlConnection(constr)) { using (SqlCommand cmd = new SqlCommand()) { cmd.CommandText = "select AdId, Broachure from Event_Oraganization_Create where AdId=@AdId"; cmd.Parameters.AddWithValue("@AdId", AdId); cmd.Connection = con; con.Open(); using (SqlDataReader sdr = cmd.ExecuteReader()) { sdr.Read(); bytes = (byte[])sdr["Broachure"]; fileName = sdr["AdId"].ToString(); } con.Close(); } } //Response.ClearContent(); //Response.Clear(); //Response.AddHeader("Content-Disposition", "attachment; filename=" + fileName +".pdf"); //Response.AddHeader("Content-Length", fileName.Length.ToString()); //Response.ContentType = "application/octet-stream"; Response.Clear(); Response.Buffer = true; Response.Charset = ""; Response.Cache.SetCacheability(HttpCacheability.NoCache); Response.AppendHeader("Content-Disposition", "attachment; filename=" + fileName + ".pdf"); Response.BinaryWrite(bytes); Response.Flush(); Response.End(); } private void BindBrochure() { gvBrochure.DataSource = GetBrochure(Convert.ToInt16(litAID.Text)); gvBrochure.DataBind(); } private IQueryable GetBrochure(Int16 IntadId) { var objA = (from objG in dbEmup.Event_Oraganization_Creates where objG.AdId == IntadId orderby objG.AdId descending select new { Adid = objG.UserAdsDet.UserAdId, }).Take(1); return objA; } protected void btnContact_Click(object sender, EventArgs e) { if (Page.IsValid) { AdResponseDet objAdResponseDet = new AdResponseDet(); //AdResponseDet objAdResponseDet; //objAdResponseDet = new AdResponseDet(); objAdResponseDet.RespondentName = Convert.ToString(txtName.Text); objAdResponseDet.UserEmailId = Convert.ToString(litUserId.Text); objAdResponseDet.AdId = Convert.ToInt16(litAID.Text); objAdResponseDet.RespondentMailId = Convert.ToString(txtEmail.Text); objAdResponseDet.AdResponseMsg = Convert.ToString(txtMsg.Text); // objAdResponseDet.CategoryId = Convert.ToInt16(litCatId.Text); objAdResponseDet.AdResponseDate = DateTime.Now; objAdResponseDet.Location = "-"; //objAdResponseDet.AdResponseMsg = Convert.ToString(txtMsg.Text); objAdResponseDet.PhoneNo = Convert.ToString(txtContactNo.Text); try { dbEmup.AdResponseDets.InsertOnSubmit(objAdResponseDet); dbEmup.SubmitChanges(); clsMail.AdResponseMail(Convert.ToString(litUserId.Text), Convert.ToString(litUserName.Text), Convert.ToString(txtName.Text)); clsPublicMethods.ClearControls(Page.Controls); lblMsg.Text = "Message has been sent "; } catch (Exception ex) { throw ex; } finally { //Response.Redirect("Default.aspx"); } } } private void BindGridViewLocation(string strLoc) { //gvServiceProviderPremium.DataSource = clsPublic.GetProvidersListings(Convert.ToInt16(litCatId.Text), strLoc, "Premium"); //gvServiceProviderPremium.DataBind(); gvServceListing.DataSource = GetProvidersListings(27, strLoc, "Free"); gvServceListing.DataBind(); //gvServiceProviderPremium.DataSource = GetProvidersListings(27, strLoc, "Premium"); //gvServiceProviderPremium.DataBind(); } private void BindGridViewLocation(int startzip, int endzip) { //gvServiceProviderPremium.DataSource = clsPublic.GetProvidersListings(Convert.ToInt16(litCatId.Text), strLoc, "Premium"); //gvServiceProviderPremium.DataBind(); gvServceListing.DataSource = GetProvidersListings(27, startzip, endzip, "Free"); gvServceListing.DataBind(); //gvServiceProviderPremium.DataSource = GetProvidersListings(27, startzip, endzip, "Premium"); //gvServiceProviderPremium.DataBind(); } private void BindGridViewListings(double latitude, double longitude) { //gvServiceProviderPremium.DataSource = clsPublic.GetProvidersListings(Convert.ToInt16(litCatId.Text), strLoc, "Premium"); //gvServiceProviderPremium.DataBind(); gvServceListing.DataSource = GetBUsersByRadius(latitude, longitude, 27, 21); gvServceListing.DataBind(); //gvPremiumProviders.DataSource = clsPublicMethods.GetProvidersListings(27, startzip, endzip, "Premium"); //gvPremiumProviders.DataBind(); } private void BindGridViewListings() { gvServceListing.DataSource =GetProvidersListings(27); gvServceListing.DataBind(); } //private void GetAdImages() //{ // clsPublicMethods.FillDropDownList(clsPublicMethods.GetAdImages(Convert.ToInt16(Convert.ToInt16(Request.QueryString["Id"]))), ddlAdImages); // for (int i = 0; i < ddlAdImages.Items.Count; i++) // { // ddlAdImages.SelectedIndex = i; // Image img = new Image(); // instantiating the control // img.Height = 200; // img.Width = 200; // img.Attributes.Add("style", "z-index:9999999999 !important"); // img.ImageUrl = "LoadPhoto.aspx?AdImageId=" + Convert.ToInt16(ddlAdImages.SelectedValue); // divAdImages.Controls.Add(img); // } //} private void GetServices() { clsPublicMethods.FillCheckBoxList(GetUserServicesList(Convert.ToInt16(litAID.Text)), chkServices); } public IQueryable GetUserServicesList(int adId) { var objC = from objL in dbEmup.UserAdServiceDets where objL.UserAdID == adId select new { Value = objL.ServiceId, Text = objL.ServiceDet.ServiceName }; return objC; } private void BindRelatedAds(string strLoc) { gvRelatedPremiumAds.DataSource = GetAds("Premium", Convert.ToInt16(litAID.Text), strLoc); gvRelatedPremiumAds.DataBind(); gvRelatedAds.DataSource = GetAds("Free", Convert.ToInt16(litAID.Text), strLoc); gvRelatedAds.DataBind(); } private void BindRelatedAds(int startzip, int endzip) { gvRelatedPremiumAds.DataSource = GetAds("Premium", Convert.ToInt16(litAID.Text), startzip, endzip); gvRelatedPremiumAds.DataBind(); gvRelatedAds.DataSource = GetAds("Free", Convert.ToInt16(litAID.Text), startzip, endzip); gvRelatedAds.DataBind(); } private void BindRelatedAds() { gvRelatedPremiumAds.DataSource = GetAds("Premium", Convert.ToInt16(litAID.Text)); gvRelatedPremiumAds.DataBind(); gvRelatedAds.DataSource = GetAds("Free", Convert.ToInt16(litAID.Text)); gvRelatedAds.DataBind(); } private void BindRelatedAds(double latitude, double longitude) { gvRelatedPremiumAds.DataSource = clsPublicMethods.GetEventsorgByRadius(latitude, longitude, 27, 293, "Premium"); gvRelatedPremiumAds.DataBind(); gvRelatedAds.DataSource = clsPublicMethods.GetEventsorgByRadius(latitude, longitude, 27, 293, "Free"); gvRelatedAds.DataBind(); } //private void BindRelatedAds(string strloc) //{ // gvRelatedPremiumAds.DataSource = RelatedAds(27, "Premium", Convert.ToInt16(Request.QueryString["Id"]), strloc); // gvRelatedPremiumAds.DataBind(); // gvRelatedAds.DataSource = RelatedAds(27, "Free", Convert.ToInt16(Request.QueryString["Id"]), strloc); // gvRelatedAds.DataBind(); //} private void BindUserAds(string strLoc) { rpPUserads.DataSource = GetMyAds(Convert.ToString(litUserId.Text), 27, 293, Convert.ToInt16(litAID.Text), "Premium", strLoc); rpPUserads.DataBind(); gvMyPosts.DataSource = GetMyAds(Convert.ToString(litUserId.Text), 27, 293, Convert.ToInt16(litAID.Text), "Free", strLoc); gvMyPosts.DataBind(); } private void BindUserAds() { rpPUserads.DataSource = GetMyAds(Convert.ToString(litUserId.Text), 27, 293, Convert.ToInt16(litAID.Text), "Premium"); rpPUserads.DataBind(); gvMyPosts.DataSource = GetMyAds(Convert.ToString(litUserId.Text), 27, 293, Convert.ToInt16(litAID.Text), "Free"); gvMyPosts.DataBind(); } private void BindUserAds(int startzip, int endzip) { rpPUserads.DataSource = GetMyAds(Convert.ToString(litUserId.Text), 27, 293, Convert.ToInt16(litAID.Text), "Premium", startzip, endzip); rpPUserads.DataBind(); gvMyPosts.DataSource = GetMyAds(Convert.ToString(litUserId.Text), 27, 293, Convert.ToInt16(litAID.Text), "Free", startzip, endzip); gvMyPosts.DataBind(); } private void BindUserAds(double latitude, double longitude) { rpPUserads.DataSource = clsPublicMethods.GetUserOrgByRadius(latitude, longitude, 27, 293, "Premium", Convert.ToString(litUserId.Text)); rpPUserads.DataBind(); gvMyPosts.DataSource = clsPublicMethods.GetUserOrgByRadius(latitude, longitude, 27, 293, "Free", Convert.ToString(litUserId.Text)); gvMyPosts.DataBind(); } public IQueryable GetMyAds(string userId, int intCatId, int intSubCatId, int Adid, string Adtype, string strLoc) { var objA = (from objG in dbEmup.UserAdsDets where objG.UserEmailId == userId && objG.CategoryId == intCatId && objG.SubCategoryId == intSubCatId && objG.Status == null && objG.UserAdId != Adid && objG.AdType == Adtype && objG.City == strLoc orderby objG.UserAdId descending select new { Id = objG.UserAdId, AdTitle = objG.AdTitle, Category = objG.CategoryDet.Categoryname, SubCategory = objG.SubCategoryDet.SubCategory, Location = objG.City, Status = Convert.ToString(objG.Status), PostedDate = objG.CreatedDate, AdEventDetail = objG.City.Replace(",", "-") + "-" + objG.AdTitle.Replace(" ", "-").Replace(",", "").Replace(":", "").Replace("!", "").Replace("@", "").Replace("#", "").Replace("$", "").Replace("%", "").Replace("^", "").Replace("&", "").Replace("*", "").Replace("(", "").Replace(")", "").Replace("+", "").Replace("=", "").Replace("{", "").Replace("}", "").Replace(";", "").Replace("'", "").Replace("<", "").Replace(">", "").Replace("/", "").Replace("?", "").Replace("|", "").Trim() + "-" + objG.UserAdId, AdOrganizerDetail = objG.City.Replace(",", "-") + "-" + objG.AdTitle.Replace(" ", "-").Replace(",", "").Replace(":", "").Replace("!", "").Replace("@", "").Replace("#", "").Replace("$", "").Replace("%", "").Replace("^", "").Replace("&", "").Replace("*", "").Replace("(", "").Replace(")", "").Replace("+", "").Replace("=", "").Replace("{", "").Replace("}", "").Replace(";", "").Replace("'", "").Replace("<", "").Replace(">", "").Replace("/", "").Replace("?", "").Replace("|", "").Trim() + "-" + objG.UserAdId, AdSupplierDetail = objG.City.Replace(",", "-") + "-" + objG.AdTitle.Replace(" ", "-").Replace(",", "").Replace(":", "").Replace("!", "").Replace("@", "").Replace("#", "").Replace("$", "").Replace("%", "").Replace("^", "").Replace("&", "").Replace("*", "").Replace("(", "").Replace(")", "").Replace("+", "").Replace("=", "").Replace("{", "").Replace("}", "").Replace(";", "").Replace("'", "").Replace("<", "").Replace(">", "").Replace("/", "").Replace("?", "").Replace("|", "").Trim() + "-" + objG.UserAdId, AdVenueDetail = objG.City.Replace(",", "-") + "-" + objG.AdTitle.Replace(" ", "-").Replace(",", "").Replace(":", "").Replace("!", "").Replace("@", "").Replace("#", "").Replace("$", "").Replace("%", "").Replace("^", "").Replace("&", "").Replace("*", "").Replace("(", "").Replace(")", "").Replace("+", "").Replace("=", "").Replace("{", "").Replace("}", "").Replace(";", "").Replace("'", "").Replace("<", "").Replace(">", "").Replace("/", "").Replace("?", "").Replace("|", "").Trim() + "-" + objG.UserAdId, }).Take(10); return objA; } public IQueryable GetMyAds(string userId, int intCatId, int intSubCatId, int Adid, string Adtype) { var objA = (from objG in dbEmup.UserAdsDets where objG.UserEmailId == userId && objG.CategoryId == intCatId && objG.SubCategoryId == intSubCatId && objG.Status == null && objG.UserAdId != Adid && objG.AdType == Adtype orderby objG.UserAdId descending select new { Id = objG.UserAdId, AdId = objG.UserAdId, AdTitle = objG.AdTitle, OrganizationName = objG.AdTitle, Category = objG.CategoryDet.Categoryname, SubCategory = objG.SubCategoryDet.SubCategory, Location = objG.City, City = objG.City, Status = Convert.ToString(objG.Status), PostedDate = objG.CreatedDate, AdEventDetail = objG.City.Replace(",", "-") + "-" + objG.AdTitle.Replace(" ", "-").Replace(",", "").Replace(":", "").Replace("!", "").Replace("@", "").Replace("#", "").Replace("$", "").Replace("%", "").Replace("^", "").Replace("&", "").Replace("*", "").Replace("(", "").Replace(")", "").Replace("+", "").Replace("=", "").Replace("{", "").Replace("}", "").Replace(";", "").Replace("'", "").Replace("<", "").Replace(">", "").Replace("/", "").Replace("?", "").Replace("|", "").Trim() + "-" + objG.UserAdId, AdOrganizerDetail = objG.City.Replace(",", "-") + "-" + objG.AdTitle.Replace(" ", "-").Replace(",", "").Replace(":", "").Replace("!", "").Replace("@", "").Replace("#", "").Replace("$", "").Replace("%", "").Replace("^", "").Replace("&", "").Replace("*", "").Replace("(", "").Replace(")", "").Replace("+", "").Replace("=", "").Replace("{", "").Replace("}", "").Replace(";", "").Replace("'", "").Replace("<", "").Replace(">", "").Replace("/", "").Replace("?", "").Replace("|", "").Trim() + "-" + objG.UserAdId, AdSupplierDetail = objG.City.Replace(",", "-") + "-" + objG.AdTitle.Replace(" ", "-").Replace(",", "").Replace(":", "").Replace("!", "").Replace("@", "").Replace("#", "").Replace("$", "").Replace("%", "").Replace("^", "").Replace("&", "").Replace("*", "").Replace("(", "").Replace(")", "").Replace("+", "").Replace("=", "").Replace("{", "").Replace("}", "").Replace(";", "").Replace("'", "").Replace("<", "").Replace(">", "").Replace("/", "").Replace("?", "").Replace("|", "").Trim() + "-" + objG.UserAdId, AdVenueDetail = objG.City.Replace(",", "-") + "-" + objG.AdTitle.Replace(" ", "-").Replace(",", "").Replace(":", "").Replace("!", "").Replace("@", "").Replace("#", "").Replace("$", "").Replace("%", "").Replace("^", "").Replace("&", "").Replace("*", "").Replace("(", "").Replace(")", "").Replace("+", "").Replace("=", "").Replace("{", "").Replace("}", "").Replace(";", "").Replace("'", "").Replace("<", "").Replace(">", "").Replace("/", "").Replace("?", "").Replace("|", "").Trim() + "-" + objG.UserAdId, }).Take(10); return objA; } public IQueryable GetMyAds(string userId, int intCatId, int intSubCatId, int Adid, string Adtype, int startZip, int endZip) { var objA = (from objG in dbEmup.UserAdsDets where objG.UserEmailId == userId && objG.CategoryId == intCatId && objG.SubCategoryId == intSubCatId && objG.Status == null && objG.UserAdId != Adid && objG.AdType == Adtype && (Convert.ToInt32(objG.ZipCode) >= startZip && Convert.ToInt32(objG.ZipCode) <= endZip) orderby objG.UserAdId descending select new { Id = objG.UserAdId, AdTitle = objG.AdTitle, Category = objG.CategoryDet.Categoryname, SubCategory = objG.SubCategoryDet.SubCategory, Location = objG.City, Status = Convert.ToString(objG.Status), PostedDate = objG.CreatedDate, AdEventDetail = objG.City.Replace(",", "-") + "-" + objG.AdTitle.Replace(" ", "-").Replace(",", "").Replace(":", "").Replace("!", "").Replace("@", "").Replace("#", "").Replace("$", "").Replace("%", "").Replace("^", "").Replace("&", "").Replace("*", "").Replace("(", "").Replace(")", "").Replace("+", "").Replace("=", "").Replace("{", "").Replace("}", "").Replace(";", "").Replace("'", "").Replace("<", "").Replace(">", "").Replace("/", "").Replace("?", "").Replace("|", "").Trim() + "-" + objG.UserAdId, AdOrganizerDetail = objG.City.Replace(",", "-") + "-" + objG.AdTitle.Replace(" ", "-").Replace(",", "").Replace(":", "").Replace("!", "").Replace("@", "").Replace("#", "").Replace("$", "").Replace("%", "").Replace("^", "").Replace("&", "").Replace("*", "").Replace("(", "").Replace(")", "").Replace("+", "").Replace("=", "").Replace("{", "").Replace("}", "").Replace(";", "").Replace("'", "").Replace("<", "").Replace(">", "").Replace("/", "").Replace("?", "").Replace("|", "").Trim() + "-" + objG.UserAdId, AdSupplierDetail = objG.City.Replace(",", "-") + "-" + objG.AdTitle.Replace(" ", "-").Replace(",", "").Replace(":", "").Replace("!", "").Replace("@", "").Replace("#", "").Replace("$", "").Replace("%", "").Replace("^", "").Replace("&", "").Replace("*", "").Replace("(", "").Replace(")", "").Replace("+", "").Replace("=", "").Replace("{", "").Replace("}", "").Replace(";", "").Replace("'", "").Replace("<", "").Replace(">", "").Replace("/", "").Replace("?", "").Replace("|", "").Trim() + "-" + objG.UserAdId, AdVenueDetail = objG.City.Replace(",", "-") + "-" + objG.AdTitle.Replace(" ", "-").Replace(",", "").Replace(":", "").Replace("!", "").Replace("@", "").Replace("#", "").Replace("$", "").Replace("%", "").Replace("^", "").Replace("&", "").Replace("*", "").Replace("(", "").Replace(")", "").Replace("+", "").Replace("=", "").Replace("{", "").Replace("}", "").Replace(";", "").Replace("'", "").Replace("<", "").Replace(">", "").Replace("/", "").Replace("?", "").Replace("|", "").Trim() + "-" + objG.UserAdId, }).Take(10); return objA; } public IQueryable GetAds(string adtype, int intAdid, string strLoc) { var objA = (from objG in dbEmup.Event_Oraganization_Creates where objG.UserAdsDet.Status == null && objG.UserAdsDet.AdType == adtype && objG.AdId != intAdid && objG.UserAdsDet.City == strLoc orderby objG.AdId descending select new { AdId = objG.AdId, AdTitle = objG.UserAdsDet.AdTitle, //Name=objG.OrganizerName, Category = objG.UserAdsDet.CategoryDet.Categoryname, SubCategory = objG.UserAdsDet.SubCategoryDet.SubCategory, Location = objG.UserAdsDet.City, Name = objG.UserAdsDet.UserDet.Name, AdEventDetail = objG.UserAdsDet.City.Replace(",", "-") + "-" + objG.UserAdsDet.AdTitle.Replace(" ", "-").Replace(",", "").Replace(":", "").Replace("!", "").Replace("@", "").Replace("#", "").Replace("$", "").Replace("%", "").Replace("^", "").Replace("&", "").Replace("*", "").Replace("(", "").Replace(")", "").Replace("+", "").Replace("=", "").Replace("{", "").Replace("}", "").Replace(";", "").Replace("'", "").Replace("<", "").Replace(">", "").Replace("/", "").Replace("?", "").Replace("|", "").Trim() + "-" + objG.UserAdsDet.UserAdId, AdOrganizerDetail = objG.UserAdsDet.City.Replace(",", "-") + "-" + objG.UserAdsDet.AdTitle.Replace(" ", "-").Replace(",", "").Replace(":", "").Replace("!", "").Replace("@", "").Replace("#", "").Replace("$", "").Replace("%", "").Replace("^", "").Replace("&", "").Replace("*", "").Replace("(", "").Replace(")", "").Replace("+", "").Replace("=", "").Replace("{", "").Replace("}", "").Replace(";", "").Replace("'", "").Replace("<", "").Replace(">", "").Replace("/", "").Replace("?", "").Replace("|", "").Trim() + "-" + objG.UserAdsDet.UserAdId, AdSupplierDetail = objG.UserAdsDet.City.Replace(",", "-") + "-" + objG.UserAdsDet.AdTitle.Replace(" ", "-").Replace(",", "").Replace(":", "").Replace("!", "").Replace("@", "").Replace("#", "").Replace("$", "").Replace("%", "").Replace("^", "").Replace("&", "").Replace("*", "").Replace("(", "").Replace(")", "").Replace("+", "").Replace("=", "").Replace("{", "").Replace("}", "").Replace(";", "").Replace("'", "").Replace("<", "").Replace(">", "").Replace("/", "").Replace("?", "").Replace("|", "").Trim() + "-" + objG.UserAdsDet.UserAdId, AdVenueDetail = objG.UserAdsDet.City.Replace(",", "-") + "-" + objG.UserAdsDet.AdTitle.Replace(" ", "-").Replace(",", "").Replace(":", "").Replace("!", "").Replace("@", "").Replace("#", "").Replace("$", "").Replace("%", "").Replace("^", "").Replace("&", "").Replace("*", "").Replace("(", "").Replace(")", "").Replace("+", "").Replace("=", "").Replace("{", "").Replace("}", "").Replace(";", "").Replace("'", "").Replace("<", "").Replace(">", "").Replace("/", "").Replace("?", "").Replace("|", "").Trim() + "-" + objG.UserAdsDet.UserAdId, }).Take(10); return objA; } public IQueryable GetAds(string adtype, int intAdid, int startZip, int endZip) { var objA = (from objG in dbEmup.Event_Oraganization_Creates where objG.UserAdsDet.Status == null && objG.UserAdsDet.AdType == adtype && objG.AdId != intAdid && (Convert.ToInt32(objG.UserAdsDet.ZipCode) >= startZip && Convert.ToInt32(objG.UserAdsDet.ZipCode) <= endZip) orderby objG.AdId descending select new { AdId = objG.AdId, AdTitle = objG.UserAdsDet.AdTitle, //Name=objG.OrganizerName, Category = objG.UserAdsDet.CategoryDet.Categoryname, SubCategory = objG.UserAdsDet.SubCategoryDet.SubCategory, Location = objG.UserAdsDet.City, Name = objG.UserAdsDet.UserDet.Name, AdEventDetail = objG.UserAdsDet.City.Replace(",", "-") + "-" + objG.UserAdsDet.AdTitle.Replace(" ", "-").Replace(",", "").Replace(":", "").Replace("!", "").Replace("@", "").Replace("#", "").Replace("$", "").Replace("%", "").Replace("^", "").Replace("&", "").Replace("*", "").Replace("(", "").Replace(")", "").Replace("+", "").Replace("=", "").Replace("{", "").Replace("}", "").Replace(";", "").Replace("'", "").Replace("<", "").Replace(">", "").Replace("/", "").Replace("?", "").Replace("|", "").Trim() + "-" + objG.AdId, AdOrganizerDetail = objG.UserAdsDet.City.Replace(",", "-") + "-" + objG.UserAdsDet.AdTitle.Replace(" ", "-").Replace(",", "").Replace(":", "").Replace("!", "").Replace("@", "").Replace("#", "").Replace("$", "").Replace("%", "").Replace("^", "").Replace("&", "").Replace("*", "").Replace("(", "").Replace(")", "").Replace("+", "").Replace("=", "").Replace("{", "").Replace("}", "").Replace(";", "").Replace("'", "").Replace("<", "").Replace(">", "").Replace("/", "").Replace("?", "").Replace("|", "").Trim() + "-" + objG.AdId, AdSupplierDetail = objG.UserAdsDet.City.Replace(",", "-") + "-" + objG.UserAdsDet.AdTitle.Replace(" ", "-").Replace(",", "").Replace(":", "").Replace("!", "").Replace("@", "").Replace("#", "").Replace("$", "").Replace("%", "").Replace("^", "").Replace("&", "").Replace("*", "").Replace("(", "").Replace(")", "").Replace("+", "").Replace("=", "").Replace("{", "").Replace("}", "").Replace(";", "").Replace("'", "").Replace("<", "").Replace(">", "").Replace("/", "").Replace("?", "").Replace("|", "").Trim() + "-" + objG.AdId, AdVenueDetail = objG.UserAdsDet.City.Replace(",", "-") + "-" + objG.UserAdsDet.AdTitle.Replace(" ", "-").Replace(",", "").Replace(":", "").Replace("!", "").Replace("@", "").Replace("#", "").Replace("$", "").Replace("%", "").Replace("^", "").Replace("&", "").Replace("*", "").Replace("(", "").Replace(")", "").Replace("+", "").Replace("=", "").Replace("{", "").Replace("}", "").Replace(";", "").Replace("'", "").Replace("<", "").Replace(">", "").Replace("/", "").Replace("?", "").Replace("|", "").Trim() + "-" + objG.AdId, }).Take(10); return objA; } public IQueryable GetAds(string adtype, int intAdid) { var objA = (from objG in dbEmup.Event_Oraganization_Creates where objG.UserAdsDet.Status == null && objG.UserAdsDet.AdType == adtype && objG.AdId != intAdid orderby objG.AdId descending select new { AdId = objG.AdId, AdTitle = objG.UserAdsDet.AdTitle, OrganizationName = objG.UserAdsDet.AdTitle, Category = objG.UserAdsDet.CategoryDet.Categoryname, SubCategory = objG.UserAdsDet.SubCategoryDet.SubCategory, Location = objG.UserAdsDet.City, City = objG.UserAdsDet.City, Name = objG.UserAdsDet.UserDet.Name, AdEventDetail = objG.UserAdsDet.City.Replace(",", "-") + "-" + objG.UserAdsDet.AdTitle.Replace(" ", "-").Replace(",", "").Replace(":", "").Replace("!", "").Replace("@", "").Replace("#", "").Replace("$", "").Replace("%", "").Replace("^", "").Replace("&", "").Replace("*", "").Replace("(", "").Replace(")", "").Replace("+", "").Replace("=", "").Replace("{", "").Replace("}", "").Replace(";", "").Replace("'", "").Replace("<", "").Replace(">", "").Replace("/", "").Replace("?", "").Replace("|", "").Trim() + "-" + objG.AdId, AdOrganizerDetail = objG.UserAdsDet.City.Replace(",", "-") + "-" + objG.UserAdsDet.AdTitle.Replace(" ", "-").Replace(",", "").Replace(":", "").Replace("!", "").Replace("@", "").Replace("#", "").Replace("$", "").Replace("%", "").Replace("^", "").Replace("&", "").Replace("*", "").Replace("(", "").Replace(")", "").Replace("+", "").Replace("=", "").Replace("{", "").Replace("}", "").Replace(";", "").Replace("'", "").Replace("<", "").Replace(">", "").Replace("/", "").Replace("?", "").Replace("|", "").Trim() + "-" + objG.AdId, AdSupplierDetail = objG.UserAdsDet.City.Replace(",", "-") + "-" + objG.UserAdsDet.AdTitle.Replace(" ", "-").Replace(",", "").Replace(":", "").Replace("!", "").Replace("@", "").Replace("#", "").Replace("$", "").Replace("%", "").Replace("^", "").Replace("&", "").Replace("*", "").Replace("(", "").Replace(")", "").Replace("+", "").Replace("=", "").Replace("{", "").Replace("}", "").Replace(";", "").Replace("'", "").Replace("<", "").Replace(">", "").Replace("/", "").Replace("?", "").Replace("|", "").Trim() + "-" + objG.AdId, AdVenueDetail = objG.UserAdsDet.City.Replace(",", "-") + "-" + objG.UserAdsDet.AdTitle.Replace(" ", "-").Replace(",", "").Replace(":", "").Replace("!", "").Replace("@", "").Replace("#", "").Replace("$", "").Replace("%", "").Replace("^", "").Replace("&", "").Replace("*", "").Replace("(", "").Replace(")", "").Replace("+", "").Replace("=", "").Replace("{", "").Replace("}", "").Replace(";", "").Replace("'", "").Replace("<", "").Replace(">", "").Replace("/", "").Replace("?", "").Replace("|", "").Trim() + "-" + objG.AdId, }).Take(10); return objA; } public IQueryable RelatedAds(int intCatId, string adtype, int intAdid, string strloc) { var objA = (from objG in dbEmup.UserAdsDets where objG.CategoryId == intCatId && objG.Status == null && objG.AdType == adtype && objG.UserAdId != intAdid && objG.City == strloc orderby objG.UserAdId descending select new { AdId = objG.UserAdId, AdTitle = objG.AdTitle, Category = objG.CategoryDet.Categoryname, SubCategory = objG.SubCategoryDet.SubCategory, Location = objG.City, Name = objG.UserDet.Name, AdEventDetail = objG.City.Replace(",", "-") + "-" + objG.AdTitle.Replace(" ", "-").Replace(",", "").Replace(":", "").Replace("!", "").Replace("@", "").Replace("#", "").Replace("$", "").Replace("%", "").Replace("^", "").Replace("&", "").Replace("*", "").Replace("(", "").Replace(")", "").Replace("+", "").Replace("=", "").Replace("{", "").Replace("}", "").Replace(";", "").Replace("'", "").Replace("<", "").Replace(">", "").Replace("/", "").Replace("?", "").Replace("|", "").Trim() + "-" + objG.UserAdId, AdOrganizerDetail = objG.City.Replace(",", "-") + "-" + objG.AdTitle.Replace(" ", "-").Replace(",", "").Replace(":", "").Replace("!", "").Replace("@", "").Replace("#", "").Replace("$", "").Replace("%", "").Replace("^", "").Replace("&", "").Replace("*", "").Replace("(", "").Replace(")", "").Replace("+", "").Replace("=", "").Replace("{", "").Replace("}", "").Replace(";", "").Replace("'", "").Replace("<", "").Replace(">", "").Replace("/", "").Replace("?", "").Replace("|", "").Trim() + "-" + objG.UserAdId, AdSupplierDetail = objG.City.Replace(",", "-") + "-" + objG.AdTitle.Replace(" ", "-").Replace(",", "").Replace(":", "").Replace("!", "").Replace("@", "").Replace("#", "").Replace("$", "").Replace("%", "").Replace("^", "").Replace("&", "").Replace("*", "").Replace("(", "").Replace(")", "").Replace("+", "").Replace("=", "").Replace("{", "").Replace("}", "").Replace(";", "").Replace("'", "").Replace("<", "").Replace(">", "").Replace("/", "").Replace("?", "").Replace("|", "").Trim() + "-" + objG.UserAdId, AdVenueDetail = objG.City.Replace(",", "-") + "-" + objG.AdTitle.Replace(" ", "-").Replace(",", "").Replace(":", "").Replace("!", "").Replace("@", "").Replace("#", "").Replace("$", "").Replace("%", "").Replace("^", "").Replace("&", "").Replace("*", "").Replace("(", "").Replace(")", "").Replace("+", "").Replace("=", "").Replace("{", "").Replace("}", "").Replace(";", "").Replace("'", "").Replace("<", "").Replace(">", "").Replace("/", "").Replace("?", "").Replace("|", "").Trim() + "-" + objG.UserAdId, }).Take(10); return objA; } private void GetGallery(int id) { GalleryId = id; DataSet dsLoadGallery = obj.fnLoadGallery(GalleryId); if (dsLoadGallery.Tables.Count > 0) { if (dsLoadGallery.Tables[0].Rows.Count > 0) { GalleryName = dsLoadGallery.Tables["LoadGallery"].Rows[0]["UserAdId"].ToString(); LoaddlGallery(); } } } protected void LoaddlGallery() { string GalleryPath = System.Configuration.ConfigurationManager.AppSettings["GalleryPath"] + GalleryId; string GalleryImagePath; string ThumbnailPath = System.Configuration.ConfigurationManager.AppSettings["ThumbnailPath"] + GalleryId; string ThumbnailImagePath; DirectoryInfo dir = new DirectoryInfo(MapPath(GalleryPath)); FileInfo[] file = dir.GetFiles(); DataTable dtLoadGallery = new DataTable(); dtLoadGallery.Columns.Add("GalleryImagePath"); dtLoadGallery.Columns.Add("ThumbnailImagePath"); foreach (FileInfo image in file) { if (image.Extension.ToLower() == ".jpg" || image.Extension.ToLower() == ".JPG" || image.Extension.ToLower() == ".jpeg" || image.Extension.ToLower() == ".JPEG" || image.Extension.ToLower() == ".gif" || image.Extension.ToLower() == ".png" || image.Extension.ToLower() == ".bmp") { GalleryImagePath = GalleryPath + "\\" + image.Name; ThumbnailImagePath = ThumbnailPath + "\\" + image.Name; dtLoadGallery.Rows.Add(GalleryImagePath, ThumbnailImagePath); } } //dlGallery.DataSource = dtLoadGallery; //dlGallery.DataBind(); } public DataSet GetBUsersByRadius(double latitude, double longitude, int catId, int partycatid) { DataSet ds = new DataSet(); string sqlQuery = "SELECT Top 16 UserSerNo,usertype, BusinessName, ContactNo,Location, Website, latitude, longitude, Verified,JhalakBusinessD FROM( SELECT z.UserSerNo ,z.usertype, z.BusinessName,z.ContactNo,z.Location,z.Latitude, z.Longitude, z.Website,z.Verified,"; sqlQuery += "concat(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE ( REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(z.BusinessName,'!', ''), '''', ''), '@', ''), '#', ''), '$', ''),'%',''),'^',''),'&',''),'*',''),'(',''),'-',''), '_',''),':',''),';',''),'',''),',',''),'.',''),'<',''),'>',''),'?',''),'/','')+ '-', "; sqlQuery += " z.UserSerNo) AS JhalakBusinessD , p.distance_unit"; sqlQuery += " * DEGREES(ACOS(COS(RADIANS(p.latpoint)) * COS(RADIANS(z.Latitude)) * COS(RADIANS(p.longpoint - z.Longitude)) "; sqlQuery += " + SIN(RADIANS(p.latpoint)) * SIN(RADIANS(z.Latitude)))) AS distance FROM Userdet AS z "; sqlQuery += " JOIN( SELECT " + latitude + " AS latpoint," + longitude + " AS longpoint, 200 AS radius, 111.045 AS distance_unit ) AS p ON 1 = 1 "; sqlQuery += " WHERE (z.CategoryId=" + catId + " OR z.CategoryId=" + partycatid + ") and z.Role='Business' and z.Latitude BETWEEN p.latpoint - (p.radius / p.distance_unit) AND p.latpoint + (p.radius / p.distance_unit) "; sqlQuery += " AND z.Longitude BETWEEN p.longpoint - (p.radius / (p.distance_unit * COS(RADIANS(p.latpoint)))) AND p.longpoint + "; sqlQuery += " (p.radius / (p.distance_unit * COS(RADIANS(p.latpoint))))) AS d WHERE distance <= 200 order by usertype desc, UserSerNo desc "; string con = System.Configuration.ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString; SqlConnection connection = new SqlConnection(con); //SqlDataAdapter dataadapter = new SqlDataAdapter(sqlQuery, connection); connection.Open(); SqlCommand cmd = new SqlCommand(sqlQuery, connection); SqlDataAdapter da = new SqlDataAdapter(cmd); da.Fill(ds); connection.Close(); return ds; } private IQueryable GetProvidersListings(int intCatId) { var objA = (from objG in dbEmup.UserDets where objG.Role == "Business" && objG.CategoryId == intCatId orderby objG.UserType descending, objG.UserSerNo descending, objG.CreatedDate descending select new { UserId = objG.UserSerNo, UserSerNo = Convert.ToString(objG.UserSerNo), Name = objG.Name, Category = objG.CategoryDet.Categoryname, ContactNo = objG.BusinessContact, Location = objG.OperationLocatoin, usertype = Convert.ToString(Convert.ToString(objG.UserType)), AdType = Convert.ToString(Convert.ToString(objG.UserType)), BusinessName = Convert.ToString(objG.BusinessName), Website = Convert.ToString(objG.Website), AboutUs = Convert.ToString(objG.AboutUs), Verified = Convert.ToString(objG.Verified), JhalakBusinessD = objG.BusinessName.Replace(" ", "-").Replace(",", "").Replace(":", "").Replace("!", "").Replace("@", "").Replace("#", "").Replace("$", "").Replace("%", "").Replace("^", "").Replace("&", "").Replace("*", "").Replace("(", "").Replace(")", "").Replace("+", "").Replace("=", "").Replace("{", "").Replace("}", "").Replace(";", "").Replace("'", "").Replace("<", "").Replace(">", "").Replace("/", "").Replace("?", "").Replace("|", "").Trim() + "-" + objG.UserSerNo, }).Take(16); return objA; } public IQueryable GetProvidersListings(int intCatId, string strLoc, string strtype) { var objA = (from objG in dbEmup.UserDets where objG.Role == "Business" && objG.CategoryId == intCatId && objG.OperationLocatoin == strLoc && objG.UserType == strtype orderby objG.UserSerNo descending select new { UserId = objG.UserSerNo, UserSerNo = objG.UserSerNo, Name = objG.Name, Category = objG.CategoryDet.Categoryname, ContactNo = objG.BusinessContact, Location = objG.OperationLocatoin, BusinessName = objG.BusinessName, Website = Convert.ToString(objG.Website), AboutUs = Convert.ToString(objG.AboutUs), Verified = Convert.ToString(objG.Verified), JhalakBusinessD = objG.BusinessName.Replace(" ", "-").Replace(",", "").Replace(":", "").Replace("!", "").Replace("@", "").Replace("#", "").Replace("$", "").Replace("%", "").Replace("^", "").Replace("&", "").Replace("*", "").Replace("(", "").Replace(")", "").Replace("+", "").Replace("=", "").Replace("{", "").Replace("}", "").Replace(";", "").Replace("'", "").Replace("<", "").Replace(">", "").Replace("/", "").Replace("?", "").Replace("|", "").Trim() + "-" + objG.UserSerNo, }).Take(15); return objA; } public IQueryable GetProvidersListings(int intCatId, int startZip, int endZip, string strtype) { var objA = (from objG in dbEmup.UserDets where objG.Role == "Business" && objG.CategoryId == intCatId && objG.UserType == strtype && (Convert.ToInt32(objG.ZipCode) >= startZip && Convert.ToInt32(objG.ZipCode) <= endZip) orderby objG.UserSerNo descending select new { UserId = objG.UserSerNo, UserSerNo = objG.UserSerNo, Name = objG.Name, Category = objG.CategoryDet.Categoryname, ContactNo = objG.BusinessContact, Location = objG.OperationLocatoin, BusinessName = objG.BusinessName, Website = Convert.ToString(objG.Website), AboutUs = Convert.ToString(objG.AboutUs), Verified = Convert.ToString(objG.Verified), JhalakBusinessD = objG.BusinessName.Replace(" ", "-").Replace(",", "").Replace(":", "").Replace("!", "").Replace("@", "").Replace("#", "").Replace("$", "").Replace("%", "").Replace("^", "").Replace("&", "").Replace("*", "").Replace("(", "").Replace(")", "").Replace("+", "").Replace("=", "").Replace("{", "").Replace("}", "").Replace(";", "").Replace("'", "").Replace("<", "").Replace(">", "").Replace("/", "").Replace("?", "").Replace("|", "").Trim() + "-" + objG.UserSerNo, }).Take(15); return objA; } public IQueryable GetProvidersListings(int intCatId, string strtype) { var objA = (from objG in dbEmup.UserDets where objG.Role == "Business" && objG.CategoryId == intCatId && objG.UserType == strtype orderby objG.UserSerNo descending select new { UserId = objG.UserSerNo, UserSerNo = objG.UserSerNo, Name = objG.Name, Category = objG.CategoryDet.Categoryname, ContactNo = objG.BusinessContact, Location = objG.OperationLocatoin, BusinessName = objG.BusinessName, Website = Convert.ToString(objG.Website), AboutUs = Convert.ToString(objG.AboutUs), Verified = Convert.ToString(objG.Verified), JhalakBusinessD = objG.BusinessName.Replace(" ", "-").Replace(",", "").Replace(":", "").Replace("!", "").Replace("@", "").Replace("#", "").Replace("$", "").Replace("%", "").Replace("^", "").Replace("&", "").Replace("*", "").Replace("(", "").Replace(")", "").Replace("+", "").Replace("=", "").Replace("{", "").Replace("}", "").Replace(";", "").Replace("'", "").Replace("<", "").Replace(">", "").Replace("/", "").Replace("?", "").Replace("|", "").Trim() + "-" + objG.UserSerNo, }).Take(15); return objA; } protected void gvServceListing_ItemDataBound(object sender, RepeaterItemEventArgs e) { try { HiddenField adtype = e.Item.FindControl("hdtype") as HiddenField; Image imgtype = e.Item.FindControl("imgtype") as Image; if (adtype != null) { if (Convert.ToString(adtype.Value) == "Premium") { imgtype.Visible = true; } else { imgtype.Visible = false; } } } catch (Exception ex) { } } private void FBMetaTags() { HtmlMeta sitenameTag = new HtmlMeta(); sitenameTag.Attributes.Add("property", "og:sitename"); sitenameTag.Content = "https://events.jhalak.com"; Page.Header.Controls.Add(sitenameTag); HtmlMeta Titletag = new HtmlMeta(); Titletag.Attributes.Add("property", "og:title"); Titletag.Content = Convert.ToString(lblTitle.Text); Page.Header.Controls.Add(Titletag); HtmlMeta urlTag = new HtmlMeta(); urlTag.Attributes.Add("property", "og:url"); urlTag.Content = "https://events.jhalak.com/Event-Organization-Detail.aspx?Id=" + Convert.ToString(litAID.Text); Page.Header.Controls.Add(urlTag); HtmlMeta descriptionTag = new HtmlMeta(); urlTag.Attributes.Add("property", "og:description"); urlTag.Content = Convert.ToString(lblLocation.Text); Page.Header.Controls.Add(urlTag); HtmlMeta imageTag = new HtmlMeta(); imageTag.Attributes.Add("property", "og:image:url"); imageTag.Content = "https://jhalak.com/Compressed/" + Convert.ToString(litAID.Text) + ".jpeg"; Page.Header.Controls.Add(imageTag); HtmlMeta imagetypeTag = new HtmlMeta(); imagetypeTag.Attributes.Add("property", "og:image:type"); imagetypeTag.Content = " image / jpeg"; Page.Header.Controls.Add(imagetypeTag); HtmlMeta imagewidthTag = new HtmlMeta(); imagewidthTag.Attributes.Add("property", "og:image:width"); imagewidthTag.Content = "300"; Page.Header.Controls.Add(imagewidthTag); HtmlMeta imageheightTag = new HtmlMeta(); imageheightTag.Attributes.Add("property", "og:image:width"); imageheightTag.Content = "300"; Page.Header.Controls.Add(imageheightTag); HtmlMeta websiteTag = new HtmlMeta(); websiteTag.Attributes.Add("property", "og:type"); websiteTag.Content = "website"; Page.Header.Controls.Add(websiteTag); } protected void OnRatingChanged(object sender, RatingEventArgs e) { //if (Context.User.Identity.IsAuthenticated == false) //{ // HttpContext.Current.User = new GenericPrincipal(new GenericIdentity(string.Empty), null); // FormsAuthentication.SignOut(); // Session.Abandon(); // string spath = HttpContext.Current.Request.Url.AbsolutePath; // // Response.Redirect("Organizer-Login.aspx"); // //Response.Redirect("Sign-In.aspx?s=" + spath); //} bool blnRating = false; blnRating = ValidateUserRating(Convert.ToString(litiP.Text), Convert.ToInt16(litAdid.Text)); if (blnRating == false) { User_Ad_Review_Det obj = new User_Ad_Review_Det(); obj.UserEmailId = Convert.ToString(litUserId.Text); obj.Rating = Convert.ToInt16(e.Value); obj.Adid = Convert.ToInt16(litAdid.Text); // obj.CreatedBy = Convert.ToString(Context.User.Identity.Name.ToString()); obj.Ip = litiP.Text; dbEmup.User_Ad_Review_Dets.InsertOnSubmit(obj); dbEmup.SubmitChanges(); } GetRating(Convert.ToInt16(litAdid.Text)); } private void GetRating(int intAdid) { //DataTable dt = this.GetData("SELECT ISNULL(AVG(Rating), 0) AverageRating, COUNT(Rating) RatingCount FROM Movie_Rating where MovieId=" + movieId); DataTable dt = this.Getdata("SELECT ROUND(ISNULL(CAST(SUM(Rating) AS NUMERIC(5, 2)) / COUNT(Rating), 0), 1) AverageRating, COUNT(Rating) RatingCount FROM User_Ad_Review_Det where Adid= " + intAdid); rMovie.CurrentRating = Convert.ToInt32(dt.Rows[0]["AverageRating"]); lblRatingStatus.Text = Convert.ToString(dt.Rows[0]["RatingCount"]); // lblAverageRating.Text = Convert.ToString(dt.Rows[0]["AverageRating"]); lblAverageRating.Text = Convert.ToDouble(dt.Rows[0]["AverageRating"]).ToString("#0.0").Replace(".0", ""); //AvgRati = Convert.ToInt32(dt.Rows[0]["AverageRating"]); //rMovie.CurrentRating = Convert.ToInt32(dt.Rows[0]["AverageRating"]); //lblRatingStatus.Text = string.Format("{0} Users rated. Average Rating {1}", dt.Rows[0]["RatingCount"], dt.Rows[0]["AverageRating"]); } private void GetComments(int intAdid) { gvcomments.DataSource = GetUserComments(Convert.ToInt16(intAdid)); gvcomments.DataBind(); } private DataTable Getdata(string query) { DataTable dt = new DataTable(); string constr = ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString; using (SqlConnection con = new SqlConnection(constr)) { using (SqlCommand cmd = new SqlCommand(query)) { using (SqlDataAdapter sda = new SqlDataAdapter()) { cmd.CommandType = CommandType.Text; cmd.Connection = con; sda.SelectCommand = cmd; sda.Fill(dt); } } return dt; } } public IQueryable GetUserComments(int intAdid) { var objUserReviews = (from ObjReview in dbEmup.User_Ad_Review_Dets where ObjReview.Adid == intAdid orderby ObjReview.ReviewId descending select new { Comment = ObjReview.ReviewDesc, Name = ObjReview.Name, Date = ObjReview.Date // Rating=ObjReview.Rating //FunnyChamberTitle1 = "
" + objFunnyCham.Title.Substring(0, 150) + "..." + "
" + "", //JhalakFunnyChamber = (objFunnyCham.Title.Replace(" ", "-").Replace(",", "").Replace(":", "").Replace("!", "").Replace("@", "").Replace("#", "").Replace("$", "").Replace("%", "").Replace("^", "").Replace("&", "").Replace("*", "").Replace("(", "").Replace(")", "").Replace("+", "").Replace("=", "").Replace("{", "").Replace("}", "").Replace(";", "").Replace("'", "").Replace("<", "").Replace(">", "").Replace("/", "").Replace("?", "").Replace("|", "")).Trim() + "-" + objFunnyCham.FunnychamberId, //FunnychamberId = objFunnyCham.FunnychamberId, //ImageURl = objFunnyCham.ImageURL != null ? objFunnyCham.ImageURL : "/images/Jhalak-Logo.png", }).Take(10); return objUserReviews; } protected void btncomment_Click(object sender, EventArgs e) { User_Ad_Review_Det objAdReview; objAdReview = new User_Ad_Review_Det(); objAdReview.Name = Convert.ToString(txtCommentName.Text); objAdReview.ReviewerEmailId = Convert.ToString(txtCommentEmail.Text); objAdReview.UserEmailId = Convert.ToString(litUserId.Text); objAdReview.ReviewDesc = Convert.ToString(txtComment.Text); objAdReview.Date = DateTime.Now; objAdReview.Adid = Convert.ToInt16(litAdid.Text); try { dbEmup.User_Ad_Review_Dets.InsertOnSubmit(objAdReview); dbEmup.SubmitChanges(); clsPublicMethods.ClearControls(Page.Controls); gvcomments.DataSource = GetUserComments(Convert.ToInt16(litAdid.Text)); gvcomments.DataBind(); lblCommentMSG.Text = "
" + "Comment Submitted Sucessfully " + "
"; } catch (Exception ex) { throw ex; } finally { //Response.Redirect("Default.aspx"); } } private bool ValidateUserRating(string Ip, Int16 adid) { var obj = from objM in dbEmup.User_Ad_Review_Dets where objM.Ip == Ip && objM.Adid == adid select objM; User_Ad_Review_Det objR = obj.SingleOrDefault(); if (objR == null) return false; else return true; //bool exist = dbEmup.Movie_Ratings.Any(email => email.CreatedBy.Equals(Context.User.Identity.Name.ToString()) && ); //return exist; } protected void gvcomments_RowDataBound(object sender, GridViewRowEventArgs e) { foreach (GridViewRow rw in gvcomments.Rows) { Label tx = (Label)rw.FindControl("lblCComment"); if (tx.Text == "") rw.Visible = false; } //if (e.Row.Cells[2].Text == "") // e.Row.Visible = false; } #region photo gallery private void GetAdImages() { //old code starts here //clsPublicMethods.FillDropDownList(clsPublicMethods.GetAdImages(Convert.ToInt16(Convert.ToInt16(Request.QueryString["Id"]))), ddlAdImages); //for (int i = 0; i < ddlAdImages.Items.Count; i++) //{ // ddlAdImages.SelectedIndex = i; // Image img = new Image(); // instantiating the control // // img.Height = 100px; // img.Width = 350; // img.Attributes.Add("style", "z-index:9999999999 !important"); // img.ImageUrl = "LoadPhoto.aspx?AdImageId=" + Convert.ToInt16(ddlAdImages.SelectedValue); // divAdImages.Controls.Add(img); //} // old code ends here SqlConnection CN = new SqlConnection(@"Data Source=jhalakservices.cpm5bnayea5q.us-west-2.rds.amazonaws.com;Initial Catalog=Classifieds;Persist Security Info=True;User ID=Shailesh;Password=jhalak0987;"); CN.Open(); SqlCommand command = new SqlCommand("ListImages", CN); command.CommandType = System.Data.CommandType.StoredProcedure; command.Parameters.Add("Id", System.Data.SqlDbType.Int).Value = Convert.ToInt16(litAID.Text); //Initialize SQL adapter. SqlDataAdapter ADAP = new SqlDataAdapter(command); //Initialize Dataset. DataSet DS = new DataSet(); //Fill dataset with ImagesStore table. ADAP.Fill(DS, "ImagesStore"); CN.Close(); //Fill Grid with dataset. rptImage.DataSource = DS.Tables["ImagesStore"]; rptImage.DataBind(); } private IQueryable GetAdImages(int intAdId) { var objL = from objI in dbEmup.UserAdsImagesDets where objI.UserAdId == intAdId orderby objI.UserAdImageId ascending select new { ImageId = objI.UserAdImageId, Text = objI.Image, }; return objL; } protected void rptImage_ItemDataBound(object sender, RepeaterItemEventArgs e) { if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem) { Image img = (Image)e.Item.FindControl("img"); Label lbl = (Label)e.Item.FindControl("lbl"); HtmlAnchor htmla = (HtmlAnchor)e.Item.FindControl("htmla"); img.ImageUrl = "EventsImagesHandler.ashx?imageid=" + lbl.Text.ToString(); htmla.HRef = "EventsImagesHandler.ashx?imageid=" + lbl.Text.ToString(); //img.ImageUrl = "LoadPhoto.aspx?AdImageId=" + lbl.Text.ToString(); //htmla.HRef = "LoadPhoto.aspx?AdImageId=" + lbl.Text.ToString(); } } #endregion }