本文整理汇总了C#中UserGroup类的典型用法代码示例。如果您正苦于以下问题:C# UserGroup类的具体用法?C# UserGroup怎么用?C# UserGroup使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
UserGroup类属于命名空间,在下文中一共展示了UserGroup类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: addUserGroup
public static bool addUserGroup(UserGroup userGroup, String connString)
{
bool rs = false;
using (SqlConnection conn = new SqlConnection(connString))
{
try
{
conn.Open();
using (SqlCommand cmd = conn.CreateCommand())
{
cmd.CommandType = CommandType.StoredProcedure;
cmd.CommandText = "sony_sp_add_user_group";
cmd.Parameters.AddWithValue("@groupname", userGroup.GroupName);
cmd.Parameters.AddWithValue("@issuper", userGroup.IsSuper ? 1 : 0);
cmd.Parameters.AddWithValue("@created", userGroup.Created);
cmd.Parameters.AddWithValue("@updated", userGroup.Updated);
SqlParameter returnVal = new SqlParameter("@indentity", SqlDbType.Int);
returnVal.Direction = ParameterDirection.Output;
cmd.Parameters.Add(returnVal);
cmd.ExecuteNonQuery();
rs = ((int)cmd.Parameters["@indentity"].Value != 0);
}
}
catch (Exception ex)
{
return false;
}
}
return rs;
}
开发者ID:ndl0986,项目名称:rebuild-site,代码行数:31,代码来源:UserGroupServices.cs
示例2: UserGroupModel
public UserGroupModel(UserGroup ug)
{
Id = ug.Id;
Name = ug.Name;
Remark = ug.Remarks;
Roles = ug.GetAllRoles().ToArray();
}
开发者ID:luqizheng,项目名称:OrnamentFramework,代码行数:7,代码来源:UserGroupModel.cs
示例3: vUserGroup
public vUserGroup(UserGroup group)
{
DB db = new DB();
this.ID = group.ID;
this.GroupName = group.GroupName;
this.LoginName = group.LoginName;
this.LoginPassword = group.LoginPassword;
this.Email = group.Email;
this.Phone = group.Phone;
this.Address = group.Address;
this.AddTime = group.AddTime;
this.Weibo = group.Weibo;
this.WhatApp = group.WhatApp;
this.Description = group.Description;
this.LastLogin = group.LastLoginTime;
this.City = group.City;
this.Picture = group.Picture;
this.Priority = group.Priority;
this.Industry = group.Industry;
this.TodayPV = group.TodayPV;
this.PV = group.PV;
this.Downs = group.Downs;
this.Ups = group.Ups;
this.Images = db.Images.Where(c => c.TID == group.ID).Where(c => c.ImageType == ImageType.UserGroup).ToList();
this.IsVerified = group.IsVerified;
}
开发者ID:applenele,项目名称:NewRen,代码行数:26,代码来源:vUserGroup.cs
示例4: getById
public static UserGroup getById(int id, String connString)
{
UserGroup usergroup = new UserGroup();
usergroup.Id = id;
using (SqlConnection conn = new SqlConnection(connString))
{
try
{
conn.Open();
using (SqlCommand cmd = conn.CreateCommand())
{
cmd.CommandType = CommandType.StoredProcedure;
cmd.CommandText = "sony_sp_get_user_group_by_id";
cmd.Parameters.AddWithValue("@id", id);
using (SqlDataReader reader = cmd.ExecuteReader())
{
while (reader.Read())
{
usergroup.Id = (int)reader["id"];
usergroup.GroupName = reader["groupname"].ToString();
usergroup.IsSuper = reader["issuper"].ToString().Equals("1") || reader["issuper"].ToString().Equals("True") ? true : false;
usergroup.Created = (DateTime)reader["created"];
usergroup.Updated = (DateTime)reader["updated"];
}
}
}
}
catch (Exception ex)
{
return new UserGroup();
}
}
return usergroup;
}
开发者ID:ndl0986,项目名称:rebuild-site,代码行数:35,代码来源:UserGroupServices.cs
示例5: SetUp
public void SetUp()
{
Logger.Info("...begin setup...");
using (var session = CreateSession())
using (var transaction = session.BeginTransaction())
{
_user1 = new UserBuilder().WithUserName("u1").Build();
_user2 = new UserBuilder().WithUserName("u2").Build();
_userGroup1 = new UserGroupBuilder().WithName("g1").Build();
_userGroup2 = new UserGroupBuilder().WithName("g2").Build();
_user1.AddUserGroup(_userGroup1);
_user1.AddUserGroup(_userGroup2);
_user2.AddUserGroup(_userGroup1);
_user2.AddUserGroup(_userGroup2);
session.Save(_user1);
session.Save(_user2);
session.Save(_userGroup1);
session.Save(_userGroup2);
session.Flush();
session.Clear();
// make sure everything is present in the cache for the tests
session.QueryOver<User>().List();
session.QueryOver<UserGroup>().List();
transaction.Commit();
}
Logger.Info("...end setup...");
}
开发者ID:kjellski,项目名称:nhibernatetraining,代码行数:29,代码来源:SecondLevelCache.cs
示例6: vCurrentUser
public vCurrentUser(UserGroup model)
{
this.ID = model.ID;
this.CurrentName = model.GroupName;
this.UserType = UserType.UserGroup;
this.Show = "/UserGroup/Show/" + model.ID;
}
开发者ID:applenele,项目名称:NewRen,代码行数:7,代码来源:vCurrentUser.cs
示例7: Combine
private bool Combine(ArrayList groups, int binsize)
{
bool workdone=false;
int i;
for (i = 1; i < groups.Count; i++) {
UserGroup right = (UserGroup) groups[i];
UserGroup left = (UserGroup) groups[i-1];
//Can combine
if (right.Users.Count + left.Users.Count <= binsize) {
workdone=true;
UserGroup combine = new UserGroup();
combine.UpperBound = left.UpperBound;
combine.LowerBound = right.LowerBound;
combine.Users.AddRange(left.Users);
combine.Users.AddRange(right.Users);
groups.Remove(right);
groups.Remove(left);
groups.Insert(i-1, combine);
i--;
}
}
return workdone;
}
开发者ID:padilhalino,项目名称:FrontDesk,代码行数:29,代码来源:usergrouper.cs
示例8: SetAdministratorsGroupDefaultPermissions
/// <summary>
/// Sets the default permissions for the administrators group, properly importing version 2.0 values.
/// </summary>
/// <param name="administrators">The administrators group.</param>
/// <returns><c>true</c> if the operation succeeded, <c>false</c> otherwise.</returns>
public static bool SetAdministratorsGroupDefaultPermissions(UserGroup administrators)
{
// Administrators can do any operation
return AuthWriter.SetPermissionForGlobals(AuthStatus.Grant, Actions.FullControl, administrators);
// Settings.ConfigVisibleToAdmins is not imported on purpose
}
开发者ID:mono,项目名称:ScrewTurnWiki,代码行数:12,代码来源:StartupTools.cs
示例9: MatchRepositoryLoadMatchesListByUserRequest
public void MatchRepositoryLoadMatchesListByUserRequest()
{
UserGroup group=new UserGroup{Id = 1,Name = "Pune"};
User traveller = new User(new Email("[email protected]"), null, "password", group);
User requestor = new User(new Email("[email protected]"), null, "password", group);
Package package = new Package("Package", "Weight", "Dimensions");
Location origin = new Location("Origin", new TravelDate(DateTime.Today));
Location destination = new Location("Destination", new TravelDate(DateTime.Today.AddDays(1)));
Journey journey = new Journey(traveller, origin, destination);
Request request = new Request(requestor, package, origin, destination);
UserRepository.Instance.SaveUser(traveller);
UserRepository.Instance.SaveUser(requestor);
RequestRepository.Instance.Save(request);
JourneyRepository.Instance.Save(journey);
Match match = new Match(journey, request);
IMatchRepository repository = MatchRepository.Instance;
IList<Match> matchList = repository.LoadMatchesByUserRequest("[email protected]");
try
{
Assert.AreEqual(1, matchList.Count);
}
finally
{
repository.Delete(match);
}
}
开发者ID:lokeshwer,项目名称:CarrierPigeons,代码行数:27,代码来源:MatchTests.cs
示例10: PutUserGroup
// PUT api/UserGroups/5
public HttpResponseMessage PutUserGroup(int id, UserGroup usergroup)
{
if (!ModelState.IsValid)
{
return Request.CreateErrorResponse(HttpStatusCode.BadRequest, ModelState);
}
if (id != usergroup.Id)
{
return Request.CreateResponse(HttpStatusCode.BadRequest);
}
db.Entry(usergroup).State = EntityState.Modified;
try
{
db.SaveChanges();
}
catch (DbUpdateConcurrencyException ex)
{
return Request.CreateErrorResponse(HttpStatusCode.NotFound, ex);
}
return Request.CreateResponse(HttpStatusCode.OK);
}
开发者ID:nathanfl,项目名称:AAHIPro,代码行数:26,代码来源:UserGroupsController.cs
示例11: SetAnonymousGroupDefaultPermissions
/// <summary>
/// Sets the default permissions for the anonymous users group, properly importing version 2.0 values.
/// </summary>
/// <param name="anonymous">The anonymous users group.</param>
/// <returns><c>true</c> if the operation succeeded, <c>false</c> otherwise.</returns>
public static bool SetAnonymousGroupDefaultPermissions(UserGroup anonymous)
{
bool done = true;
// Properly import Private/Public Mode wiki
if(Settings.PrivateAccess) {
// Nothing to do, because without any explicit grant, Anonymous users cannot do anything
}
else if(Settings.PublicAccess) {
// Public access, allow modification and propagate file management permissions if they were allowed for anonymous users
done &= AuthWriter.SetPermissionForNamespace(AuthStatus.Grant, null, Actions.ForNamespaces.ModifyPages, anonymous);
done &= AuthWriter.SetPermissionForNamespace(AuthStatus.Grant, null, Actions.ForNamespaces.DownloadAttachments, anonymous);
if(Settings.UsersCanCreateNewPages) {
done &= AuthWriter.SetPermissionForNamespace(AuthStatus.Grant, null, Actions.ForNamespaces.CreatePages, anonymous);
}
if(Settings.UsersCanCreateNewCategories || Settings.UsersCanManagePageCategories) {
done &= AuthWriter.SetPermissionForNamespace(AuthStatus.Grant, null, Actions.ForNamespaces.ManageCategories, anonymous);
}
if(Settings.FileManagementInPublicAccessAllowed) {
SetupFileManagementPermissions(anonymous);
}
}
else {
// Standard configuration, only allow read permissions
done &= AuthWriter.SetPermissionForNamespace(AuthStatus.Grant, null, Actions.ForNamespaces.ReadPages, anonymous);
done &= AuthWriter.SetPermissionForNamespace(AuthStatus.Grant, null, Actions.ForNamespaces.ReadDiscussion, anonymous);
done &= AuthWriter.SetPermissionForNamespace(AuthStatus.Grant, null, Actions.ForNamespaces.DownloadAttachments, anonymous);
foreach(IFilesStorageProviderV30 prov in Collectors.FilesProviderCollector.AllProviders) {
done &= AuthWriter.SetPermissionForDirectory(AuthStatus.Grant, prov, "/", Actions.ForDirectories.DownloadFiles, anonymous);
}
}
return done;
}
开发者ID:mono,项目名称:ScrewTurnWiki,代码行数:40,代码来源:StartupTools.cs
示例12: vPwdEdit
public vPwdEdit(UserGroup group)
{
this.ID = group.ID;
this.GroupName = group.GroupName;
this.Picture = group.Picture;
this.Password = group.LoginPassword;
}
开发者ID:applenele,项目名称:NewRen,代码行数:7,代码来源:vPwdEdit.cs
示例13: Insert
public InsertResult Insert(UserGroup userGroup, Guid userId)
{
try
{
userGroup.Id = Guid.NewGuid();
userGroup.LastUpdate = DateTime.Now;
UserGroupDb.Insert
(
userGroup.Id,
userGroup.Description,
userGroup.Currency_Code,
userGroup.BackOfficeGroup
);
return new InsertResult();
}
catch (SqlException ex)
{
var entityError = new List<EntityError>();
entityError.Add(new EntityError("UserGroup", "Insert", ex.Message));
Logger.Instance.Log.ErrorException("Insert Delete", ex);
return new InsertResult(entityError);
}
}
开发者ID:bothaj,项目名称:JBSoft,代码行数:25,代码来源:UserGroupBll.cs
示例14: User
public User(int id, string code, bool blocked, UserGroup userGroup)
{
Id = id;
Code = code;
Blocked = blocked;
Group = userGroup;
}
开发者ID:reactiveui-forks,项目名称:FirstsStepsRUI,代码行数:7,代码来源:User.cs
示例15: addEntry
/// <summary>
/// Add a new entry to one of the dropdown tables in the database.
/// </summary>
/// <param name="table">Table to add a new entry to.</param>
/// <param name="entry">
/// DropdownEntry containing the value and code,
/// if exists.
/// </param>
public void addEntry(Constants.DropdownTable table,
DropdownEntry entry)
{
switch (table) {
case Constants.DropdownTable.Keyword:
var kw = new Keyword {
KeywordValue = entry.value
};
_db.Keywords.InsertOnSubmit(kw);
break;
case Constants.DropdownTable.QuestionType:
var qType = new QuestionType {
Code = entry.code,
Value = entry.value
};
_db.QuestionTypes.InsertOnSubmit(qType);
break;
case Constants.DropdownTable.Region:
var region = new Region {
Code = entry.code,
Value = entry.value
};
_db.Regions.InsertOnSubmit(region);
break;
case Constants.DropdownTable.RequestorType:
var rType = new RequestorType {
Code = entry.code,
Value = entry.value
};
_db.RequestorTypes.InsertOnSubmit(rType);
break;
case Constants.DropdownTable.TumourGroup:
var tGroup = new TumourGroup {
Code = entry.code,
Value = entry.value
};
_db.TumourGroups.InsertOnSubmit(tGroup);
break;
case Constants.DropdownTable.UserGroup:
var uGroup = new UserGroup {
Code = entry.code,
Value = entry.value
};
_db.UserGroups.InsertOnSubmit(uGroup);
break;
}
_db.SubmitChanges();
}
开发者ID:vladzaharia,项目名称:cairs,代码行数:68,代码来源:DropdownManagementController.cs
示例16: Should_return_true_for_single_monitor
public void Should_return_true_for_single_monitor()
{
var someGroup = new UserGroup(null,null,"ShouldFind");
var userGroup = new UserGroups(buildCollection);
userGroup.Add(someGroup);
Assert.That(userGroup.IsMonitoring("ShouldFind"), Is.EqualTo(true));
}
开发者ID:perryofpeek,项目名称:CCSkype,代码行数:7,代码来源:With_IsMonitoring.cs
示例17: Insert
///<summary>Inserts one UserGroup into the database. Returns the new priKey.</summary>
internal static long Insert(UserGroup userGroup)
{
if(DataConnection.DBtype==DatabaseType.Oracle) {
userGroup.UserGroupNum=DbHelper.GetNextOracleKey("usergroup","UserGroupNum");
int loopcount=0;
while(loopcount<100){
try {
return Insert(userGroup,true);
}
catch(Oracle.DataAccess.Client.OracleException ex){
if(ex.Number==1 && ex.Message.ToLower().Contains("unique constraint") && ex.Message.ToLower().Contains("violated")){
userGroup.UserGroupNum++;
loopcount++;
}
else{
throw ex;
}
}
}
throw new ApplicationException("Insert failed. Could not generate primary key.");
}
else {
return Insert(userGroup,false);
}
}
开发者ID:nampn,项目名称:ODental,代码行数:26,代码来源:UserGroupCrud.cs
示例18: IsUserGroupInReaderGroup
public bool IsUserGroupInReaderGroup(UserGroup userGroup, ReaderGroup readerGroup)
{
var query = GenerateQuery(new Guid("{F8EB1766-410A-4C38-9435-1C316956CAF3}"), userGroup.ItemId, readerGroup.ItemId);
var content = ExecScalar<int>(query);
var result = content == 1;
return result;
}
开发者ID:badelatschenfutzie,项目名称:tlKernel,代码行数:7,代码来源:TLAdoDataAccess.UserGroup.cs
示例19: CreateUserGroup
public bool CreateUserGroup(UserGroup usergroup)
{
var query = GenerateQuery(new Guid("{70DA19EA-1064-459E-93B0-695E68D544C5}"),
usergroup.ItemId,
usergroup.FriendlyName);
var result = ExecChangeLineQuery(query);
return result;
}
开发者ID:badelatschenfutzie,项目名称:tlKernel,代码行数:8,代码来源:TLAdoDataAccess.UserGroup.cs
示例20: Should_send_message_to_group_impl
public void Should_send_message_to_group_impl()
{
var skypeClient = new Skype_Client(new Skype());
var users = new List<SkypeClient.User>();
users.Add(new SkypeClient.User("testgogroups"));
users.Add(new SkypeClient.User("jonny.plankton"));
var userGroup = new UserGroup(skypeClient, users, "Trumps_trunk");
userGroup.Send(Guid.NewGuid().ToString());
}
开发者ID:perryofpeek,项目名称:CCSkype,代码行数:9,代码来源:With_client.cs
注:本文中的UserGroup类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论