将从mysql数据库查询的新闻,遍历到List<>以及一些专擅数的浮动澳门永利娱乐总站

//for (int i = 0; i<dt.Rows.Count; i++) //循环取出ds.table中的值
//{
// subject s = new subject(); // 实例化student对象
// s.sub = Convert.ToString(dt);
// HouseTasks.Add(s.sub);
// ShoppingTasks.Add(s.sub);
// OfficeTasks.Add(s.sub); // 将取出的指标保存在LIST中 以上是获得值。
//}
internal class TaskGenerator
{
public static int CustomerCount = 10;
//随机数
static Random rndGenerator = new Random();
public static Task CreateTask(string subject, TaskCategory category)
{
Task task = new Task(subject, category,
DateTime.Now.AddHours(-rndGenerator.Next(96)));
int rndStatus = rndGenerator.Next(10);
//TotalHours表示总小数时
if (task.TimeDiff.TotalHours > 12)
{
if (task.TimeDiff.TotalHours > 80)
{
task.Status = TaskStatus.Completed;
}
else
{
//随机生成2个比例放入进程条
task.Status = TaskStatus.InProgress;
task.PercentComplete = rndGenerator.Next(9) * 10;
}
//随机生成日期
task.StartDate =
task.CreatedDate.AddMinutes(rndGenerator.Next(720)).Date;
}
if (rndStatus != 5)
task.DueDate = task.CreatedDate.AddHours((90 – rndStatus * 9) +
24).Date;
if (rndStatus > 8)
task.Priority = 2;
if (rndStatus < 3)
task.Priority = 0;
if (rndStatus == 6 && task.Status == TaskStatus.InProgress)
task.Status = TaskStatus.Deferred;
if (rndStatus == 4 && task.Status == TaskStatus.InProgress &&
task.PercentComplete < 40)
task.Status = TaskStatus.WaitingOnSomeoneElse;
if (task.Status == TaskStatus.Completed)
{
if (!task.StartDate.HasValue)
task.StartDate = task.CreatedDate.AddHours(12).Date;
task.CompletedDate = task.StartDate.Value.AddHours(rndGenerator.Next(48)

 

List<string> HouseTasks = new List<string>();
TaskInfoControl t = new TaskInfoControl();
DataTable dt = t.QuerySubject();
foreach (DataRow item in dt.Rows)//循环取出ds.table中的值
{
subject s = new subject(); // 实例化subject对象
try
{
s.sub =
Convert.ToString(item[“Subject”]);//将表中Subject那列值给s.sub
}
catch (Exception e)
{
throw e;
}
豪斯Tasks.Add(s.sub); // 将取出的指标保存在LIST中 以上是获取值。
// ShoppingTasks.Add(s.sub);
// OfficeTasks.Add(s.sub);
}

List<string> HouseTasks = new List<string>();
TaskInfoControl t = new TaskInfoControl();
DataTable dt = t.QuerySubject();
foreach (DataRow item in dt.Rows)//循环取出ds.table中的值
{
subject s = new subject(); // 实例化subject对象
try
{
s.sub =
Convert.ToString(item[“Subject”]);//将表中Subject这列值给s.sub
}
catch (Exception e)
{
throw e;
}
HouseTasks.Add(s.sub); // 将取出的指标保存在LIST中 以上是获得值。
// ShoppingTasks.Add(s.sub);
// OfficeTasks.Add(s.sub);
}

将从mysql数据库查询的音讯,遍历到List<>以及一些私下数的变动。

将从mysql数据库查询的新闻,遍历到List<>以及一些任意数的变更。

public class subject { public string sub { get; set; } }
//public class QueryCategory {
// subject s = new subject();
// string m = s.sub;
// string Sql = “select Category from httang_test.hxwang_office where
Subject = ‘” + m.ToString()+””;
// DataTable dt1 = MySqlDBHelper.QueryDataTable(Sql);
//}
static List<Task> GenerateTasks()
{
// List<string> ShoppingTasks = new List<string>();
// List<string> OfficeTasks = new List<string>();

//for (int i = 0; i<dt.Rows.Count; i++) //循环取出ds.table中的值
//{
// subject s = new subject(); // 实例化student对象
// s.sub = Convert.ToString(dt);
// HouseTasks.Add(s.sub);
// ShoppingTasks.Add(s.sub);
// OfficeTasks.Add(s.sub); // 将取出的指标保存在LIST中 以上是获取值。
//}
internal class TaskGenerator
{
public static int CustomerCount = 10;
//随机数
static Random rndGenerator = new Random();
public static Task CreateTask(string subject, TaskCategory category)
{
Task task = new Task(subject, category,
DateTime.Now.AddHours(-rndGenerator.Next(96)));
int rndStatus = rndGenerator.Next(10);
//TotalHours表示总小数时
if (task.TimeDiff.TotalHours > 12)
{
if (task.TimeDiff.TotalHours > 80)
{
task.Status = TaskStatus.Completed;
}
else
{
//随机生成多少个比回放入进程条
task.Status = TaskStatus.InProgress;
task.PercentComplete = rndGenerator.Next(9) * 10;
}
//随机变化日期
task.StartDate =
task.CreatedDate.AddMinutes(rndGenerator.Next(720)).Date;
}
if (rndStatus != 5)
task.DueDate = task.CreatedDate.AddHours((90 – rndStatus * 9) +
24).Date;
if (rndStatus > 8)
task.Priority = 2;
if (rndStatus < 3)
task.Priority = 0;
if (rndStatus == 6 && task.Status == TaskStatus.InProgress)
task.Status = TaskStatus.Deferred;
if (rndStatus == 4 && task.Status == TaskStatus.InProgress &&
task.PercentComplete < 40)
task.Status = TaskStatus.WaitingOnSomeoneElse;
if (task.Status == TaskStatus.Completed)
{
if (!task.StartDate.HasValue)
task.StartDate = task.CreatedDate.AddHours(12).Date;
task.CompletedDate = task.StartDate.Value.AddHours(rndGenerator.Next(48)

  • 24);
    }
    return task;
    }

代码相比乱,不过方法可能对的,大家又须求的选料看,希望对博友
有帮忙,欢迎留言分享!

string ts = null;
for (int i = 0; i < HouseTasks.Count; i++)
{
string m = HouseTasks[i];
TaskInfoControl tic = new TaskInfoControl();
DataTable hc = tic.QueryCaregory(m);
ts = Convert.ToString(hc); //将DataTable转换成string
}
//将string 转换成枚举类型
// var enu = Enum.Parse(typeof(int), ts);

string ts = null;
for (int i = 0; i < HouseTasks.Count; i++)
{
string m = HouseTasks[i];
TaskInfoControl tic = new TaskInfoControl();
DataTable hc = tic.QueryCaregory(m);
ts = Convert.ToString(hc); //将DataTable转换成string
}
//将string 转换到枚举类型
// var enu = Enum.Parse(typeof(int), ts);

 

  • 24);
    }
    return task;
    }

// 后面那列数据
List<Task> ret = new List<Task>();
foreach (string s in HouseTasks)//遍历数组
ret.Add(TaskGenerator.CreateTask(s, TaskCategory.HouseChores));
return ret;
}
//for (int i = 0; i < TaskGenerator.CustomerCount; i++)
// foreach (string s in OfficeTasks)
// ret.Add(TaskGenerator.CreateTask(s, TaskCategory.Office));
// foreach (string s in ShoppingTasks)
// ret.Add(TaskGenerator.CreateTask(s, TaskCategory.Shopping));

public class subject { public string sub { get; set; } }
//public class QueryCategory {
// subject s = new subject();
// string m = s.sub;
// string Sql = “select Category from httang_test.hxwang_office where
Subject = ‘” + m.ToString()+””;
// DataTable dt1 = MySqlDBHelper.QueryDataTable(Sql);
//}
static List<Task> GenerateTasks()
{
// List<string> ShoppingTasks = new List<string>();
// List<string> OfficeTasks = new List<string>();

代码比较乱,不过方法大概对的,大家又必要的抉择看,希望对博友
有救助,欢迎留言分享!

// 前边那列数据
List<Task> ret = new List<Task>();
foreach (string s in 豪斯Tasks)//遍历数组
ret.Add(TaskGenerator.CreateTask(s, TaskCategory.HouseChores));
return ret;
}
//for (int i = 0; i < TaskGenerator.CustomerCount; i++)
// foreach (string s in OfficeTasks)
// ret.Add(TaskGenerator.CreateTask(s, TaskCategory.Office));
// foreach (string s in ShoppingTasks)
// ret.Add(TaskGenerator.CreateTask(s, TaskCategory.Shopping));

相关文章