DEMO要连数据库的,数据库比较大, 我把这段的源代码贴出来, 请帮忙看下有没有什么问题? 和日历设置有什么关系吗?
看数据为什么都是06分开始, 06分结束呢 ? 很奇怪,又不知道是什么原因?
代码:
/// <summary>
/// 加载当前排程数据
/// </summary>
public void LoadData(int numMainID)
{
try
{
DataTable dt = APSMainDAL.GetAPSMainInfo(numMainID);
c1GanttView1.Tasks.AllowNew = true;
//Task[] taskList=new Task[1];
//c1GanttView1.Tasks.CopyTo(taskList, 0);
c1GanttView1.Tasks.Clear();
if (dt != null)
{
for (int i = 0; i < dt.Rows.Count; i++)
{
DataRow dr = dt.Rows[i];
//task
Task task = c1GanttView1.Tasks.AddNew();
task.Mode = TaskMode.Manual;
task.SetFieldValue("numIndex", dr["numIndex"]);
task.SetFieldValue("strWorkShopName", dr["strWorkShopName"]);
task.SetFieldValue("strLineID", dr["strLineID"]);
task.SetFieldValue("ClassType", dr["strClassType"]);
task.Name = dr["strStepMONO"].ToString();
task.SetFieldValue("strSiteName", dr["strSiteName"]);
task.SetFieldValue("strPartID", dr["strPartID"]);
task.SetFieldValue("numMOQty", dr["numMOQty"]);
task.SetFieldValue("numPlanPCSQty", dr["numPlanPCSQty"]);
//task.PercentComplete 完成百分比
if (dr["dt_PlanBng"] != null && dr["dt_PlanBng"] != DBNull.Value)
task.Start = Convert.ToDateTime(dr["dt_PlanBng"]);
if (dr["dt_PlanEnd"] != null && dr["dt_PlanEnd"] != DBNull.Value)
task.Finish = Convert.ToDateTime(dr["dt_PlanEnd"]);
//task.Duration 持续时间
//task.DurationUnits = DurationUnits.Hours;
//task.Duration = 10; //Convert.ToDouble(dr["numUsedMinutes"]);
}
}
//dt_Project_Bng = (DateTime)dt.Compute("min(dt_PlanBng)", null);
//dt_Project_End = (DateTime)dt.Compute("Min(dt_PlanEnd)", null);
//c1GanttView1.StartDate = dt_Project_Bng;
//c1GanttView1.FinishDate = dt_Project_End;
}
catch (Exception ex)
{
MessageBox.Show("错误,信息:"+ex.Message);
}
}
|