예제 #1
0
        void CustomDialog_OkClick(object sender, IdAndNameEventArgs e)
        {
            //mark complete
            var user = Page.User as CustomPrincipal;

            //&& (user.IsInRole(DbHelper.StaticValues.Roles.Manager)
            // || user.IsInRole(DbHelper.StaticValues.Roles.Teacher))
            if (user != null)
            {
                using (var helper = new DbHelper.Classes())
                {
                    bool enrolled = false;
                    bool saved    = helper.Enroll(SubjectClassId, user.Id, ref enrolled);
                    if (saved)
                    {
                        CustomDialog.CloseDialog();
                        Response.Redirect(this.Request.Url.PathAndQuery, true);
                        return;
                    }
                }
            }
        }