コード例 #1
0
        public static WorkPlanFile Get(int id)
        {
            string   sql = "select Id,WorkPlanId,FileName,FilePath from WorkPlanFiles where Id = @Id";
            SqlParam p   = new SqlParam();

            p.AddParam("@Id", id, SqlDbType.Int, 0);
            DataTable dt = ProjectDB.GetDt(sql, p);

            WorkPlanFile o = new WorkPlanFile();

            if (dt.Rows.Count > 0)
            {
                var row = dt.Rows[0];

                o.Id         = St.ToInt32(row["Id"], 0);
                o.WorkPlanId = St.ToInt32(row["WorkPlanId"], 0);
                o.FileName   = row["FileName"].ToString();
                o.FilePath   = row["FilePath"].ToString();
            }
            return(o);
        }
コード例 #2
0
        public static List <WorkPlanFile> GetList(int workplanid)
        {
            string   sql = "select Id,WorkPlanId,FileName,FilePath from WorkPlanFiles where WorkPlanId = @workplanid order by Id desc";
            SqlParam p   = new SqlParam();

            p.AddParam("@workplanid", workplanid, SqlDbType.Int, 0);
            DataTable dt = ProjectDB.GetDt(sql, p);

            List <WorkPlanFile> list = new List <WorkPlanFile>();

            foreach (DataRow row in dt.Rows)
            {
                WorkPlanFile o = new WorkPlanFile();
                o.Id         = St.ToInt32(row["Id"], 0);
                o.WorkPlanId = St.ToInt32(row["WorkPlanId"], 0);
                o.FileName   = row["FileName"].ToString();
                o.FilePath   = row["FilePath"].ToString();
                list.Add(o);
            }
            return(list);
        }