Exemple #1
0
        /// <summary>
        /// Adds a new role
        /// </summary>
        /// <param name="parent">Parent role</param>
        /// <param name="form">Role data</param>
        /// <returns>success</returns>
        public bool add(long parent, Form_Role_Add form)
        {
            role r = new role();
            r.date = DateTime.Now;
            r.parentid = parent;
            if (parent == 0)
            {
                r.parentid = null;
            }
            r.name = form["name"].getValue();

            using (ACLDataContext a = new ACLDataContext())
            {
                a.roles.InsertOnSubmit(r);
                a.SubmitChanges();
            }

            return true;
        }
Exemple #2
0
 /// <summary>
 /// Sets data for edit mode
 /// </summary>
 /// <param name="r">role</param>
 public void setEditData(role r)
 {
     this._action = new CMS_Action("/backend/editRole?id=" + r.id);
     this._elements["name"].setValue(r.name);
     this._elements["ok"].setLabel("Save changes");
 }
Exemple #3
0
		private void detach_roles(role entity)
		{
			this.SendPropertyChanging();
			entity.role1 = null;
		}
Exemple #4
0
		private void attach_roles(role entity)
		{
			this.SendPropertyChanging();
			entity.role1 = this;
		}
Exemple #5
0
 partial void Deleterole(role instance);
Exemple #6
0
 partial void Updaterole(role instance);
Exemple #7
0
 partial void Insertrole(role instance);
Exemple #8
0
        /// <summary>
        /// Save changes to the given role
        /// </summary>
        /// <param name="form">Role data</param>
        /// <param name="r">Role</param>
        /// <returns>success</returns>
        public bool save(Form_Role_Add form, role r)
        {
            role newRole = new role();
            newRole.id = r.id;

            if (r.parentid.HasValue)
            {
                newRole.parentid = r.parentid;
            }

            newRole.name = form["name"].getValue();
            newRole.date = r.date;

            using (ACLDataContext a = new ACLDataContext())
            {
                a.roles.Attach(newRole, r);
                a.SubmitChanges();
            }

            return true;
        }