本文整理汇总了C#中Lib类的典型用法代码示例。如果您正苦于以下问题:C# Lib类的具体用法?C# Lib怎么用?C# Lib使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Lib类属于命名空间,在下文中一共展示了Lib类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CalculateRenewalDate
/// <summary>
/// Based on the current date, calculates the next time a certification will need
/// to be renewed.
/// </summary>
/// <param name="drug">The Drug to look-up. Only the Drug.ID is needed.</param>
/// <param name="base_date">The DateTime to base the calculate off of.</param>
/// <returns>DateTime reflecting the base_date plus the Drugs renewal period.</returns>
public static DateTime CalculateRenewalDate(Lib.Data.Drug drug, DateTime base_date)
{
// MJL 2013-11-05
// TODO: Implement the method
return (base_date + GetRenewalPeriod(drug));
}
示例2: HasPendingChanges
public static bool HasPendingChanges(Lib.Data.Drug drug)
{
if( drug == null || !drug.ID.HasValue )
return false;
return HasPendingChanges(drug.ID);
}
示例3: ContextMenuOpening
public void ContextMenuOpening(Lib.Control Control)
{
Control.GetContextMenuItem<ToolStripTextBox>("Minimum Text Box").Text = Control.Settings["minimum"];
Control.GetContextMenuItem<ToolStripTextBox>("Maximum Text Box").Text = Control.Settings["maximum"];
Control.GetContextMenuItem<ToolStripTextBox>("Increment Text Box").Text = Control.Settings["increment"];
Control.GetContextMenuItem<ToolStripTextBox>("Decimal Places Text Box").Text = Control.Settings["decimal_places"];
Control.GetContextMenuItem<ToolStripTextBox>("Set Command Text Box").Text = Control.Settings["set_command"];
}
示例4: frmPointCommandHistory
public frmPointCommandHistory(Lib.Manager Manager, Outstation O, Point P)
{
InitializeComponent();
_manager = Manager;
_o = O;
_p = P;
}
示例5: Run
/// <summary>
/// Run the code example.
/// </summary>
/// <param name="user">The DFP user object running the code example.</param>
public override void Run(Lib.DfpUser user) {
// Get the ContentMetadataKeyHierarchy service.
ContentMetadataKeyHierarchyService contentMetadataKeyHierarchyService =
(ContentMetadataKeyHierarchyService) user.GetService(
DfpService.v201405.ContentMetadataKeyHierarchyService);
// Set the ID of the content metadata key hierarchy to update.
long contentMetadataKeyHierarchyId =
long.Parse(_T("INSERT_CONTENT_METADATA_KEY_HIERARCHY_ID_HERE"));
// Set the ID of the custom targeting key to be added as a hierarchy level
long customTargetingKeyId = long.Parse(_T("INSERT_CUSTOM_TARGETING_KEY_ID_HERE"));
// Create a statement to get content metadata key hierarchies.
StatementBuilder statementBuilder = new StatementBuilder()
.Where("WHERE id = :id")
.OrderBy("id ASC")
.Limit(1)
.AddValue("id", contentMetadataKeyHierarchyId);
try {
ContentMetadataKeyHierarchyPage page = contentMetadataKeyHierarchyService
.getContentMetadataKeyHierarchiesByStatement(statementBuilder.ToStatement());
ContentMetadataKeyHierarchy contentMetadataKeyHierarchy = page.results[0];
// Update the content metadata key hierarchy by adding a hierarchy level.
ContentMetadataKeyHierarchyLevel[] hierarchyLevels = contentMetadataKeyHierarchy
.hierarchyLevels;
ContentMetadataKeyHierarchyLevel hierarchyLevel = new ContentMetadataKeyHierarchyLevel();
hierarchyLevel.customTargetingKeyId = customTargetingKeyId;
hierarchyLevel.hierarchyLevel = hierarchyLevels.Length + 1;
List<ContentMetadataKeyHierarchyLevel> updatedHieratchyLevels =
new List<ContentMetadataKeyHierarchyLevel>();
updatedHieratchyLevels.AddRange(hierarchyLevels);
updatedHieratchyLevels.Add(hierarchyLevel);
contentMetadataKeyHierarchy.hierarchyLevels = updatedHieratchyLevels.ToArray();
// Update the content hierarchy on the server.
ContentMetadataKeyHierarchy[] contentMetadataKeyHierarchies =
contentMetadataKeyHierarchyService.updateContentMetadataKeyHierarchies(
new ContentMetadataKeyHierarchy[] {contentMetadataKeyHierarchy});
foreach (ContentMetadataKeyHierarchy updatedContentMetadataKeyHierarchy in
contentMetadataKeyHierarchies) {
Console.WriteLine("Content metadata key hierarchy with ID \"{0}\", name " +
"\"{1}\" was updated.", updatedContentMetadataKeyHierarchy.id,
updatedContentMetadataKeyHierarchy.name);
}
} catch (Exception ex) {
Console.WriteLine("Failed to update content metadata key hierarchies. Exception " +
"says \"{0}\"", ex.Message);
}
}
示例6: Create
public void Create(Lib.Control Control)
{
var label = new Label();
label.AutoSize = true;
Control.Controls.Add(label);
Control.Settings.Add("get_command", string.Empty);
}
示例7: GetEOCData
public string GetEOCData(Lib.Data.Drug d)
{
StringBuilder eocData = new StringBuilder();
foreach(Eoc eoc in _complianceSvc.GetByDrug(d.ID ?? 0))
{
eocData.Append(String.Format("data-{0}=\"1\" ", eoc.Name));
}
return eocData.ToString();
}
示例8: GetContextMenuItems
public ToolStripItem[] GetContextMenuItems(Lib.Control Control)
{
var getCommandMenuItem = new ToolStripMenuItem("Get Command");
var getCommandTextBox = new ToolStripTextBox("Get Command Text Box");
getCommandMenuItem.DropDownItems.Add(getCommandTextBox);
getCommandTextBox.TextChanged += new EventHandler(GetCommandToolStripTextBox_TextChanged);
getCommandTextBox.Tag = Control;
return new ToolStripItem[] { getCommandMenuItem };
}
示例9: UpdatePackageReference
public void UpdatePackageReference(Lib.PackageReference packageReference)
{
if (packageReference == null)
{
throw new ArgumentNullException("packageReference");
}
this._packageReference = packageReference;
this.Line = packageReference.StartLine;
this.Column = packageReference.StartPos;
}
示例10: VulnerabilityTask
public VulnerabilityTask(Lib.PackageReference packageReference, Lib.OSSIndex.Vulnerability vulnerability)
{
if (packageReference == null)
{
throw new ArgumentNullException("packageReference");
}
if (vulnerability == null)
{
throw new ArgumentNullException("vulnerability");
}
this._packageReference = packageReference;
this._vulnerability = vulnerability;
}
示例11: Login
public int Login(LoginModel loginModel, out Lib.BResult result)
{
result = new BResult();
var user = _userProfileRepo.Get().Where(x => x.UserName.Equals(loginModel.UserName, StringComparison.CurrentCultureIgnoreCase));
if (user == null || user.Count() != 1)
{
result.AddError("error", "not found");
return -1;
}
else
{
return user.First().Id;
}
}
示例12: CanViewReport
public static bool CanViewReport(Lib.Data.Report report)
{
if( string.IsNullOrWhiteSpace( report.ForRoles ) )
return Framework.Security.Manager.HasRole( "dev" );
var roles = report.ForRoles.Split( new char[] { '\n' }, StringSplitOptions.RemoveEmptyEntries );
foreach( var role in roles )
{
if( Framework.Security.Manager.HasRole( role ) )
{
return true;
}
}
return false;
}
示例13: IsCertified
public static bool IsCertified( Lib.Data.UserProfile up, Lib.Data.Eoc eoc, Lib.Data.Drug drug, ref DateTime date_certified )
{
if( up == null || eoc == null )
return false;
var ut = up.UserType;
if( !eoc.HasUserType( ut ) )
return false;
if( ut.Name == "prescriber" )
{
var user_eocs = Lib.Data.UserEoc.FindByUserandDrug(up.ID.Value, drug.ID.Value);
foreach( var ue in user_eocs )
{
if( ue.EocID == eoc.ID.Value )
{
date_certified = ue.DateCompleted;
return true;
}
}
}
else if( ut.Name == "provider" )
{
var pu = Lib.Systems.Security.GetCurrentProviderUser();
if( pu == null || pu.PrimaryFacilityID == null )
return false;
var facility_eocs = Lib.Data.FacilityEoc.FindByFacilityandDrug( pu.PrimaryFacilityID.Value, drug.ID.Value );
foreach( var fe in facility_eocs )
{
if( fe.EocID == eoc.ID.Value )
{
date_certified = fe.DateCompleted;
return true;
}
}
}
else
return false;
return false;
}
示例14: Run
/// <summary>
/// Run the code example.
/// </summary>
/// <param name="user">The DFP user object running the code example.</param>
public override void Run(Lib.DfpUser user) {
// Get the ContentMetadataKeyHierarchy service.
ContentMetadataKeyHierarchyService contentMetadataKeyHierarchyService =
(ContentMetadataKeyHierarchyService) user.GetService(
DfpService.v201403.ContentMetadataKeyHierarchyService);
// Set the IDs of the custom targeting keys for the hierarchy.
long customTargetingKeyId1 = long.Parse(_T("INSERT_LEVEL_ONE_CUSTOM_TARGETING_KEY_ID_HERE"));
long customTargetingKeyId2 = long.Parse(_T("INSERT_LEVEL_TWO_CUSTOM_TARGETING_KEY_ID_HERE"));
List<ContentMetadataKeyHierarchyLevel> hierarchyLevels =
new List<ContentMetadataKeyHierarchyLevel>();
ContentMetadataKeyHierarchyLevel hierarchyLevel1 = new ContentMetadataKeyHierarchyLevel();
hierarchyLevel1.customTargetingKeyId = customTargetingKeyId1;
hierarchyLevel1.hierarchyLevel = 1;
hierarchyLevels.Add(hierarchyLevel1);
ContentMetadataKeyHierarchyLevel hierarchyLevel2 = new ContentMetadataKeyHierarchyLevel();
hierarchyLevel2.customTargetingKeyId = customTargetingKeyId2;
hierarchyLevel2.hierarchyLevel = 2;
hierarchyLevels.Add(hierarchyLevel2);
ContentMetadataKeyHierarchy contentMetadataKeyHierarchy = new ContentMetadataKeyHierarchy();
contentMetadataKeyHierarchy.name = "Content hierarchy #" + new Random().Next(int.MaxValue);
contentMetadataKeyHierarchy.hierarchyLevels = hierarchyLevels.ToArray();
try {
// Create the content metadata key hierarchy on the server.
ContentMetadataKeyHierarchy[] contentMetadataKeyHierarchies =
contentMetadataKeyHierarchyService.createContentMetadataKeyHierarchies(
new ContentMetadataKeyHierarchy[] {contentMetadataKeyHierarchy});
foreach (ContentMetadataKeyHierarchy createdContentMetadataKeyHierarchy in
contentMetadataKeyHierarchies) {
Console.WriteLine("A content metadata key hierarchy with ID \"{0}\", name " +
"\"{1}\" and {2} levels was created.", createdContentMetadataKeyHierarchy.id,
createdContentMetadataKeyHierarchy.name,
createdContentMetadataKeyHierarchy.hierarchyLevels.Length);
}
} catch (Exception ex) {
Console.WriteLine("Failed to create content metadata key hierarchies. Exception says " +
"\"{0}\"", ex.Message);
}
}
示例15: Run
/// <summary>
/// Run the code example.
/// </summary>
/// <param name="user">The DFP user object running the code example.</param>
public override void Run(Lib.DfpUser user) {
// Get the ContentMetadataKeyHierarchy service.
ContentMetadataKeyHierarchyService contentMetadataKeyHierarchyService =
(ContentMetadataKeyHierarchyService) user.GetService(
DfpService.v201408.ContentMetadataKeyHierarchyService);
// Set the ID of the content metadata key hierarchy to delete.
long contentMetadataKeyHierarchyId =
long.Parse(_T("INSERT_CONTENT_METADATA_KEY_HIERARCHY_ID_HERE"));
// Create a statement to select a content metadata key hierarchy.
StatementBuilder statementBuilder = new StatementBuilder()
.Where("WHERE id = :id")
.OrderBy("id ASC")
.Limit(1)
.AddValue("id", contentMetadataKeyHierarchyId);
try {
// Get content metadata key hierarchies by statement.
ContentMetadataKeyHierarchyPage page = contentMetadataKeyHierarchyService
.getContentMetadataKeyHierarchiesByStatement(statementBuilder.ToStatement());
ContentMetadataKeyHierarchy contentMetadataKeyHierarchy = page.results[0];
Console.WriteLine("Content metadata key hierarchy with ID \"{0}\" will be deleted.",
contentMetadataKeyHierarchy.id);
statementBuilder.RemoveLimitAndOffset();
// Create action.
Google.Api.Ads.Dfp.v201408.DeleteContentMetadataKeyHierarchies action =
new Google.Api.Ads.Dfp.v201408.DeleteContentMetadataKeyHierarchies();
// Perform action.
UpdateResult result = contentMetadataKeyHierarchyService
.performContentMetadataKeyHierarchyAction(action, statementBuilder.ToStatement());
Console.WriteLine("Number of content metadata key hierarchies deleted: {0}",
result.numChanges);
} catch (Exception ex) {
Console.WriteLine("Failed to delete content metadata key hierarchies. " +
"Exception says \"{0}\"", ex.Message);
}
}