本文整理汇总了C#中Period类的典型用法代码示例。如果您正苦于以下问题:C# Period类的具体用法?C# Period怎么用?C# Period使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Period类属于命名空间,在下文中一共展示了Period类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Painting
public Painting(string name, string description,
string author, Period period)
: base(name, description)
{
this.author = author;
this.period = period;
}
示例2: SingleMonth_PeriodOfTwoFullMonths
public void SingleMonth_PeriodOfTwoFullMonths()
{
var period = new Period(new DateTime(2010, 1, 1), new DateTime(2010, 1, 31));
var expected = new[] {"01/01/2010 - 01/31/2010"};
AssertPeriodBasedOnToStrings(period, expected);
}
示例3: EngineType
public EngineType(
string model,
Manufacturer manufacturer,
TypeOfEngine engine,
NoiseLevel noise,
double consumptation,
long price,
int maxspeed,
int ceiling,
double runway,
double range,
Period<int> produced)
{
Model = model;
Manufacturer = manufacturer;
Engine = engine;
ConsumptationModifier = consumptation;
Price = price;
MaxSpeed = maxspeed;
Ceiling = ceiling;
RunwayModifier = runway;
RangeModifier = range;
Produced = produced;
Types = new List<AirlinerType>();
Noise = noise;
}
示例4: Clocks
public Clocks(string name, string description, int price, string manufacturer, Period period, Material material)
: base(name, description, price)
{
this.manufacturer = manufacturer;
this.material = material;
this.period = period;
}
示例5: CreateMenu
void CreateMenu()
{
additem = new MenuItem (Catalog.GetString ("Add period"));
additem.Activated += (sender, e) => {
string periodname = App.Current.Dialogs.QueryMessage (Catalog.GetString ("Period name"), null,
(project.Periods.Count + 1).ToString (),
null).Result;
if (periodname != null) {
project.Dashboard.GamePeriods.Add (periodname);
Period p = new Period { Name = periodname };
p.Nodes.Add (new TimeNode {
Name = periodname,
Start = new Time { TotalSeconds = time.TotalSeconds - 10 },
Stop = new Time { TotalSeconds = time.TotalSeconds + 10 }
});
project.Periods.Add (p);
if (timertimeline != null) {
timertimeline.AddTimer (p);
}
}
};
Add (additem);
delitem = new MenuItem (Catalog.GetString ("Delete period"));
delitem.Activated += (sender, e) => {
project.Periods.Remove (timer as Period);
if (timertimeline != null) {
timertimeline.RemoveTimer (timer);
selectionCanvas.ClearSelection ();
}
};
Add (delitem);
ShowAll ();
}
示例6: Subscription
/// <summary>
/// Initializes a new instance of the <see cref="Subscription"/> class.
/// If the activated date is before the start date, a pro-rated amount is calculated.
/// If the activated date is after the start date, they are swapped and a pro-rated amount is calculated.
/// </summary>
/// <param name="name">The name.</param>
/// <param name="start">The starting date.</param>
/// <param name="end">The ending date.</param>
/// <param name="activated">The activated date.</param>
/// <param name="billingPeriod">The billing period.</param>
/// <param name="billingAmount">The billing amount.</param>
/// <param name="trialPeriod">The trial period.</param>
public Subscription(string name, DateTime start, DateTime end, DateTime activated, Period billingPeriod,
Money billingAmount, Period trialPeriod)
: this(name, start, end, billingPeriod, billingAmount)
{
ApplyTrialPeriod(trialPeriod, 1);
ApplyProratedAmount(start, billingAmount, activated);
}
示例7: SingleDay_PeriodOfSingleDay
public void SingleDay_PeriodOfSingleDay()
{
var period = new Period(new DateTime(2010, 1, 1), new DateTime(2010, 1, 1));
var expected = new[] { "01/01/2010 - 01/01/2010" };
AssertPeriodBasedOnToStrings(period, expected);
}
示例8: CorrelationAnalyzer
public CorrelationAnalyzer(DatedDataCollectionGen<double> series1_, DatedDataCollectionGen<double> series2_, Period p_, int numOfPeriods_)
{
m_series1 = series1_;
m_series2 = series2_;
m_period = p_;
m_numPeriod = numOfPeriods_;
// find common dates
List<DateTime> commonDates = new List<DateTime>();
List<DateTime> stratDates = new List<DateTime>(m_series1.Dates);
foreach (DateTime date in m_series2.Dates)
if (stratDates.Contains(date))
commonDates.Add(date);
QuickSort.Sort<DateTime>(commonDates);
List<double> first = new List<double>();
List<double> second = new List<double>();
// get the values for each of the common dates
foreach (DateTime date in commonDates)
{
first.Add(m_series1.ValueOnDate(date));
second.Add(m_series2.ValueOnDate(date));
}
m_series1 = new DatedDataCollectionGen<double>(commonDates.ToArray(), first.ToArray());
m_series2 = new DatedDataCollectionGen<double>(commonDates.ToArray(), second.ToArray());
recalc();
}
示例9: getPeriod
// получаем период в формате - название месяца + год
public Period getPeriod(int month_id, int year)
{
SqlConnection conn = new SqlConnection(this.ConnectionString);
string sql = "SELECT * FROM rolf_timeboard_periods WHERE (month_id = @month_id) AND (year = @year)";
SqlCommand cmd = new SqlCommand(sql, conn);
cmd.Parameters.Add(new SqlParameter("@month_id", SqlDbType.Int, 4));
cmd.Parameters["@month_id"].Value = month_id;
cmd.Parameters.Add(new SqlParameter("@year", SqlDbType.VarChar, 8));
cmd.Parameters["@year"].Value = year;
Period period = null;
try
{
conn.Open();
SqlDataReader reader = cmd.ExecuteReader();
reader.Read();
period = new Period((int)reader["id"], (int)reader["month_id"], (string)reader["month"], (int)reader["year"], (int)reader["is_closed"]);
reader.Close();
}
catch (Exception e)
{
throw new Exception(e.Message);
}
finally
{
conn.Close();
}
return period;
}
示例10: TeacherBusyTimeConflictHelper
/// <summary>
/// 建構式
/// </summary>
/// <param name="Rows"></param>
/// <param name="Messages"></param>
public TeacherBusyTimeConflictHelper(List<IRowStream> Rows,RowMessages Messages)
{
this.mTeacherPeriods = new Dictionary<string, List<Period>>();
this.mMessages = Messages;
foreach(IRowStream Row in Rows)
{
string TeacherFullName = Row.GetValue(constTeacehrName) + Row.GetValue(constTeacherNickName);
if (!mTeacherPeriods.ContainsKey(TeacherFullName))
mTeacherPeriods.Add(TeacherFullName, new List<Period>());
DateTime Date = K12.Data.DateTimeHelper.ParseDirect(Row.GetValue(constDate));
string StartTime = Row.GetValue(constStartTime);
string EndTime = Row.GetValue(constEndTime);
Tuple<DateTime, int> StorageTime = Utility.GetStorageTime(StartTime, EndTime);
DateTime BeginDatetime = StorageTime.Item1;
int Duration = StorageTime.Item2;
Period Period = new Period();
Period.Date= Date;
Period.Hour = BeginDatetime.Hour;
Period.Minute = BeginDatetime.Minute;
Period.Duration = Duration;
Period.Position = Row.Position;
mTeacherPeriods[TeacherFullName].Add(Period);
}
}
示例11: AirlinerTypeConfiguration
public AirlinerTypeConfiguration(string name, AirlinerType type, Period<DateTime> period, Boolean standard)
: base(ConfigurationType.AirlinerType, name, standard)
{
Airliner = type;
Period = period;
Classes = new List<AirlinerClassConfiguration>();
}
示例12: BrushlessMotor
/// <summary>
/// Use higher period, means faster response, not supported by all ESC
/// </summary>
/// <param name="pin">PWM pin</param>
/// <param name="period">Period</param>
public BrushlessMotor(PWM.Pin pin, Period period)
{
_precalc = (Max - Min) / _scale;
Period = (uint)period;
this._pwmPin = new PWM(pin);
this._pwmPin.SetPulse(Period, Min);
}
示例13: GetBurnDownData
/// <summary>
/// OBSOLETE
/// </summary>
/// <param name="ms"></param>
/// <param name="startDate"></param>
public static void GetBurnDownData(this RMilestoneStatus ms, DateTime startDate)
{
var rep = new ReleaseRepository();
var result = rep.GetArtefactsProgress(ms.Release.Id);
// determine amount days till milestone
var period = new Period { StartDate = startDate, EndDate = ms.Date };
var workingDays = period.AmountWorkingDays;
// get progress data for milestone
var count = 0;
var totalProgress = result.Where(x => ms.Id == x.MilestoneId).Select(x => new { HoursRemaining = x.HoursRemaining, StatusDate = x.StatusDate, DayNumber = count++ }).ToList().OrderBy(x => x.StatusDate);
// determine slope of known status data
var amountDays = totalProgress.Count();
var avgDays = totalProgress.Select(x => x.DayNumber).Average();
var avgHours = totalProgress.Select(x => x.HoursRemaining).Average();
var deviations = totalProgress.Select(x => new { xDeviation = x.DayNumber - avgDays, yDeviation = x.HoursRemaining - avgHours, xDevTimesyDev = (x.DayNumber - avgDays) * (x.HoursRemaining - avgHours), xDevSquare = (x.DayNumber - avgDays) * (x.DayNumber - avgDays) }).ToList();
// divide SUM( (x - avgX) * (y - avgY) ) by SUM( (x - avgX) * (x - avgX) )
var slope = deviations.Select(x => x.xDevTimesyDev).Sum() / deviations.Select(x => x.xDevSquare).Sum();
// determine intercept: avgY = (slope * avgX) + intercept -> intercept = -((slope * avgX) - avgY)
var intercept = -((slope * avgDays) - avgHours);
// formula best fitted line: amtHours = slope * amtDays + intercept
}
示例14: getGeeAccumStyle
private GUIStyle getGeeAccumStyle(KeepFitCrewMember crew, Period period, GeeLoadingAccumulator accum)
{
GameConfig gameConfig = scenarioModule.GetGameConfig();
GUIStyle style = new GUIStyle(GUI.skin.label);
style.normal.textColor = Color.green;
style.wordWrap = false;
GeeToleranceConfig tolerance = gameConfig.GetGeeTolerance(period);
if (tolerance == null)
{
return style;
}
float geeWarn = GeeLoadingCalculator.GetFitnessModifiedGeeTolerance(tolerance.warn, crew, gameConfig);
float geeFatal = GeeLoadingCalculator.GetFitnessModifiedGeeTolerance(tolerance.fatal, crew, gameConfig);
float gee = accum.GetLastGeeMeanPerSecond();
if (gee > geeFatal)
{
style.normal.textColor = Color.red;
}
else
{
if (gee > geeWarn)
{
style.normal.textColor = Color.yellow;
}
}
return style;
}
示例15: GetCookBills
public List<WayBill> GetCookBills(string userName, string item,
DateTime periodStart = new DateTime(), DateTime periodEnd = new DateTime())
{
List<WayBill> userBills=new List<WayBill>();
List<WayBill> userBillsByPeriod = new List<WayBill>();
period = new Period { Start = periodStart, End = periodEnd };
userBills = GetUserBills(userName).ToList();
userBills = new List<WayBill>(userBills.OrderByDescending(bill => bill.Id));
if (item == "1")
{
if ((period.Start == Convert.ToDateTime("01.01.0001 0:00:00")) ||
(period.End == Convert.ToDateTime("01.01.0001 0:00:00")))
return userBills;
if (period.Start == period.End)
{
userBillsByPeriod.AddRange(userBills.Where(bill => ((DateTime)(bill.Date)).Day == period.End.Day));
return userBillsByPeriod;
} //LINQ it's POWER!!!
userBillsByPeriod.AddRange(userBills.Where(bill => (bill.Date >= period.Start) && (bill.Date <= period.End)));
return userBillsByPeriod;
}
//TODO: Различные запросы
return userBills;
}