protected void Page_Load(object sender, EventArgs e) { try { ans1 = Session["answer"]!= null ? Session["answer"].ToString() : ""; if (DotNetNuke.Entities.Users.UserController.GetCurrentUserInfo().UserID != -1) { //Response.Write(DotNetNuke.Entities.Users.UserController.GetCurrentUserInfo().DisplayName); txtName.Text = DotNetNuke.Entities.Users.UserController.GetCurrentUserInfo().DisplayName; } else { txtName.Text = "Anonymous"; } BindComment(); } catch (Exception ex) { UserInfo info = UserController.GetCurrentUserInfo(); ErrorLog objLog = new ErrorLog(); objLog.ErrorDescription = ex.ToString(); objLog.ErrorDate = DateTime.Now; objLog.ErrorFunctionName = System.Reflection.MethodBase.GetCurrentMethod().Name; objLog.ErrorControlName = (GetType().ToString().Replace("ASP.", "").Replace("_ascx", ".ascx").Remove(0, GetType().ToString().Replace("ASP.", "").Replace("_ascx", ".ascx").LastIndexOf("_") + 1)); objLog.ErrorLoggedInUser = info.Username; objLog.AddErrorToLog(objLog); } }
protected void rptDataBound(object sender, DataListItemEventArgs e) { try { string str = Server.HtmlDecode(ds.Tables[0].Rows[e.Item.ItemIndex]["Article"].ToString()); Match m = Regex.Match(str, @"<img(.|\n)+?>"); Image ArticleImage = (Image)e.Item.FindControl("img"); if (!string.IsNullOrEmpty(ds.Tables[0].Rows[e.Item.ItemIndex]["Thumbnail"].ToString())) { System.Drawing.Bitmap bmp = customTransactions.RezizeImage(Server.MapPath(ds.Tables[0].Rows[e.Item.ItemIndex]["Thumbnail"].ToString()), 110, 80, ArticleImage); ArticleImage.ImageUrl = ds.Tables[0].Rows[e.Item.ItemIndex]["Thumbnail"].ToString(); } else if (m.Success) { Match inner = Regex.Match(m.Value, "src=[\'|\"](.+?)[\'|\"]"); if (inner.Success) { string imageurl = inner.Value.Substring(5).Substring(0, inner.Value.Substring(5).LastIndexOf("\"")); System.Drawing.Bitmap bmp = customTransactions.RezizeImage(Server.MapPath(imageurl), 110, 80, ArticleImage); ArticleImage.ImageUrl = inner.Value.Substring(5).Substring(0, inner.Value.Substring(5).LastIndexOf("\"")); } } } catch (Exception ex) { UserInfo info = UserController.GetCurrentUserInfo(); ErrorLog objLog = new ErrorLog(); objLog.ErrorDescription = ex.ToString(); objLog.ErrorDate = DateTime.Now; objLog.ErrorFunctionName = "Page Load"; objLog.ErrorControlName = (GetType().ToString().Replace("ASP.", "").Replace("_ascx", ".ascx").Remove(0, GetType().ToString().Replace("ASP.", "").Replace("_ascx", ".ascx").LastIndexOf("_") + 1)); objLog.ErrorLoggedInUser = info.Username; objLog.AddErrorToLog(objLog); } }
protected void Page_Load(object sender, EventArgs e) { try { SqlDataAdapter da = new SqlDataAdapter("sp_section",new SqlConnection(customTransactions.connectionString)); da.SelectCommand.CommandType = CommandType.StoredProcedure; da.SelectCommand.Parameters.AddWithValue("@Categoryid", Convert.ToInt32(System.Configuration.ConfigurationManager.AppSettings["News"])); da.SelectCommand.Parameters.AddWithValue("@rows", Convert.ToInt32(System.Configuration.ConfigurationManager.AppSettings["newsrows"])); DataTable dt = new DataTable(); da.Fill(dt); rptnews.DataSource = dt; rptnews.DataBind(); } catch (Exception ex) { UserInfo info = UserController.GetCurrentUserInfo(); ErrorLog objLog = new ErrorLog(); objLog.ErrorDescription = ex.ToString(); objLog.ErrorDate = DateTime.Now; objLog.ErrorFunctionName = "Page Load"; objLog.ErrorControlName = (GetType().ToString().Replace("ASP.", "").Replace("_ascx", ".ascx").Remove(0, GetType().ToString().Replace("ASP.", "").Replace("_ascx", ".ascx").LastIndexOf("_") + 1)); objLog.ErrorLoggedInUser = info.Username; objLog.AddErrorToLog(objLog); } }
protected void Register(object sender, EventArgs e) { try { if (lnkRegister.Text == "Profile") { Response.Redirect("/profile", false); } else { Response.Redirect("/register", false); } } catch (Exception ex) { UserInfo info = UserController.GetCurrentUserInfo(); ErrorLog objLog = new ErrorLog(); objLog.ErrorDescription = ex.ToString(); objLog.ErrorDate = DateTime.Now; objLog.ErrorFunctionName = System.Reflection.MethodBase.GetCurrentMethod().Name; objLog.ErrorControlName = (GetType().ToString().Replace("ASP.", "").Replace("_ascx", ".ascx").Remove(0, GetType().ToString().Replace("ASP.", "").Replace("_ascx", ".ascx").LastIndexOf("_") + 1)); objLog.ErrorLoggedInUser = info.Username; objLog.AddErrorToLog(objLog); } }
protected void Page_Load(object sender, EventArgs e) { try { SqlDataAdapter da = new SqlDataAdapter("sp_HomeTopRightArticle", new SqlConnection(customTransactions.connectionString)); da.SelectCommand.CommandType = CommandType.StoredProcedure; da.SelectCommand.Parameters.AddWithValue("@Categoryid", Convert.ToInt32(System.Configuration.ConfigurationManager.AppSettings["ProductReview"])); DataTable dt = new DataTable(); da.Fill(dt); if (dt.Rows.Count > 0) { title = dt.Rows[0]["Title"].ToString(); thumbnail = "../ImageHandler.ashx?imgpath=" + dt.Rows[0]["Thumbnail"].ToString() + "&w=270&h=130"; url = customTransactions.GenerateFriendlyURL("article", title, "0-" + dt.Rows[0]["Id"].ToString(), 0); teaser = dt.Rows[0]["Teaser"].ToString(); } } catch (Exception ex) { UserInfo info = UserController.GetCurrentUserInfo(); ErrorLog objLog = new ErrorLog(); objLog.ErrorDescription = ex.ToString(); objLog.ErrorDate = DateTime.Now; objLog.ErrorFunctionName = "Page Load"; objLog.ErrorControlName = (GetType().ToString().Replace("ASP.", "").Replace("_ascx", ".ascx").Remove(0, GetType().ToString().Replace("ASP.", "").Replace("_ascx", ".ascx").LastIndexOf("_") + 1)); objLog.ErrorLoggedInUser = info.Username; objLog.AddErrorToLog(objLog); } }
protected void Page_Load(object sender, EventArgs e) { try { SqlDataAdapter da = new SqlDataAdapter("sp_HomeDepartment_Articles", new SqlConnection(customTransactions.connectionString)); da.SelectCommand.CommandType = CommandType.StoredProcedure; da.SelectCommand.Parameters.AddWithValue("@Id1", Convert.ToInt32(System.Configuration.ConfigurationManager.AppSettings["AVSystems"])); da.SelectCommand.Parameters.AddWithValue("@Id2", Convert.ToInt32(System.Configuration.ConfigurationManager.AppSettings["LawEnforcement"])); da.SelectCommand.Parameters.AddWithValue("@Id3", Convert.ToInt32(System.Configuration.ConfigurationManager.AppSettings["Production"])); da.Fill(ds); dldepartments.DataSource = ds; dldepartments.DataBind(); } catch (Exception ex) { UserInfo info = UserController.GetCurrentUserInfo(); ErrorLog objLog = new ErrorLog(); objLog.ErrorDescription = ex.ToString(); objLog.ErrorDate = DateTime.Now; objLog.ErrorFunctionName = System.Reflection.MethodBase.GetCurrentMethod().Name; objLog.ErrorControlName = (GetType().ToString().Replace("ASP.", "").Replace("_ascx", ".ascx").Remove(0, GetType().ToString().Replace("ASP.", "").Replace("_ascx", ".ascx").LastIndexOf("_") + 1)); objLog.ErrorLoggedInUser = info.Username; objLog.AddErrorToLog(objLog); } }
protected void Page_Load(object sender, EventArgs e) { try { if (!IsPostBack) { string ConnectionString = System.Configuration.ConfigurationManager.ConnectionStrings["SiteSqlServer"].ToString(); SqlDataAdapter da = new SqlDataAdapter("sp_HomeCoverStory", new SqlConnection(customTransactions.connectionString)); da.SelectCommand.CommandType = CommandType.StoredProcedure; da.SelectCommand.Parameters.AddWithValue("@PortalId", customTransactions.PortalId); da.Fill(ds); JSON_DataTable_DataHolder.Value = customTransactions.DataTableToJSON(customTransactions.TrimDataTableJSON(ds), "HomeCoverStory"); } } catch (Exception ex) { UserInfo info = UserController.GetCurrentUserInfo(); ErrorLog objLog = new ErrorLog(); objLog.ErrorDescription = ex.ToString(); objLog.ErrorDate = DateTime.Now; objLog.ErrorFunctionName = System.Reflection.MethodBase.GetCurrentMethod().Name; objLog.ErrorControlName = (GetType().ToString().Replace("ASP.", "").Replace("_ascx", ".ascx").Remove(0, GetType().ToString().Replace("ASP.", "").Replace("_ascx", ".ascx").LastIndexOf("_") + 1)); objLog.ErrorLoggedInUser = info.Username; objLog.AddErrorToLog(objLog); } }
public void FillArticle(int SiteId, string keyword, int MatchType) { try { //articleCount = "Your Query <b><i>" + keyword + "</i></b> returned " + customTransactions.GetSearchResults(1, keyword, SortMethod,MatchType).Rows.Count.ToString() + " record(s) "; dtSearchResults = null; dtSearchResults = customTransactions.GetSearchResults(1, keyword, SortMethod, MatchType); articleCount = (MatchType == 1) ? "Your Query <b><i>“" + keyword + "”</i></b> returned " + dtSearchResults.Rows.Count.ToString() + " record(s) " : "Your Query <b><i>" + keyword + "</i></b> returned " + dtSearchResults.Rows.Count.ToString() + " record(s)"; if (customTransactions.GetSearchResults(1, keyword, SortMethod,MatchType).Rows.Count != 0) { gridArticle.DataSource = customTransactions.GetSearchResults(1, keyword, SortMethod, MatchType); gridArticle.DataBind(); } else { // dvArticleCount.InnerHtml = "Your Query <b><i>" + keyword + "</i></b> returned no record(s) for ARTICLE"; gridArticle.DataSource = null; gridArticle.DataBind(); dvArticleCount.InnerText = "No Records Found"; } } catch (Exception ex) { UserInfo info = UserController.GetCurrentUserInfo(); ErrorLog objLog = new ErrorLog(); objLog.ErrorDescription = ex.ToString(); objLog.ErrorDate = DateTime.Now; objLog.ErrorFunctionName = System.Reflection.MethodBase.GetCurrentMethod().Name; objLog.ErrorControlName = (GetType().ToString().Replace("ASP.", "").Replace("_ascx", ".ascx").Remove(0, GetType().ToString().Replace("ASP.", "").Replace("_ascx", ".ascx").LastIndexOf("_") + 1)); objLog.ErrorLoggedInUser = info.Username; objLog.AddErrorToLog(objLog); } }
protected void register_click(object sender, EventArgs e) { try { UserInfo objUser = new UserInfo(); objUser.PortalID = customTransactions.GetPortalID(Request.ServerVariables["SERVER_NAME"].ToString()); objUser.IsSuperUser = false; objUser.FirstName = txtFirstName.Text; objUser.LastName = txtLastName.Text; objUser.DisplayName = txtFirstName.Text + " " + txtLastName.Text; objUser.Email = txtEmailAddress.Text; objUser.Username = txtUserName.Text; UserMembership objMembership = new UserMembership(objUser); objMembership.Approved = true; objMembership.CreatedDate = DateTime.Now; objMembership.Email = txtEmailAddress.Text; objMembership.Username = txtUserName.Text; objMembership.Password = txtPassword.Text; //DotNetNuke.Security.Roles.RoleController role = new DotNetNuke.Security.Roles.RoleController(); //role.AddUserRole(PortalAliasController.GetPortalAliasInfo(Request.ServerVariables["SERVER_NAMES"]).PortalID, objUser.UserID, 1, DateTime.Now); objUser.Membership = objMembership; UserCreateStatus result = UserController.CreateUser(ref objUser); //Check status if (result == UserCreateStatus.Success) { lblMessage.Text = "User registered successfully"; } UserController.UserLogin(0, objUser, Request.ServerVariables["SERVER_NAME"], this.Request.UserHostAddress, true); Response.Redirect("/index.aspx", false); } catch (Exception ex) { UserInfo info = UserController.GetCurrentUserInfo(); ErrorLog objLog = new ErrorLog(); objLog.ErrorDescription = ex.ToString(); objLog.ErrorDate = DateTime.Now; objLog.ErrorFunctionName = System.Reflection.MethodBase.GetCurrentMethod().Name; objLog.ErrorControlName = (GetType().ToString().Replace("ASP.", "").Replace("_ascx", ".ascx").Remove(0, GetType().ToString().Replace("ASP.", "").Replace("_ascx", ".ascx").LastIndexOf("_") + 1)); objLog.ErrorLoggedInUser = info.Username; objLog.AddErrorToLog(objLog); } }
private void FillGrid() { int gIndex = 0; string strPrev, strNext; try { if (Request.QueryString.Count > 0) { gIndex = Convert.ToInt32(Request.QueryString["paging"].ToString()); } string ConnectionString = System.Configuration.ConfigurationManager.ConnectionStrings["SiteSqlServer"].ToString(); SqlConnection con = new SqlConnection(ConnectionString); SqlCommand cmd = new SqlCommand("sp_FetchTitles", con); cmd.Parameters.AddWithValue("@PortalId", customTransactions.PortalId); SqlDataAdapter da = new SqlDataAdapter(cmd); cmd.CommandType = CommandType.StoredProcedure; DataSet ds = new DataSet(); da.Fill(ds); gridArticle.DataSource = ds.Tables[0]; gridArticle.PageIndex = gIndex; gridArticle.DataBind(); if (gIndex == 0) strPrev = ""; else strPrev = "<a href='/GoogleJump.aspx?paging=" + (gIndex - 1) + "'>Prev</a>"; if (gIndex >= gridArticle.PageCount - 1) { strNext = ""; strPrev = "<a href='/GoogleJump.aspx?paging=" + (gridArticle.PageCount - 2) + "'>Prev</a>"; } else { strNext = "<a href='/GoogleJump.aspx?paging=" + (gIndex + 1) + "'>Next</a>"; if (strPrev != "") strNext = " " + strNext; } lblPaging.Text = "<br /><br />" + strPrev + strNext; } catch (Exception ex) { UserInfo info = UserController.GetCurrentUserInfo(); ErrorLog objLog = new ErrorLog(); objLog.ErrorDescription = ex.ToString(); objLog.ErrorDate = DateTime.Now; objLog.ErrorFunctionName = System.Reflection.MethodBase.GetCurrentMethod().Name; objLog.ErrorControlName = (GetType().ToString().Replace("ASP.", "").Replace("_ascx", ".ascx").Remove(0, GetType().ToString().Replace("ASP.", "").Replace("_ascx", ".ascx").LastIndexOf("_") + 1)); objLog.ErrorLoggedInUser = info.Username; objLog.AddErrorToLog(objLog); } }
protected void Page_Load(object sender, EventArgs e) { try { if (HttpContext.Current.User.Identity.Name != "") { //Response.Write(customTransactions.GetUserRoles(HttpContext.Current.User.Identity.Name, 0)); if (customTransactions.GetUserRoles(HttpContext.Current.User.Identity.Name, 0).ToLower().Contains("blogger")) { //For Bloggers Response.Redirect("/blogs", false); } else if (customTransactions.GetUserRoles(HttpContext.Current.User.Identity.Name, 0).ToLower().Contains("editor")) { //For rest of the users Response.Redirect("/articleadmin", false); } else { //For Editors and Host Response.Redirect("/index", false); } } } catch (Exception ex) { UserInfo info = UserController.GetCurrentUserInfo(); ErrorLog objLog = new ErrorLog(); objLog.ErrorDescription = ex.ToString(); objLog.ErrorDate = DateTime.Now; objLog.ErrorFunctionName = System.Reflection.MethodBase.GetCurrentMethod().Name; objLog.ErrorControlName = (GetType().ToString().Replace("ASP.", "").Replace("_ascx", ".ascx").Remove(0, GetType().ToString().Replace("ASP.", "").Replace("_ascx", ".ascx").LastIndexOf("_") + 1)); objLog.ErrorLoggedInUser = info.Username; objLog.AddErrorToLog(objLog); } }
protected void Page_Load(object sender, EventArgs e) { try { UserInfo user = UserController.GetCurrentUserInfo(); if (user.UserID == -1) { lnkSignIn.Text = "Sign-In"; lnkRegister.Text = "Register"; } else { lnkSignIn.Text = "Logout"; lnkRegister.Text = "Profile"; } if (isHostOrEditor == 1) lnkArticle.Style.Add("display", "inline");// = true; else lnkArticle.Style.Add("display", "none"); if (Request.QueryString["categoryid"] != null) _Page = Convert.ToInt32(Request.QueryString["categoryid"]); else if (Request.QueryString["articleid"] != null) _Page = Convert.ToInt32(customTransactions.Get_CategoryByArticleId(Request.QueryString["articleid"].ToString())); //Response.Write(_Page); } catch (Exception ex) { UserInfo info = UserController.GetCurrentUserInfo(); ErrorLog objLog = new ErrorLog(); objLog.ErrorDescription = ex.ToString(); objLog.ErrorDate = DateTime.Now; objLog.ErrorFunctionName = System.Reflection.MethodBase.GetCurrentMethod().Name; objLog.ErrorControlName = (GetType().ToString().Replace("ASP.", "").Replace("_ascx", ".ascx").Remove(0, GetType().ToString().Replace("ASP.", "").Replace("_ascx", ".ascx").LastIndexOf("_") + 1)); objLog.ErrorLoggedInUser = info.Username; objLog.AddErrorToLog(objLog); } }
protected void Page_Load(object sender, EventArgs e) { try { SqlConnection conn = new SqlConnection(connectionString); SqlDataAdapter adap = new SqlDataAdapter("Select * from Users where IsFirstLogin=1 and username= '******'", conn); dt.Clear(); adap.Fill(dt); if (dt.Rows.Count > 0) { Page.ClientScript.RegisterStartupScript(this.GetType(), "nKey", "DisplayMsg()", true); } Session["FirstGrid"] = null; Session["SecondGrids"] = null; if (!IsPostBack) { txtLogName.Text = user.Username; txtFirstName.Text = user.Profile.FirstName; txtLastName.Text = user.Profile.LastName; txtEmailAdd.Text = user.Email; } } catch (Exception ex) { UserInfo info = UserController.GetCurrentUserInfo(); ErrorLog objLog = new ErrorLog(); objLog.ErrorDescription = ex.ToString(); objLog.ErrorDate = DateTime.Now; objLog.ErrorFunctionName = System.Reflection.MethodBase.GetCurrentMethod().Name; objLog.ErrorControlName = (GetType().ToString().Replace("ASP.", "").Replace("_ascx", ".ascx").Remove(0, GetType().ToString().Replace("ASP.", "").Replace("_ascx", ".ascx").LastIndexOf("_") + 1)); objLog.ErrorLoggedInUser = info.Username; objLog.AddErrorToLog(objLog); } }
protected void Page_Load(object sender, EventArgs e) { try { if (Request.QueryString["categoryid"] != null) { categoryId = Convert.ToInt32(Request.QueryString["categoryid"]); dlmultiSection.DataSource = customTransactions.Get_Child_Category(categoryId.ToString()); dlmultiSection.DataBind(); FillInnerGrid(); if (!IsPostBack) { CDefault tp = (CDefault)this.Page; tp.Title = customTransactions.GetCategoryName(categoryId); tp.KeyWords = "GovernmentVideo " + customTransactions.GetCategoryDetails(categoryId) + ", techlearning " + customTransactions.GetCategoryDetails(categoryId); } } } catch (Exception ex) { Response.Write(ex.ToString()); UserInfo info = UserController.GetCurrentUserInfo(); ErrorLog objLog = new ErrorLog(); objLog.ErrorDescription = ex.ToString(); objLog.ErrorDate = DateTime.Now; objLog.ErrorFunctionName = "Page Load"; objLog.ErrorControlName = (GetType().ToString().Replace("ASP.", "").Replace("_ascx", ".ascx").Remove(0, GetType().ToString().Replace("ASP.", "").Replace("_ascx", ".ascx").LastIndexOf("_") + 1)); objLog.ErrorLoggedInUser = info.Username; objLog.AddErrorToLog(objLog); } }
protected void Page_Load(object sender, EventArgs e) { title = ""; try { span1.Visible = isHostOrEditor; ArticleInfo info; if ((Request.QueryString["id"] != null) || (Request.QueryString["articleid"] != null)) { if (Request.QueryString["id"] != null) { SqlDataAdapter adap = new SqlDataAdapter("sp_GetArticleIdfromEktron", new SqlConnection(ConfigurationManager.AppSettings["SiteSqlServer"])); adap.SelectCommand.CommandType = CommandType.StoredProcedure; adap.SelectCommand.Parameters.AddWithValue("ektid", Request.QueryString["id"] ); DataTable dt=new DataTable(); dt.Clear(); adap.Fill(dt); articleid=Convert.ToInt32(dt.Rows[0][0].ToString()); } else if (Request.QueryString["articleid"] != null) { articleid = Convert.ToInt32(Request.QueryString["articleid"]); } info = ArticleController.Get(articleid); ArticleController.UpdateViews(articleid); Session["ArticleId"] = articleid; //art = customTransactions.Get_Article_Details("Article", Convert.ToInt32(articleid)); art = info.Article; publishdate = info.PublishDate.ToString("MMM dd, yyyy"); title = info.Title; author = info.Author; if (author.Trim() != "") author = "by " + author; if (art.Length != null && art.Length > 0 ) { BusinessLogic paging = new BusinessLogic(Convert.ToInt32(articleid)); //Response.Redirect("http://www.google.co.in",false); JavaScriptSerializer serialize = new JavaScriptSerializer(); articles = (paging.IsPagingEnable) ? serialize.Serialize(SplitText(Server.HtmlDecode(art), 370)) : serialize.Serialize(Server.HtmlDecode(art)); CDefault tp = (CDefault)this.Page; tp.Title = "GovernmentVideo: " + info.Title; if (info.Keywords.ToString() == "") { tp.KeyWords="GovernmentVideo: " + info.Title + " governmentvideo: " + info.Title.ToLower(); } else { tp.KeyWords = info.Keywords.ToString(); } } else { string path="http://www.governmentvideo.com/index"; HttpContext.Current.Response.Status = "301 Moved Permanently"; HttpContext.Current.Response.AddHeader("Location", path); HttpContext.Current.Response.Redirect(path, false); } } } catch (Exception ex) { UserInfo info = UserController.GetCurrentUserInfo(); ErrorLog objLog = new ErrorLog(); objLog.ErrorDescription = ex.ToString(); objLog.ErrorDate = DateTime.Now; objLog.ErrorFunctionName = System.Reflection.MethodBase.GetCurrentMethod().Name; objLog.ErrorControlName = (GetType().ToString().Replace("ASP.", "").Replace("_ascx", ".ascx").Remove(0, GetType().ToString().Replace("ASP.", "").Replace("_ascx", ".ascx").LastIndexOf("_") + 1)); objLog.ErrorLoggedInUser = info.Username; objLog.AddErrorToLog(objLog); } if (title == "") { Response.Redirect("http://www.governmentvideo.com/index"); } }
public ArrayList SplitText(string content, int limit) { ArrayList ar = new ArrayList(); try { string[] split2Word = content.Split(' '); int Mod = (split2Word.Length % limit) == 0 ? (split2Word.Length / limit) : (split2Word.Length / limit) + 1; string[] words2Store = new string[Mod]; for (int i = 0; i < Mod; i++) { for (int j = i * limit; j < limit * (i + 1); j++) { if (j < split2Word.Length) { words2Store[i] += split2Word[j].ToString() + " "; } } ar.Add(words2Store[i]); } } catch (Exception ex) { UserInfo info = UserController.GetCurrentUserInfo(); ErrorLog objLog = new ErrorLog(); objLog.ErrorDescription = ex.ToString(); objLog.ErrorDate = DateTime.Now; objLog.ErrorFunctionName = System.Reflection.MethodBase.GetCurrentMethod().Name; objLog.ErrorControlName = (GetType().ToString().Replace("ASP.", "").Replace("_ascx", ".ascx").Remove(0, GetType().ToString().Replace("ASP.", "").Replace("_ascx", ".ascx").LastIndexOf("_") + 1)); objLog.ErrorLoggedInUser = info.Username; objLog.AddErrorToLog(objLog); } return ar; }
protected void btnAddComment_Click(object sender, EventArgs e) { try { if (Page.IsValid && comment.Value == ans1 && DotNetNuke.Entities.Users.UserController.GetCurrentUserInfo().UserID != -1) { CommentInfo ci = new CommentInfo(); ci.ArticleId = ArticleId; if (DotNetNuke.Entities.Users.UserController.GetCurrentUserInfo().UserID != -1) { ci.Authed = true; } else { ci.Authed = false; } ci.Comment = txtComment.Text; ci.CreatedUser = txtName.Text.Trim(); ci.Mail = null; ci.Url = null; ci.CreatedDate = DateTime.Now; ci.IsPrivate = false; ci.PortalId = DotNetNuke.Entities.Portals.PortalController.GetCurrentPortalSettings().PortalId; ci.UserId = DotNetNuke.Entities.Users.UserController.GetCurrentUserInfo().UserID; CommentController.Add(ci); BindComment(); txtComment.Text = ""; comment.Value = ""; } if (DotNetNuke.Entities.Users.UserController.GetCurrentUserInfo().UserID == -1) { Page.ClientScript.RegisterStartupScript(this.GetType(), "mKey", "alert('Your comment is sent for approval');", true); } } catch (Exception ex) { UserInfo info = UserController.GetCurrentUserInfo(); ErrorLog objLog = new ErrorLog(); objLog.ErrorDescription = ex.ToString(); objLog.ErrorDate = DateTime.Now; objLog.ErrorFunctionName = System.Reflection.MethodBase.GetCurrentMethod().Name; objLog.ErrorControlName = (GetType().ToString().Replace("ASP.", "").Replace("_ascx", ".ascx").Remove(0, GetType().ToString().Replace("ASP.", "").Replace("_ascx", ".ascx").LastIndexOf("_") + 1)); objLog.ErrorLoggedInUser = info.Username; objLog.AddErrorToLog(objLog); } }
protected void SignIn(object sender, EventArgs e) { try { if (lnkSignIn.Text == "Sign-In") { Response.Redirect("/login", false); } else { secure.SignOut(); Session.Abandon(); Response.Redirect("/index", false); } } catch (Exception ex) { UserInfo info = UserController.GetCurrentUserInfo(); ErrorLog objLog = new ErrorLog(); objLog.ErrorDescription = ex.ToString(); objLog.ErrorDate = DateTime.Now; objLog.ErrorFunctionName = System.Reflection.MethodBase.GetCurrentMethod().Name; objLog.ErrorControlName = (GetType().ToString().Replace("ASP.", "").Replace("_ascx", ".ascx").Remove(0, GetType().ToString().Replace("ASP.", "").Replace("_ascx", ".ascx").LastIndexOf("_") + 1)); objLog.ErrorLoggedInUser = info.Username; objLog.AddErrorToLog(objLog); } }
protected void Page_Load(object sender, EventArgs e) { try { if (Request.QueryString["searchtext"] != null) { FillArticle(1, Request.QueryString["searchtext"].ToString().Replace("'","'''"), Convert.ToInt32(Request.QueryString["exactmatch"].ToString())); } } catch (Exception ex) { UserInfo info = UserController.GetCurrentUserInfo(); ErrorLog objLog = new ErrorLog(); objLog.ErrorDescription = ex.ToString(); objLog.ErrorDate = DateTime.Now; objLog.ErrorFunctionName = System.Reflection.MethodBase.GetCurrentMethod().Name; objLog.ErrorControlName = (GetType().ToString().Replace("ASP.", "").Replace("_ascx", ".ascx").Remove(0, GetType().ToString().Replace("ASP.", "").Replace("_ascx", ".ascx").LastIndexOf("_") + 1)); objLog.ErrorLoggedInUser = info.Username; objLog.AddErrorToLog(objLog); } }
protected void LoginBtn_Click(object sender, EventArgs e) { try { SqlConnection conn = new SqlConnection(connectionString); SqlDataAdapter adap = new SqlDataAdapter("Select * from Users where IsFirstLogin=0 and username= '******'", conn); dt.Clear(); adap.Fill(dt); if (dt.Rows.Count > 0) { foreach (DataRow dr in dt.Rows) { UserInfo objUser = new UserInfo(); objUser.Username = Login1.UserName; UserMembership objMembership = new UserMembership(objUser); objMembership.Username = Login1.UserName; objMembership.Password = "******"; objUser.Membership = objMembership; UserCreateStatus result = UserController.CreateUser(ref objUser); UserController.UserLogin(0, objUser, Request.ServerVariables["SERVER_NAME"], this.Request.UserHostAddress, true); Response.Redirect("/profile", false); } } else { PortalSecurity secure = new PortalSecurity(); if (Login1.Password != "" && Login1.UserName != "") { UserInfo objUser = new UserInfo(); objUser.Username = Login1.UserName; UserLoginStatus loginStatus = new UserLoginStatus(); UserInfo objAuthendicationPortalUserInfo = UserController.ValidateUser(0, Login1.UserName, Login1.Password, "", "", GetIPAddress(), ref loginStatus); if (!(objAuthendicationPortalUserInfo == null)) { UserController.UserLogin(0, objUser, Request.ServerVariables["SERVER_NAME"], this.Request.UserHostAddress, true); Response.Redirect("/customredirects.aspx", false); } else { ErrorNotification = true; } } else { ErrorNotification = true; } } } catch (Exception ex) { UserInfo info = UserController.GetCurrentUserInfo(); ErrorLog objLog = new ErrorLog(); objLog.ErrorDescription = ex.ToString(); objLog.ErrorDate = DateTime.Now; objLog.ErrorFunctionName = System.Reflection.MethodBase.GetCurrentMethod().Name; objLog.ErrorControlName = (GetType().ToString().Replace("ASP.", "").Replace("_ascx", ".ascx").Remove(0, GetType().ToString().Replace("ASP.", "").Replace("_ascx", ".ascx").LastIndexOf("_") + 1)); objLog.ErrorLoggedInUser = info.Username; objLog.AddErrorToLog(objLog); } }
protected void Continue_Click(object sender, EventArgs e) { try { PortalSecurity secure = new PortalSecurity(); user.FirstName = txtFirstName.Text; user.LastName = txtLastName.Text; user.Email = txtEmailAdd.Text; if ((Page.IsValid && user.UserID > 0) && (TextBox1.Text != "" && TextBox2.Text != "")) { UserController.ChangePassword(user, UserController.GetPassword(ref user, user.Membership.PasswordAnswer), TextBox1.Text); } Page.ClientScript.RegisterStartupScript(this.GetType(), "nKey", "DisplayAlert()", true); SqlConnection conn = new SqlConnection(connectionString); SqlDataAdapter adap = new SqlDataAdapter("Update Users set IsFirstLogin=1 where username= '******'", conn); dt.Clear(); adap.Fill(dt); secure.SignOut(); Session.Abandon(); } catch (Exception ex) { UserInfo info = UserController.GetCurrentUserInfo(); ErrorLog objLog = new ErrorLog(); objLog.ErrorDescription = ex.ToString(); objLog.ErrorDate = DateTime.Now; objLog.ErrorFunctionName = System.Reflection.MethodBase.GetCurrentMethod().Name; objLog.ErrorControlName = (GetType().ToString().Replace("ASP.", "").Replace("_ascx", ".ascx").Remove(0, GetType().ToString().Replace("ASP.", "").Replace("_ascx", ".ascx").LastIndexOf("_") + 1)); objLog.ErrorLoggedInUser = info.Username; objLog.AddErrorToLog(objLog); } }
private string GetIPAddress() { string sIPAddress = Request.ServerVariables["HTTP_X_FORWARDED_FOR"]; try { if (sIPAddress == "") { sIPAddress = Request.ServerVariables["REMOTE_ADDR"]; } } catch (Exception ex) { UserInfo info = UserController.GetCurrentUserInfo(); ErrorLog objLog = new ErrorLog(); objLog.ErrorDescription = ex.ToString(); objLog.ErrorDate = DateTime.Now; objLog.ErrorFunctionName = System.Reflection.MethodBase.GetCurrentMethod().Name; objLog.ErrorControlName = (GetType().ToString().Replace("ASP.", "").Replace("_ascx", ".ascx").Remove(0, GetType().ToString().Replace("ASP.", "").Replace("_ascx", ".ascx").LastIndexOf("_") + 1)); objLog.ErrorLoggedInUser = info.Username; objLog.AddErrorToLog(objLog); } return sIPAddress; }
private void FillInnerGrid() { try { for (int i = 0; i < dlmultiSection.Rows.Count; i++) { GridViewRow rows = dlmultiSection.Rows[i]; GridView innerGrid = (GridView)rows.FindControl("dlMultiSectionInner"); HiddenField hiiden = (HiddenField)rows.FindControl("hidden"); HiddenField Key = (HiddenField)rows.FindControl("myKey"); HtmlAnchor catTitle = (HtmlAnchor)rows.FindControl("childCategory"); SqlCommand com = new SqlCommand("sp_Get_Article", customTransactions.connection); com.CommandType = System.Data.CommandType.StoredProcedure; com.Parameters.AddWithValue("@CategoryID", int.Parse(hiiden.Value)); SqlDataAdapter adap = new SqlDataAdapter(com); DataTable dt = new DataTable(); adap.Fill(dt); DataTable dts = dt.Clone(); for (int j = 0; j < dt.Rows.Count; j++) { if (j < 5) { dts.ImportRow(dt.Rows[j]); } } innerGrid.DataSource = dts; innerGrid.DataBind(); catTitle.InnerHtml = "<a href='" + customTransactions.GenerateFriendlyURL("section", Key.Value, hiiden.Value, 1) + "'>" + Key.Value + "</a>"; HtmlGenericControl linkViewAll = (HtmlGenericControl)rows.FindControl("viewAllLink"); linkViewAll.InnerHtml = "<a href='" + customTransactions.GenerateFriendlyURL("section", Key.Value, hiiden.Value.ToString(), 1) + "' style='font:normal 12px Arial;color: #0050A8;padding:10px 10px 10px 3px; top:10px;'>view all text items in this section... </a>"; for (int s = 0; s < innerGrid.Rows.Count; s++) { GridViewRow row = innerGrid.Rows[s]; HtmlAnchor genericTitle = (HtmlAnchor)row.FindControl("lblTitle"); genericTitle.InnerText = dts.Rows[row.RowIndex]["title"].ToString(); genericTitle.HRef = customTransactions.GenerateFriendlyURL("Article", dts.Rows[row.RowIndex]["title"].ToString(), hiiden.Value.ToString() + "-" + dts.Rows[row.RowIndex]["id"].ToString(), 1); HtmlGenericControl genericSummary = (HtmlGenericControl)row.FindControl("lblSummary"); const string REMOVE_HTML_TAGS = "<.*?>"; genericSummary.InnerText = Regex.Replace(customTransactions.TrimString(dts.Rows[row.RowIndex]["Summary"].ToString(), 230.ToString()), REMOVE_HTML_TAGS, ""); HtmlAnchor lnkMore = (HtmlAnchor)row.FindControl("moreLink"); lnkMore.HRef = customTransactions.GenerateFriendlyURL("Article", dts.Rows[row.RowIndex]["title"].ToString(), hiiden.Value.ToString() + "-" + dts.Rows[row.RowIndex]["id"].ToString(), 1); //Response.Write("<a href='" + customTransactions.GenerateFriendlyURL("section", Key.Value, hiiden.Value.ToString(), 1) + "' style='font:bold 13px Arial;color: #cc0000;text-transform:uppercase;padding:10px; top:10px;'>view all items in this section</a>"); // linkViewAll.InnerHtml = "<a href='" + customTransactions.GenerateFriendlyURL("section", Key.Value, hiiden.Value.ToString(), 1) + "' style='font:bold 13px Arial;color: #cc0000;text-transform:uppercase;padding:10px; top:10px;'>view all items in this section</a>"; } } } catch (Exception ex) { UserInfo info = UserController.GetCurrentUserInfo(); ErrorLog objLog = new ErrorLog(); objLog.ErrorDescription = ex.ToString(); objLog.ErrorDate = DateTime.Now; objLog.ErrorFunctionName = System.Reflection.MethodBase.GetCurrentMethod().Name; objLog.ErrorControlName = (GetType().ToString().Replace("ASP.", "").Replace("_ascx", ".ascx").Remove(0, GetType().ToString().Replace("ASP.", "").Replace("_ascx", ".ascx").LastIndexOf("_") + 1)); objLog.ErrorLoggedInUser = info.Username; objLog.AddErrorToLog(objLog); } }