public RoleRelationWindow(RoleInfoModel entity, OperationAction operationAction, IUserOperationDAL userOperationDAL)
     : this(userOperationDAL)
 {
     UserAction = operationAction;
     InitData(entity);
     InitControl();
 }
 private void DgRoleListSelectionChanged(object sender, SelectionChangedEventArgs e)
 {
     foreach (RoleInfoModel item in DgRoleList.SelectedItems)
     {
         DgRoleSelectEnity = item;
         break;
     }
 }
예제 #3
0
 public void TestRoleInfoModelCreateTable()
 {
     var entity = new RoleInfoModel { RoleName = "RoleName", RoleDisplayName = "RoleDisplayName", CreateDateTime = DateTime.Now, Id = Guid.NewGuid().ToString(), LastUpdateDateTime = DateTime.Now };
     RoleInfoModel result;
     using (var session = sessions.OpenSession())
     {
         session.Save(entity);
         session.Flush();
         result = session.Get<RoleInfoModel>(entity.Id);
     }
     Assert.AreEqual(entity.RoleName, result.RoleName);
 }
예제 #4
0
 public void TestRoleInfoModelQueryAll()
 {
     var insertEntity = new RoleInfoModel { RoleName = "RoleName", RoleDisplayName = "RoleDisplayName", CreateDateTime = DateTime.Now, Id = Guid.NewGuid().ToString(), LastUpdateDateTime = DateTime.Now };
     using (var session = sessions.OpenSession())
     {
         session.Save(insertEntity);
         session.Flush();
         ICriteria crit = session.CreateCriteria(typeof(RoleInfoModel));
         var entityList = crit.List();
         var resultList = session.CreateQuery("from RoleInfoModel ").List<RoleInfoModel>();
         Assert.AreEqual(entityList.Count, resultList.Count);
     }
 }
예제 #5
0
 public void TestRoleInfoModelDelete()
 {
     var insertEntity = new RoleInfoModel { RoleName = "RoleName", RoleDisplayName = "RoleDisplayName", CreateDateTime = DateTime.Now, Id = Guid.NewGuid().ToString(), LastUpdateDateTime = DateTime.Now };
     using (var session = sessions.OpenSession())
     {
         session.Save(insertEntity);
         session.Flush();
         ICriteria crit = session.CreateCriteria(typeof(RoleInfoModel));
         var entity = crit.List<RoleInfoModel>().First();
         session.Delete(entity);
         session.Flush();
         var result = session.Get<RoleInfoModel>(entity.Id);
         Assert.IsNull(result);
     }
 }
예제 #6
0
 public void TestRoleInfoModelModify()
 {
     var entity = new RoleInfoModel { RoleName = "RoleName", RoleDisplayName = "RoleDisplayName", CreateDateTime = DateTime.Now, Id = Guid.NewGuid().ToString(), LastUpdateDateTime = DateTime.Now };
     RoleInfoModel queryEntity;
     using (var session = sessions.OpenSession())
     {
         session.Save(entity);
         session.Flush();
         queryEntity = session.Get<RoleInfoModel>(entity.Id);
         queryEntity.RoleName = "Modified";
         session.SaveOrUpdate(queryEntity);
         session.Flush();
         var result = session.Get<RoleInfoModel>(entity.Id);
         Assert.AreEqual(queryEntity.RoleName, result.RoleName);
     }
 }
 private void InitData(RoleInfoModel entity)
 {
     InitProperty(entity);
     TxtRoleName.Text = entity.RoleName;
     TxtRoleDisplayName.Text = entity.RoleDisplayName;
     TxtWorkflowName.Text = entity.WorkflowName;
     TxtWorkflowDisplayName.Text = entity.WorkflowDisplayName;
     ExistUserGroupList = UserOperationDAL.QueryAllUserGroupByRoleId(entity.Id);
     ExistUserInfoList = UserOperationDAL.QueryAllUserInfoByRoleId(entity.Id);
     ExistActionInfoList = UserOperationDAL.QueryAllActionInfoByRoleId(entity.Id);
     ClearBindData();
     LvUserGroupName.ItemsSource = ExistUserGroupList.DeepCopy();
     LvUserName.ItemsSource = ExistUserInfoList.DeepCopy();
     LvActionName.ItemsSource = ExistActionInfoList.DeepCopy();
     LvWorkflowState.ItemsSource = UserOperationDAL.QueryAllWorkflowStateByRoleId(entity.Id);
 }
예제 #8
0
        public void TestRoleInfoModelByRoleName()
        {
            var insertEntity = new RoleInfoModel { RoleName = "RoleName", RoleDisplayName = "RoleDisplayName", CreateDateTime = DateTime.Now, Id = Guid.NewGuid().ToString(), LastUpdateDateTime = DateTime.Now };
            using (var session = sessions.OpenSession())
            {
                session.Save(insertEntity);
                session.Flush();
                RoleInfoModel entity = null;
                var resultList = session.CreateQuery("from RoleInfoModel ").List<RoleInfoModel>();
                if (resultList.Count > 0)
                    entity = resultList.FirstOrDefault();
                ICriteria crit = session.CreateCriteria(typeof(RoleInfoModel)).Add(Restrictions.Eq("RoleName", entity.RoleName));
                var result = crit.List<RoleInfoModel>().First();

                Assert.AreEqual(result.RoleName, entity.RoleName);
            }
        }
 private void InitProperty(RoleInfoModel entity)
 {
     Id = entity.Id;
     CreateDateTime = entity.CreateDateTime;
     IsDelete = IsDelete;
 }