public static List <Server> Get()
        {
            List <Server> list = new List <Server>();
            string        sql  = "SELECT [Id] ,[ServerName],[UserName] ,[Password],[IISVersion],[SqlVersion],[ProjectId],[AddTime],[OSName],[ServerType] FROM [dbo].[Servers]";

            DataTable      dt = ProjectDB.GetDt(sql);
            List <Project> lp = ProjectRule.Get();

            foreach (DataRow row in dt.Rows)
            {
                Server o = new Server();
                o.Id          = St.ToInt32(row["Id"], 0);
                o.ServerName  = row["ServerName"].ToString();
                o.UserName    = row["UserName"].ToString();
                o.Password    = row["Password"].ToString();
                o.IISVersion  = row["IISVersion"].ToString();
                o.SqlVersion  = row["SqlVersion"].ToString();
                o.ProjectId   = row["ProjectId"].ToString();
                o.ProjectName = o.ProjectId == ""?"":string.Join(",", lp.Where(a => Array.IndexOf(o.ProjectId.Split(','), a.Id.ToString()) >= 0).Select(a => a.Name).ToArray());
                o.AddTime     = St.ToDateTime(row["AddTime"].ToString());
                o.OSName      = row["OSName"].ToString();
                o.ServerType  = row["ServerType"].ToString();
                list.Add(o);
            }
            return(list);
        }
        public static List <Attentions> Get()
        {
            List <Attentions> list = new List <Attentions>();
            string            sql  = "SELECT [Id] ,[Remark],[ProjectId],[AddTime] FROM [dbo].[Attentions] order by Id desc";

            DataTable      dt = ProjectDB.GetDt(sql);
            List <Project> lp = ProjectRule.Get();

            foreach (DataRow row in dt.Rows)
            {
                Attentions o = new Attentions();
                o.Id          = St.ToInt32(row["Id"], 0);
                o.Remark      = row["Remark"].ToString();
                o.ProjectId   = row["ProjectId"].ToString();
                o.ProjectName = o.ProjectId == "" ? "" : string.Join(",", lp.Where(a => Array.IndexOf(o.ProjectId.Split(','), a.Id.ToString()) >= 0).Select(a => a.Name).ToArray());
                o.AddTime     = St.ToDateTime(row["AddTime"].ToString());
                list.Add(o);
            }
            return(list);
        }
Exemple #3
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);
        }