partial void Deletestaff_permission(staff_permission instance);
 partial void Updatestaff_permission(staff_permission instance);
 partial void Insertstaff_permission(staff_permission instance);
		private void detach_staff_permissions(staff_permission entity)
		{
			this.SendPropertyChanging();
			entity.staff = null;
		}
		private void attach_staff_permissions(staff_permission entity)
		{
			this.SendPropertyChanging();
			entity.permission = this;
		}
        public bool Insert(staff nv)
        {
            try
            {
                db.staffs.InsertOnSubmit(nv);

                var permissions = from p in db.permissions
                                 select p;
                foreach (permission p in permissions)
                {
                    staff_permission sp = new staff_permission();
                    sp.permission = p;
                    sp.staff = nv;
                    sp.created = DateTime.Now;
                    sp.allow = false;

                    db.staff_permissions.InsertOnSubmit(sp);
                }

                db.SubmitChanges();
                return true;
            }
            catch(Exception ex)
            {
                throw ex;
            }
        }