using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
//----------------------------------------------------------------
//Module Name: $safeprojectname$
//Purpose:
//CopyRight: Muchinfo
//History:
//----------------------------------------------------------------
//DateTime 2016/6/21 17:06:59
//Author
//Description Create
//----------------------------------------------------------------
using Muchinfo.MTPClient.Data.Helper;
namespace Muchinfo.MTPClient.Data.Quote
{
public class WeekPlanDetail
{
///
/// 周计划id
///
[PropertyDisc("WeekPlanDetailId")]
public long WeekPlanDetailId { get; set; }
///
/// 周结算计划ID
///
[PropertyDisc("WeekPlanId")]
public long WeekPlanId { get; set; }
///
/// 运行阶段
///
[PropertyDisc("RunStep")]
public int RunStep { get; set; }
///
/// 起始周几
///
[PropertyDisc("StartWeekDay")]
public int StartWeekDay { get; set; }
///
/// 结束周几
///
[PropertyDisc("EndWeekDay")]
public int EndWeekDay { get; set; }
///
/// 开始时间 HH:mm
///
[PropertyDisc("Starttime")]
public string Starttime { get; set; }
///
/// 结束时间 HH:mm
///
[PropertyDisc("EndTime")]
public string EndTime { get; set; }
///
/// 交易日
///
[PropertyDisc("Tradeday")]
public DateTime Tradeday { get; set; }
///
/// 获取开始时间
///
///
public DateTime GetStartTime()
{
if (this.Tradeday == DateTime.MinValue)
{
throw new Exception("traday is not valid !" + Tradeday);
}
var start = StartWeekDay - (int) Tradeday.DayOfWeek;
var startTime = this.Tradeday.AddDays(start);
if (!DateTime.TryParse(startTime.ToString("yyyy-MM-dd ") + Starttime, out startTime))
{
throw new Exception("traday is not valid !:"+startTime.ToString("yyyy-MM-dd ") + Starttime);
}
return startTime;
}
///
/// 获取结束时间
///
///
public DateTime GetEndTime()
{
if (this.Tradeday == DateTime.MinValue)
{
throw new Exception("traday is not valid !" + Tradeday);
}
var end = EndWeekDay - (int)Tradeday.DayOfWeek;
var endTime = this.Tradeday.AddDays(end);
if (!DateTime.TryParse(endTime.ToString("yyyy-MM-dd ") + EndTime, out endTime))
{
throw new Exception("traday is not valid !:" + endTime.ToString("yyyy-MM-dd ") + EndTime);
}
return endTime;
}
}
}