本文整理汇总了C#中System.Guid.IsEmpty方法的典型用法代码示例。如果您正苦于以下问题:C# Guid.IsEmpty方法的具体用法?C# Guid.IsEmpty怎么用?C# Guid.IsEmpty使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Guid
的用法示例。
在下文中一共展示了Guid.IsEmpty方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ModifyColumn
public CustomBoardColumn ModifyColumn(Guid projectId, Guid columnId, string name, string description, int limit)
{
var project = _projectService.GetProjectFromId(projectId);
if(columnId.IsEmpty())
{
var newColumn = new CustomBoardColumn {Name = name, Description = description, CardLimit = limit};
project.AddBoardColumn(newColumn);
_customBoardColumnRepository.Save(newColumn);
_projectService.SaveProject(project);
return newColumn;
}
else
{
var column = project.GetBoardColumns().Where(x => x.Id == columnId).FirstOrDefault();
if(column != null)
{
column.Name = name;
column.Description = description;
column.CardLimit = limit;
_customBoardColumnRepository.Save(column);
return column;
}
}
return null;
}
示例2: GetById
/// <summary>
/// Gets a task
/// </summary>
/// <param name="taskId">Task identifier</param>
/// <returns>Task</returns>
public virtual ScheduleTask GetById(Guid taskId)
{
if (taskId.IsEmpty())
return null;
return taskRepository.GetById(taskId);
}
示例3: GetById
/// <summary>
/// Gets an email account by identifier
/// </summary>
/// <param name="emailAccountId">The email account identifier</param>
/// <returns>Email account</returns>
public virtual EmailAccount GetById(Guid emailAccountId)
{
if (emailAccountId.IsEmpty())
return null;
var emailAccount = emailAccountRepository.GetById(emailAccountId);
return emailAccount;
}
示例4: GetById
/// <summary>
/// Gets a message template
/// </summary>
/// <param name="messageTemplateId">Message template identifier</param>
/// <returns>Message template</returns>
public virtual MessageTemplate GetById(Guid messageTemplateId)
{
if (messageTemplateId.IsEmpty())
return null;
string key = string.Format(MESSAGETEMPLATES_BY_ID_KEY, messageTemplateId);
return cacheManager.Get(key, () =>
{
var manufacturer = messageTemplateRepository.GetById(messageTemplateId);
return manufacturer;
});
}
示例5: GetById
/// <summary>
/// Gets a company
/// </summary>
/// <param name="companyId">company identifier</param>
/// <returns>A company</returns>
public virtual Company GetById(Guid companyId)
{
if (companyId.IsEmpty())
return null;
string key = string.Format(COMPANY_BY_ID_KEY, companyId);
return this.cacheManager.Get(key, () =>
{
var company = this.companyRepository.GetById(companyId);
return company;
});
}
示例6: CreateOrUpdatePort
//create or update
public ActionResult CreateOrUpdatePort(Guid rowId, Guid countryId)
{
var model = new PortModel();
if (rowId.IsEmpty())
model.CountryId = countryId;
else
{
var port = portService.GetById(rowId);
if (port != null)
{
model = port.ToModel();
model.IsEdit = true;
}
}
return PartialView("_CreateOrUpdatePort", model);
}
示例7: Create
public ActionResult Create(Guid rowId)
{
var model = new SettingModel()
{
RowId = rowId
};
if (!rowId.IsEmpty())
{
var setting = settingService.GetById(rowId);
if (setting != null)
{
model.Name = setting.Name;
model.Value = setting.Value;
model.IsEdit = true;
}
}
return PartialView("_CreateUpdate", model);
}
示例8: GetFileById
/// <summary>
/// Gets a file
/// </summary>
/// <param name="fileId">FileMetaData identifier</param>
/// <returns>FileMetaData</returns>
public virtual FileMetaData GetFileById(Guid fileId)
{
if (fileId.IsEmpty())
return null;
var fileData = fileRepository.GetById(fileId);
return fileData;
}
示例9: GetById
/// <summary>
/// Gets a port
/// </summary>
/// <param name="portId">The port identifier</param>
/// <returns>port</returns>
public virtual Port GetById(Guid portId)
{
if (portId.IsEmpty())
return null;
string key = string.Format(PORTS_BY_ID_KEY, portId);
return this.cacheManager.Get(key, () =>
{
var port = this.dataRepository.GetById(portId);
return port;
});
}
示例10: Update
public void Update(Guid characterId, ICharacterData characterData)
{
if (characterId.IsEmpty()) throw new ArgumentException("characterId");
if (characterData == null) throw new ArgumentNullException("characterData");
throw new NotImplementedException();
}
示例11: GetActivityTypeById
/// <summary>
/// Gets an activity log type item
/// </summary>
/// <param name="activityLogTypeId">Activity log type identifier</param>
/// <returns>Activity log type item</returns>
public virtual ActivityLogType GetActivityTypeById(Guid activityLogTypeId)
{
if (activityLogTypeId.IsEmpty())
return null;
string key = string.Format(ACTIVITYTYPE_BY_ID_KEY, activityLogTypeId);
return cacheManager.Get(key, () =>
{
return activityLogTypeRepository.GetById(activityLogTypeId);
});
}
示例12: Edit
public ActionResult Edit(Guid rowId)
{
if (rowId.IsEmpty())
return RedirectToAction(SystemRouteNames.Index);
var client = clientService.GetById(rowId);
if (client == null)
return RedirectToAction(SystemRouteNames.Index);
var model = client.ToModel();
PrepareAddEditModel(model);
var associatedOffices = client.GetAttribute<List<Guid>>(SystemAttributeNames.AssociatedBrancOffices);
if (associatedOffices != null && associatedOffices.Count > 0)
model.OfficeId = associatedOffices.ToDelimitedString();
model.IsEdit = true;
return View(model);
}
示例13: RemoveUsersFromRoles
public void RemoveUsersFromRoles(Guid[] userIds, string[] roleNames)
{
if (userIds.IsEmpty() || roleNames == null)
{
throw new ArgumentException("Please specify one or more user ids and/or one or more role names.");
}
List<Guid> roleIds = new List<Guid>();
foreach (var name in roleNames)
{
roleIds.Add(this.GetRoleId(name, "user", "remove"));
}
var entries = this._dataSource.Query<UserInRole>().Where(e => userIds.Contains(e.UserId) && roleIds.Contains(e.GroupRole.RoleId));
var groupIds = entries.Select(e => e.GroupRoleGroupId).Distinct().ToArray();
var groupEntries = this._dataSource.Query<GroupInRole>().Where(e => groupIds.Contains(e.GroupId)).ToList();
foreach (var entry in entries)
{
var groupEntry = groupEntries.First(g => g.GroupId == entry.GroupRoleGroupId);
groupEntry.CurrentNumberOfUsers--;
}
this._dataSource.Delete(entries);
_userRoles.Clear();
}
示例14: GetById
/// <summary>
/// Gets a user
/// </summary>
/// <param name="userId">user identifier</param>
/// <returns>A user</returns>
public virtual Client GetById(Guid clientId)
{
if (clientId.IsEmpty())
return null;
string key = string.Format(CLIENTS_BY_ID_KEY, clientId);
return this.cacheManager.Get(key, () =>
{
var client = this.clientRepository.GetById(clientId);
return client;
});
}
示例15: GetById
/// <summary>
/// Gets a state/province
/// </summary>
/// <param name="stateProvinceId">The state/province identifier</param>
/// <returns>State/province</returns>
public virtual StateProvince GetById(Guid stateProvinceId)
{
if (stateProvinceId.IsEmpty())
return null;
string key = string.Format(STATEPROVINCES_BY_ID_KEY, stateProvinceId);
return this.cacheManager.Get(key, () =>
{
var category = this.stateProvinceRepository.GetById(stateProvinceId);
return category;
});
}