public override void FillSelectedRecordInContent(object RecordToFill) { DAL.tblUserGroup EditingRecord = DALObject.FindSaveModelByPrimeKey(((UserGroupEditListModel)RecordToFill).UserGroupID); txtUserGroupName.Text = EditingRecord.UserGroupName; gcCompany.DataSource = DALObject.GetUserGroupPermissionOnCompanies(EditingRecord.UserGroupID); var PermissionSource = from r in MenuOptionsDALObj.GetMenus() join jm in EditingRecord.tblUserGroupPerimissions on r.MenuOptionID equals jm.MenuOptionID into gm from rm in gm.DefaultIfEmpty() select new MenuOptionPermissionViewModel() { MenuOptionID = r.MenuOptionID, MenuOptionName = r.MenuOptionName, MenuOptionGroupName = r.MenuOptionGroupName, MenuOptionType = r.MenuType, CanView = (rm != null && rm.CanRead), CanAdd = (rm != null && rm.CanAdd), CanEdit = (rm != null && rm.CanEdit), CanDelete = (rm != null && rm.CanDelete) }; gridControlPermission.DataSource = PermissionSource.ToList(); gridViewPermission.ExpandAllGroups(); dsLocation = DALObject.GetLocationList(EditingRecord.UserGroupID); gcLocation.DataSource = dsLocation; }
public override void SaveRecord(Model.SavingParemeter Paras) { DAL.tblUserGroup SaveModel = null; if (Paras.SavingInterface == SavingParemeter.eSavingInterface.AddNew) { SaveModel = new DAL.tblUserGroup(); } else { SaveModel = DALObject.FindSaveModelByPrimeKey(((UserGroupEditListModel)EditRecordDataSource).UserGroupID); if (SaveModel == null) { Paras.SavingResult = new SavingResult(); Paras.SavingResult.ExecutionResult = eExecutionResult.ValidationError; Paras.SavingResult.ValidationError = "Can not edit. Selected record not found, it may be deleted by another UserGroup."; return; } } SaveModel.UserGroupName = txtUserGroupName.Text; Paras.SavingResult = DALObject.SaveNewRecord(SaveModel, (List <Model.Users.MenuOptionPermissionViewModel>)gridControlPermission.DataSource, (List <Model.Settings.CompanyMultiSelectLookupModel>)gvCompany.DataSource, dsLocation); base.SaveRecord(Paras); }