/// <summary> /// 得到一个对象实体 /// </summary> public ZIT.AppRouteServer.Model.CarLocation DataRowToModel(DataRow row) { ZIT.AppRouteServer.Model.CarLocation model = new ZIT.AppRouteServer.Model.CarLocation(); if (row != null) { if (row["LSH"] != null) { model.LSH = row["LSH"].ToString(); } if (row["CASEID"] != null) { model.CASEID = row["CASEID"].ToString(); } if (row["CCCC"] != null && row["CCCC"].ToString() != "") { model.CCCC = int.Parse(row["CCCC"].ToString()); } if (row["CLID"] != null) { model.CLID = row["CLID"].ToString(); } if (row["SJ"] != null && row["SJ"].ToString() != "") { model.SJ = DateTime.Parse(row["SJ"].ToString()); } if (row["JD"] != null) { model.JD = row["JD"].ToString(); } if (row["WD"] != null) { model.WD = row["WD"].ToString(); } if (row["SD"] != null && row["SD"].ToString() != "") { model.SD = decimal.Parse(row["SD"].ToString()); } if (row["FX"] != null) { model.FX = row["FX"].ToString(); } } return(model); }
/// <summary> /// 得到一个对象实体 /// </summary> public ZIT.AppRouteServer.Model.CarLocation GetModel() { //该表无主键信息,请自定义主键/条件字段 StringBuilder strSql = new StringBuilder(); strSql.Append("select LSH,CASEID,CCCC,CLID,SJ,JD,WD,SD,FX from CarLocation "); strSql.Append(" where "); OracleParameter[] parameters = { }; ZIT.AppRouteServer.Model.CarLocation model = new ZIT.AppRouteServer.Model.CarLocation(); DataSet ds = DbHelperOra.Query("", strSql.ToString(), parameters); if (ds.Tables[0].Rows.Count > 0) { return(DataRowToModel(ds.Tables[0].Rows[0])); } else { return(null); } }