protected void Page_Load(object sender, EventArgs e) { PostAroundServiceClient client = new PostAroundServiceClient(); Category[] arrCategroies = client.GetListCategories(); client.Close(); List<Category> lstCategories = arrCategroies.ToList(); Category firstCategory = new Category(); firstCategory.ID = 0; firstCategory.Name = "Everything"; firstCategory.Color = "#e3e3e3"; lstCategories.Insert(0, firstCategory); rptCategoriesColumn1.ItemCreated += new RepeaterItemEventHandler(rptCategories_ItemCreated); rptCategoriesColumn1.DataSource = L10NCategories(lstCategories); //.Take(8); rptCategoriesColumn1.DataBind(); //rptCategoriesColumn2.ItemCreated += new RepeaterItemEventHandler(rptCategories_ItemCreated); //rptCategoriesColumn2.DataSource = lstCategories.Skip(8).Take(8); //rptCategoriesColumn2.DataBind(); }
protected void Page_Load(object sender, EventArgs e) { string strCommentId = Request.QueryString["commentId"]; strCommentId = Server.UrlDecode(strCommentId); strCommentId = strCommentId.Replace('$', '+'); strCommentId = Tools.Decrypt(strCommentId, true); strCommentId = strCommentId.Split('.')[0]; int commentId = 0; int.TryParse(strCommentId, out commentId); string mapPathHtmls = System.Configuration.ConfigurationManager.AppSettings["PhysicalPath"] + @"\htmls"; string template = mapPathHtmls + "\\MailReply.htm"; MailData data = new MailData(); PostAroundServiceClient client = new PostAroundServiceClient(); Comment currComment = client.GetCommentByID(commentId); MyMessage mainMessage = client.GetMessageById(currComment.messageID, "", "", 0, 0, 0); User senderUser = client.GetUserByID(currComment.userID); client.Close(); postHeader = mainMessage.title; postId = currComment.messageID; date = DateTime.Now.ToString("d MMMM, yyyy", System.Globalization.CultureInfo.CreateSpecificCulture("en-US")); message = currComment.body; senderFName = senderUser.firstName; senderFullName = senderUser.firstName + " " + senderUser.lastName; senderImage = senderUser.avatarImageUrl; }
protected void btnCalc_Click(object sender, EventArgs e) { PostAroundServiceClient client = new PostAroundServiceClient(); int skipNum = 0; int takeNum = 20; bool isOk = true; int totalShares = 0; int currMsgId = 0; while (isOk) { totalShares = 0; PostAround.Entities.MyMessage[] messages = client.GetMessages("", "", 0, skipNum, takeNum, 0, null, 0, 0, -1, -1); if (messages.Count() > 0) { for (int i = 0; i < messages.Length; i++) { currMsgId = messages[i].msgId; totalShares = CalculateTotalSharesByMsgId(currMsgId); client.UpdateMessageSharesByID(currMsgId, totalShares); } skipNum += takeNum; } else { isOk = false; } } client.Close(); lblStatus.Text = "Done"; }
protected void Page_Load(object sender, EventArgs e) { try { List<int> ListIds = new List<int>(); int loginID; string code64Encoded = Request.QueryString["code"]; if (code64Encoded == null) throw new Exception("No Query String"); ListIds = GetUserLoginIDFromQueryString(code64Encoded); // make DB call to change the Login status PostAroundServiceClient client = new PostAroundServiceClient(); int result = client.ActivateUserLoginByLoginID(ListIds[1], ListIds[0]); client.Close(); ltrlResult.Text = "Activation Successfully Completed !"; string funcCall = "<script language='javascript'>setTimeout(function(){window.location = 'http://postaround.me';},3000);</script>"; ClientScript.RegisterStartupScript(this.GetType(), "redirect", funcCall); } catch (Exception ex) { Response.Write("Error: " + ex.Message); Response.End(); } }
protected void Page_Load(object sender, EventArgs e) { PostAroundServiceClient client = new PostAroundServiceClient(); Category[] arrCategroies = client.GetListCategories(); client.Close(); List<Category> lstCategories = arrCategroies.ToList(); rptCategoriesBar.ItemCreated += new RepeaterItemEventHandler(rptCategories_ItemCreated); rptCategoriesBar.DataSource = L10NCategories(lstCategories); rptCategoriesBar.DataBind(); }
protected void Page_Load(object sender, EventArgs e) { PostAroundServiceClient client = new PostAroundServiceClient(); int siteMapsCount = client.CreateXmlSiteMap(); DateTime lastpostDate = client.GetDateOfLastPost("", "", -1); client.Close(); List<int> lstIndexes = new List<int>(); for (int i = 0; i <= siteMapsCount; i++) { lstIndexes.Add(i); } CreateSiteMapIndex(lstIndexes, lastpostDate); }
protected void Page_Load(object sender, EventArgs e) { try { this.MorePosts1.numberOfItems = 10; // for Facebook Login //if (!string.IsNullOrWhiteSpace(Request.QueryString["code"])) //{ // string id = Request.QueryString["id"]; // string title = Request.QueryString["title"]; // Response.Redirect(siteUrl + "post/" + id + "/" + title); //} if (!IsPostBack) { string id = Request.QueryString["id"]; int msgId = 0; if (!Int32.TryParse(id, out msgId)) return; string passedSlug = Request.QueryString["title"]; //get the original slug from database / dymanic method PostAroundServiceClient client = new PostAroundServiceClient(); MyMessage message = client.GetMessageById(msgId, "", "", -1, 0, -1); if (message == null) return; string originalSlug = message.title.Slugify(); client.Close(); if (!originalSlug.Equals(HttpUtility.UrlDecode(passedSlug))) { var url = String.Format(siteUrl + "post/{0}/{1}", id, originalSlug); Response.RedirectPermanent(url, true); } } } catch (Exception ex) { //Response.Write(ex.Message); //Response.End(); // Response.Redirect(siteUrl); } }
protected void Page_Load(object sender, EventArgs e) { PostAroundServiceClient client = new PostAroundServiceClient(); client.CreateJsonPostsDigest(); client.Close(); WebClient webclient = new WebClient(); webclient.Encoding = System.Text.Encoding.UTF8; string jsonString = webclient.DownloadString(siteUrl + "Pages/json.txt"); System.Web.Script.Serialization.JavaScriptSerializer oSerializer = new System.Web.Script.Serialization.JavaScriptSerializer(); List<BriefMessage> bMessages = oSerializer.Deserialize<List<BriefMessage>>(jsonString); rptLinks.DataSource = bMessages; rptLinks.DataBind(); }
protected void Page_Load(object sender, EventArgs e) { int userId = Tools.GetUserIdFromCookie(Context); if (userId > 0) { PostAroundServiceClient client = new PostAroundServiceClient(); Category[] arrCategroies = client.GetListCategories(); client.Close(); List<Category> lstCategories = arrCategroies.ToList(); rptCategoriesColumn1.ItemCreated += new RepeaterItemEventHandler(rptCategories_ItemCreated); rptCategoriesColumn1.DataSource = L10NCategories(lstCategories); rptCategoriesColumn1.DataBind(); } }
protected void btnSendResetPassword_Click(object sender, EventArgs e) { string email = txtSendResetEmail.Text; // get id + fname by email PostAroundServiceClient client = new PostAroundServiceClient(); User user = client.GetUserByEmail(email); client.Close(); if (user != null && user.userID > 0) { SendForgotPasswordMail(email, user.userID, user.firstName); panelEmailSent.Visible = true; panelSendMail.Visible = false; } else { errorEmailNoExist.InnerHtml = "A user with this email does not exist"; txtSendResetEmail.Style.Add("border-color", "#FF0000"); errorEmailNoExist.Style.Add("display", "block"); } }
protected void Page_Load(object sender, EventArgs e) { try { //string test = "userid=14&permissionId=1"; //test = Tools.Encrypt(test, true); //test = Tools.EncodeTo64(test); string code64Encoded = Request.QueryString["code"]; up = GetUserPermissionDataFromQueryString(code64Encoded); if (up != null) { // call the method to show user First Name PostAroundServiceClient client = new PostAroundServiceClient(); User user = client.GetUserByID(up.userId); client.Close(); ltrlFname.Text = user.firstName; if (!IsPostBack) { if (UserIsGrantPermission((int)Enums.Permissions.EmailPermission)) { bool isSucceed = Unsubscribe(); if (isSucceed) ltrlStatus.Text = "You have been unsubscribed!"; else ltrlStatus.Text = "Unsubscribtion Failed. Please Try Again."; } else ltrlStatus.Text = "User already unsubscribed."; } } } catch (Exception ex) { PrintStatus(ex.Message); } }
private PostAround.Entities.MyMessage GetMessageByID(int msgId) { string currLon = "", currLat = ""; int regionId = 0; int timeZone = 0; int userId = 0; userId = Tools.GetUserIdFromCookie(Context); PostAroundServiceClient client = new PostAroundServiceClient(); PostAround.Entities.MyMessage message = client.GetMessageById(msgId, currLon, currLat, regionId, timeZone, userId); client.Close(); return message; }
private int SaveUserInDB(User user) { int userId; user.birthday = user.regDate; PostAroundServiceClient client = new PostAroundServiceClient(); userId = client.InsertUpdateUser(user); client.Close(); return userId; }
private bool UserIsGrantPermission(int permissionId) { PostAroundServiceClient client = new PostAroundServiceClient(); bool response = client.GetUserPermission(up.userId, permissionId); client.Close(); return response; }
private bool Unsubscribe() { up.status = false; PostAroundServiceClient client = new PostAroundServiceClient(); int response = client.SetUserPermission(up); client.Close(); if (response == 0) return true; return false; }
private void SetUserEmailPemission(int userId) { UserPermission up = new UserPermission(); up.date = DateTime.Now.Date; up.permissionId = (int)Enums.Permissions.EmailPermission; up.status = true; up.userId = userId; PostAroundServiceClient client = new PostAroundServiceClient(); int response = client.SetUserPermission(up); client.Close(); }
private List<MyMessage> GetMessages(string lat, string lon, int takeNum, List<int> lstCatID) { PostAroundServiceClient client = new PostAroundServiceClient(); List<MyMessage> messages = client.GetMessages(lat, lon, 0, 0, takeNum, 0, lstCatID.ToArray(), 0, 0, 4000, 0).ToList(); client.Close(); return messages; }
private MyMessage GetMessageByID(int msgId) { string currLon = "", currLat = ""; int regionId = 0; int timeZone = 0; int userId = 0; userId = 0; PostAroundServiceClient client = new PostAroundServiceClient(); PostAround.Entities.MyMessage message = client.GetMessageById(msgId, currLon, currLat, regionId, timeZone, userId); if (message != null) { message.comments = client.GetCommentsByMessageID(message.msgId, userId, timeZone, 0); } client.Close(); return message; }
protected void Page_Load(object sender, EventArgs e) { // Login Scenario FaceBookAppKey = ConfigurationManager.AppSettings["facebookAppKey"]; int userId = Tools.GetUserIdFromCookie(Context); User user = null; if (userId > 0) { // user already logged in, get his details by cookie // Get User By Id PostAroundServiceClient client = new PostAroundServiceClient(); user = client.GetCurrentUser(userId); client.Close(); } else { // user isnt logged in string facebookReturnedServerCode = Request.QueryString["code"]; string accessToken = null; // in case of returned from facebook login // continue the flow to get the user details if (!string.IsNullOrWhiteSpace(facebookReturnedServerCode)) { System.Text.StringBuilder sb = new System.Text.StringBuilder(); string url = Request.RawUrl; int index = url.IndexOf("code="); if (index > 0) { url = url.Substring(0, index - 1); } /* string page = Path.GetFileNameWithoutExtension(HttpContext.Current.Request.Url.AbsoluteUri).ToLower(); if (page == "post") { sb.Append(siteUrl); string id = Request.QueryString["id"]; string title = Request.QueryString["title"]; if (!string.IsNullOrWhiteSpace(id) && !string.IsNullOrWhiteSpace(id)) { sb.Append("post/" + id); sb.Append("/" + title); } } else { Uri uri = new Uri(Request.Url.AbsoluteUri); string address = Tools.GetQueryStringByKey(uri, "address"); string url = siteUrl; if (address != null && address != "") { url = Tools.GetFriendlyUrl(siteUrl, address, true); } sb.Append(url); } */ //string page = Path.GetFileNameWithoutExtension(Request.Url.AbsolutePath); //page = page.ToLower(); //string encodedState = Request.QueryString["state"]; //if (!String.IsNullOrWhiteSpace(encodedState)) //{ // string decodedState = Tools.DecodeFrom64(encodedState); // FacebookLoginState fls = ParseStateJSON(decodedState); // url = url + page + "/" + fls.id; //} //else //{ // if (page != "default") // { // url += page + ".aspx"; // } //} SaveEncryptedCodeInCookie(facebookReturnedServerCode); Response.Redirect(domain + url); return; } else { HttpCookie cookie = Request.Cookies["FacebookServerCode"]; if (cookie != null) { if (!string.IsNullOrEmpty(cookie["code"])) { string encCode = cookie["code"]; encCode = encCode.Replace('$', '+'); facebookReturnedServerCode = Tools.Decrypt(encCode, true); } if (!string.IsNullOrWhiteSpace(facebookReturnedServerCode)) { accessToken = GetFacebookAccessToken(facebookReturnedServerCode); // pass the access token to function to get the UserDetails if (!string.IsNullOrWhiteSpace(accessToken)) { user = GetUserDetailsFromToken(accessToken); //save the user in db userId = SaveUserInDB(user); //no need this. i added in sql //SetUserEmailPemission(userId); } } CleanCookie("FacebookServerCode"); } } } if (!IsPostBack) { if (user != null && userId > 0) { //save cookie with userId string encUserId = Tools.SetUserIdInCookie(userId, Context); //Show UserName and Picture on page DisplayDetailsOnPage(user); //Show User Div ShowUserDiv(); //Return LoggedInResponse SetClientResponse(user, encUserId); //Set AccessToken } } }
private PostAround.Entities.MyMessage GetMessageByID(int msgId) { string currLon = "", currLat = ""; int regionId = 0; int timeZone = 0; int userId = 0; userId = Tools.GetUserIdFromCookie(Context); //if (userId <= 0) //{ // AddCommentPanel.Visible = false; //} PostAroundServiceClient client = new PostAroundServiceClient(); PostAround.Entities.MyMessage message = client.GetMessageById(msgId, currLon, currLat, regionId, timeZone, userId); if (message != null) { message.comments = client.GetCommentsByMessageID(message.msgId, userId, timeZone, 0); } client.Close(); return message; }
private int UpdatePassword(int userID, string email, string password) { int result = 0; LoginDetail ld = new LoginDetail(); ld.UserID = userID; ld.email = email; ld.password = Tools.HashIt(password); PostAroundServiceClient client = new PostAroundServiceClient(); result = client.InsertLoginDetails(ld); client.Close(); return result; }