public static PJReportViewModels RetrieveBookReportRecord(string name) { var sql = "select username,projects,reporttypes,reporttime,lastupdatetime from BookReportRecord where username = '******'"; sql = sql.Replace("<username>", name); var dbret = DBUtility.ExeLocalSqlWithRes(sql, null); if (dbret.Count > 0) { var ret = new PJReportViewModels(); ret.username = Convert.ToString(dbret[0][0]); ret.projects = Convert.ToString(dbret[0][1]); ret.reporttypes = Convert.ToString(dbret[0][2]); ret.reporttime = Convert.ToString(dbret[0][3]); ret.lastupdatetime = DateTime.Parse(Convert.ToString(dbret[0][4])); return(ret); } return(null); }
public static List <PJReportViewModels> RetrieveBookReportRecord() { var ret = new List <PJReportViewModels>(); var sql = "select username,projects,reporttypes,reporttime,lastupdatetime from BookReportRecord"; var dbret = DBUtility.ExeLocalSqlWithRes(sql, null); foreach (var line in dbret) { var temp = new PJReportViewModels(); temp.username = Convert.ToString(line[0]); temp.projects = Convert.ToString(line[1]); temp.reporttypes = Convert.ToString(line[2]); temp.reporttime = Convert.ToString(line[3]); temp.lastupdatetime = DateTime.Parse(Convert.ToString(line[4])); ret.Add(temp); } return(ret); }