private void btnDeleteMemo_Click(object sender, EventArgs e) { this.Uow = new UnitOfWork(); PlanningMemo memo = (PlanningMemo)this.gridvMemo.GetRow(this.gridvMemo.FocusedRowHandle); if (memo == null) { return; } memo = new XPQuery <PlanningMemo>(this.Uow).FirstOrDefault(q => q.Id == memo.Id); if (memo == null) { return; } if (XtraMessageBox.Show(this.LookAndFeel, "Bent u zeker dat u deze memo wilt verwijderen?", "Verwijderen?", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question, MessageBoxDefaultButton.Button3) == DialogResult.Yes) { memo.Delete(); this.Uow.CommitChanges(); FindAllMemos(); } }
private void btnDeleteSong_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { var record = gridView.GetFocusedRow() as ViewRecord; if (record.IsNotNull()) { var id = record["Id"].ToInt(); var song = new XPQuery <Song>(Uow).Where(x => x.Oid == id).FirstOrDefault(); song.Delete(); Uow.CommitChanges(); LoadData(); } }
private static void CreateUser(UnitOfWork uow, string userName) { PermissionPolicyUser sampleUser = new XPQuery <PermissionPolicyUser>(uow).FirstOrDefault(x => x.UserName == userName); if (sampleUser != null) { sampleUser.Delete(); } sampleUser = new PermissionPolicyUser(uow); sampleUser.UserName = userName; sampleUser.SetPassword(""); PermissionPolicyRole defaultRole = userName == "User1" ? CreateDefaultRole1(uow) : CreateDefaultRole2(uow); sampleUser.Roles.Add(defaultRole); }
private static PermissionPolicyRole CreateDefaultRole2(UnitOfWork uow) { PermissionPolicyRole defaultRole = new XPQuery <PermissionPolicyRole>(uow).FirstOrDefault(x => x.Name == "Default2"); if (defaultRole != null) { defaultRole.Delete(); } defaultRole = new PermissionPolicyRole(uow); defaultRole.Name = "Default2"; defaultRole.AddTypePermissionsRecursively <Employee>(SecurityOperations.Read, SecurityPermissionState.Allow); defaultRole.AddTypePermissionsRecursively <Employee>(SecurityOperations.Write, SecurityPermissionState.Allow); //defaultRole.AddTypePermissionsRecursively<Order>(SecurityOperations.Read, SecurityPermissionState.Allow); //defaultRole.AddTypePermissionsRecursively<Customer>(SecurityOperations.Read, SecurityPermissionState.Allow); defaultRole.IsAdministrative = false; return(defaultRole); }
private void btnDeleteArticle_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { var record = gridView.GetFocusedRow() as ViewRecord; if (record.IsNotNull()) { var article = new XPQuery <Article>(Uow).Where(x => x.Oid == record["Id"].ToInt()).FirstOrDefault(); if (article.IsNotNull()) { if (XtraMessageBox.Show("Are you sure delete selected article?", "Delete", System.Windows.Forms.MessageBoxButtons.YesNo, System.Windows.Forms.MessageBoxIcon.Warning) == System.Windows.Forms.DialogResult.Yes) { article.Delete(); LoadData(); } } } }
private void btnDeleteMemo_Click(object sender, EventArgs e) { this.Uow = new UnitOfWork(); PlanningMemo memo = (PlanningMemo) this.gridvMemo.GetRow(this.gridvMemo.FocusedRowHandle); if (memo == null) return; memo = new XPQuery<PlanningMemo>(this.Uow).FirstOrDefault(q => q.Id == memo.Id); if (memo == null) return; if (XtraMessageBox.Show(this.LookAndFeel, "Bent u zeker dat u deze memo wilt verwijderen?", "Verwijderen?", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question, MessageBoxDefaultButton.Button3) == DialogResult.Yes) { memo.Delete(); this.Uow.CommitChanges(); FindAllMemos(); } }
private void btnRemoveAbsence_Click(object sender, EventArgs e) { this.Uow = new UnitOfWork(); Absence absence = (Absence)this.gridvAbsent.GetRow(this.gridvAbsent.FocusedRowHandle); if (absence == null) { return; } absence = new XPQuery <Absence>(this.Uow).FirstOrDefault(q => q.Id == absence.Id); if (XtraMessageBox.Show(this.LookAndFeel, "Bent u zeker dat u deze afwezigheid wilt verwijderen?", "Verwijderen?", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question, MessageBoxDefaultButton.Button3) == DialogResult.Yes) { absence.Delete(); this.Uow.CommitChanges(); FindAllAbsences(); } }
private void btnRemoveJob_Click(object sender, EventArgs e) { this.Uow = new UnitOfWork(); Job job = (Job)this.gridviewPlanning.GetRow(this.gridviewPlanning.FocusedRowHandle); if (job == null) { return; } job = new XPQuery <Job>(this.Uow).FirstOrDefault(q => q.Id == job.Id); if (XtraMessageBox.Show(this.LookAndFeel, "Bent u zeker dat u deze job wilt verwijderen?", "Verwijderen?", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question, MessageBoxDefaultButton.Button3) == DialogResult.Yes) { job.Delete(); this.Uow.CommitChanges(); FindAllJobs(); } }
private void btnRemoveJob_Click(object sender, EventArgs e) { this.Uow = new UnitOfWork(); Job job = (Job) this.gridviewPlanning.GetRow(this.gridviewPlanning.FocusedRowHandle); if (job == null) return; job = new XPQuery<Job>(this.Uow).FirstOrDefault(q => q.Id == job.Id); if (XtraMessageBox.Show(this.LookAndFeel, "Bent u zeker dat u deze job wilt verwijderen?", "Verwijderen?", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question, MessageBoxDefaultButton.Button3) == DialogResult.Yes) { job.Delete(); this.Uow.CommitChanges(); FindAllJobs(); } }
private void btnRemoveAbsence_Click(object sender, EventArgs e) { this.Uow = new UnitOfWork(); Absence absence = (Absence)this.gridvAbsent.GetRow(this.gridvAbsent.FocusedRowHandle); if (absence == null) return; absence = new XPQuery<Absence>(this.Uow).FirstOrDefault(q => q.Id == absence.Id); if (XtraMessageBox.Show(this.LookAndFeel, "Bent u zeker dat u deze afwezigheid wilt verwijderen?", "Verwijderen?", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question, MessageBoxDefaultButton.Button3) == DialogResult.Yes) { absence.Delete(); this.Uow.CommitChanges(); FindAllAbsences(); } }