protected void Page_Load(object sender, EventArgs e) { _Usr = Session["User"] as BSUser; if (!Page.IsPostBack) { if (_Usr.Role == BSUserRole.Guest) { Response.Redirect("Login"); } } }
protected void Page_Load(object sender, EventArgs e) { int PostId = Convert.ToInt32(RouteData.Values["ID"]); BSCacheRepository cacheRepo = new BSCacheRepository(); _Post = cacheRepo.Get<BSPost>().FirstOrDefault(x => x.ID == PostId); rptComment.DataSource = BSRepo.GetAll<BSComment>().Where(x => x.Post.ID == _Post.ID).ToList(); rptComment.DataBind(); usr = Session["User"] as BSUser; if (usr.Name != null) { CommenterName.Value = usr.Name; } }
protected void Page_Load(object sender, EventArgs e) { if (string.IsNullOrEmpty(Request.QueryString["ID"])) { AddEdit = 0; } else { AddEdit = Convert.ToInt32(Request.QueryString["ID"]); } Repo = new BSRepository(); usr = Session["User"] as BSUser; if (!Page.IsPostBack) { GetCommentPageDetail(); if (AddEdit != 0) { btnProcess.Text = "Düzenle"; BSComment _comm = Repo.GetAll<BSComment>().Where(x => x.ID == AddEdit).FirstOrDefault(); txtCName.Text = _comm.CommenterName; txtDate.Text = string.Format("{0:dd/MM/yyyy hh:mm}", _comm.Date); ddlPost.SelectedValue = _comm.Post.ID.ToString(); tbIcerik.InnerText = _comm.Content; } } }