private static List <WeekReport> GetList(DataTable dt)
        {
            List <WeekReport> list = new List <WeekReport>();
            List <User>       lu   = UserRule.Get();

            foreach (DataRow row in dt.Rows)
            {
                WeekReport o = new WeekReport();
                o.Id              = St.ToInt32(row["Id"], 0);
                o.ProjectName     = row["ProjectName"].ToString();
                o.WorkContent     = row["WorkContent"].ToString();
                o.WorkType        = St.ToInt32(row["WorkType"], 0);
                o.WorkTypeStr     = GetWorkType(o.WorkType);
                o.PlanDateStart   = St.ToDateTime(row["PlanDateStart"].ToString());
                o.PlanDateEnd     = St.ToDateTime(row["PlanDateEnd"].ToString());
                o.PlanDay         = St.ToInt32(row["PlanDay"], 0);
                o.RealDay         = St.ToInt32(row["RealDay"], 0);
                o.RealWorkContent = row["RealWorkContent"].ToString();
                o.Status          = St.ToInt32(row["Status"], 0);
                o.StatusStr       = o.Status == 0 ? "未完成" : "完成";
                o.UserId          = St.ToInt32(row["UserId"], 0);
                o.User            = o.UserId == 0 ? new User() : lu.FirstOrDefault(a => a.Id == o.UserId);
                o.Remark          = row["Remark"].ToString();
                o.AddTime         = St.ToDateTime(row["AddTime"].ToString());

                list.Add(o);
            }
            return(list);
        }
Beispiel #2
0
        private static List <WorkPlan> GetList(DataTable dt)
        {
            List <WorkPlan> list = new List <WorkPlan>();
            List <Project>  lp   = ProjectRule.Get();
            List <User>     lu   = UserRule.Get();

            foreach (DataRow row in dt.Rows)
            {
                WorkPlan o = new WorkPlan();
                o.Id              = St.ToInt32(row["Id"], 0);
                o.SheepNo         = row["SheepNo"].ToString();
                o.ProjectId       = St.ToInt32(row["ProjectId"], 0);
                o.Project         = lp.FirstOrDefault(a => a.Id == o.ProjectId);
                o.WorkRemark      = row["WorkRemark"].ToString();
                o.PlanType        = St.ToInt32(row["PlanType"], 0);
                o.PlanTypeStr     = GetPlanType(o.PlanType);
                o.StartTime       = St.ToDateTime(row["StartTime"].ToString());
                o.EndTime         = St.ToDateTime(row["EndTime"].ToString());
                o.RealStartTime   = St.ToDateTime(row["RealStartTime"].ToString());
                o.RealEndTime     = St.ToDateTime(row["RealEndTime"].ToString());
                o.PublishTime     = St.ToDateTime(row["PublishTime"].ToString());
                o.State           = St.ToInt32(row["State"], 0);
                o.StateStr        = GetState(o.State);
                o.NeederId        = St.ToInt32(row["NeederId"], 0);
                o.Needer          = o.NeederId == 0 ? new User() : lu.FirstOrDefault(a => a.Id == o.NeederId);
                o.Remark          = row["Remark"].ToString();
                o.AddTime         = St.ToDateTime(row["AddTime"].ToString());
                o.Tester          = row["Tester"].ToString();
                o.Dever           = row["Dever"].ToString();
                o.FilePath        = row["FilePath"].ToString();
                o.SecretScanTime  = St.ToDateTime(row["SecretScanTime"].ToString());
                o.SecretScanCount = St.ToInt32(row["SecretScanCount"], 0);
                list.Add(o);
            }
            return(list);
        }