예제 #1
0
        protected void RemoveButton_Click(object sender, EventArgs e)
        {
            var db = new ApplicationDbContext();

            foreach (var item in UserStateTransitionListView.Items)
            {
                var chk = item.FindControl("chkSelectOneUser") as CheckBox;
                if (chk.Checked)
                {
                    var ustID = (long)UserStateTransitionListView.DataKeys[item.DisplayIndex].Value;
                    var ust   = db.UserStateTransitions.Single(u => u.UserStateTransitionID == ustID);
                    db.UserStateTransitions.Remove(ust);
                }
            }
            if (db.ChangeTracker.HasChanges())
            {
                db.SaveChanges();
                UserStateTransitionListView.DataBind();
                UsersListView.DataBind();
            }
        }
예제 #2
0
        protected void AddButton_Click(object sender, EventArgs e)
        {
            var db = new ApplicationDbContext();

            foreach (var item in UsersListView.Items)
            {
                var chk = item.FindControl("chkSelectOneUser") as CheckBox;
                if (chk.Checked)
                {
                    var ust = new UserStateTransition();
                    ust.UserID = UsersListView.DataKeys[item.DisplayIndex].Value.ToString();
                    ust.WorkflowStateTransitionID = long.Parse(Request.QueryString["WorkflowStateTransitionID"]);
                    db.UserStateTransitions.Add(ust);
                    //string dii =  UsersListView.DataKeys[item.DataItemIndex].Value.ToString();
                }
            }
            if (db.ChangeTracker.HasChanges())
            {
                db.SaveChanges();
                UserStateTransitionListView.DataBind();
                UsersListView.DataBind();
            }
        }