예제 #1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            lblError.Visible = false;
            if (!IsPostBack)
            {
                var user = Page.User as CustomPrincipal;
                if (user != null)
                {
                    DateRestrictionUC1.LoadCustomDate(0, 5, "short", DateTime.Now);
                    var eId = Request.QueryString["eId"];

                    var manager = user.IsInRole("manager") || user.IsInRole("organizer");
                    if (eId != null)
                    {
                        EventId = Convert.ToInt32(eId);
                        LoadEvent(manager, user.Id);
                    }
                    publishRow.Visible = manager;
                    ////else
                    //{
                    //    if (eId != null)
                    //    {
                    //        EventId = Convert.ToInt32(eId);
                    //        LoadEvent(!manager, user.Id);
                    //    }
                    //    publishRow.Visible = false;
                    //}
                }
            }
        }
예제 #2
0
 private void LoadEvent(bool manager, int userId)
 {
     using (var helper = new DbHelper.Event())
     {
         var evnt = helper.GetEvent(EventId, manager, userId);
         if (evnt != null)
         {
             txtName.Text     = evnt.Title;
             txtLocation.Text = evnt.Location;
             var now      = DateTime.Now;
             var yearDiff = now.Year - evnt.Date.Year;
             DateRestrictionUC1.LoadCustomDate(yearDiff, now.Year + 1, "short", evnt.Date);
             CKEditorControl1.Text = evnt.Description;
         }
         else
         {
             Response.Redirect("~/Views/Events/");
         }
     }
 }