public static RoleInTask CreateOrUpdateRoleTask(string app, string role, string url, string cmd) { bool exist = true; if (string.IsNullOrEmpty(app)) app = "/"; var dc = DCFactory.GetDataContext<SecurityDataContext>(); var task = GetTask(url, cmd); if (task == null) { throw new Exception(string.Format("Task for {0} does not exist!", cmd)); } var rt = GetRoleTask(app, role, url, cmd); if (rt == null) { rt = new RoleInTask(); exist = false; } rt.TaskId = task.TaskId; rt.ApplicationName = app.Trim(); rt.RoleName = role; if (!exist) dc.RoleInTasks.InsertOnSubmit(rt); return rt; }
private void detach_RoleInTasks(RoleInTask entity) { this.SendPropertyChanging(); entity.Task = null; }
private void attach_RoleInTasks(RoleInTask entity) { this.SendPropertyChanging(); entity.Task = this; }