/// <summary> /// 得到一个对象实体 /// </summary> public Model.zxkc GetModel(int id) { StringBuilder strSql = new StringBuilder(); strSql.Append("select top 1 id,year,month,empid,name,znjy,jxjy,dbyl,zfdk,zfzj,sylr from t_zxkc "); strSql.Append(" where id=@id"); SqlParameter[] parameters = { new SqlParameter("@id", SqlDbType.Int, 4) }; parameters[0].Value = id; Model.zxkc model = new Model.zxkc(); DataSet ds = DbHelperSql.Query(strSql.ToString(), parameters); if (ds.Tables[0].Rows.Count > 0) { if (ds.Tables[0].Rows[0]["id"] != null && ds.Tables[0].Rows[0]["id"].ToString() != "") { model.id = int.Parse(ds.Tables[0].Rows[0]["id"].ToString()); } if (ds.Tables[0].Rows[0]["year"] != null && ds.Tables[0].Rows[0]["year"].ToString() != "") { model.year = ds.Tables[0].Rows[0]["year"].ToString(); } if (ds.Tables[0].Rows[0]["month"] != null && ds.Tables[0].Rows[0]["month"].ToString() != "") { model.month = ds.Tables[0].Rows[0]["month"].ToString(); } if (ds.Tables[0].Rows[0]["empid"] != null && ds.Tables[0].Rows[0]["empid"].ToString() != "") { model.empid = ds.Tables[0].Rows[0]["empid"].ToString(); } if (ds.Tables[0].Rows[0]["name"] != null && ds.Tables[0].Rows[0]["name"].ToString() != "") { model.name = ds.Tables[0].Rows[0]["name"].ToString(); } if (ds.Tables[0].Rows[0]["znjy"] != null && ds.Tables[0].Rows[0]["znjy"].ToString() != "") { model.znjy = double.Parse(ds.Tables[0].Rows[0]["znjy"].ToString()); } if (ds.Tables[0].Rows[0]["jxjy"] != null && ds.Tables[0].Rows[0]["jxjy"].ToString() != "") { model.jxjy = double.Parse(ds.Tables[0].Rows[0]["jxjy"].ToString()); } if (ds.Tables[0].Rows[0]["dbyl"] != null && ds.Tables[0].Rows[0]["dbyl"].ToString() != "") { model.dbyl = double.Parse(ds.Tables[0].Rows[0]["dbyl"].ToString()); } if (ds.Tables[0].Rows[0]["zfdk"] != null && ds.Tables[0].Rows[0]["zfdk"].ToString() != "") { model.zfdk = double.Parse(ds.Tables[0].Rows[0]["zfdk"].ToString()); } if (ds.Tables[0].Rows[0]["zfzj"] != null && ds.Tables[0].Rows[0]["zfzj"].ToString() != "") { model.zfzj = double.Parse(ds.Tables[0].Rows[0]["zfzj"].ToString()); } if (ds.Tables[0].Rows[0]["sylr"] != null && ds.Tables[0].Rows[0]["sylr"].ToString() != "") { model.sylr = double.Parse(ds.Tables[0].Rows[0]["sylr"].ToString()); } return(model); } else { return(null); } }
/// <summary> /// 得到一个对象实体 /// </summary> public Model.gsjs GetModel(int id) { StringBuilder strSql = new StringBuilder(); strSql.Append("select top 1 id,year,month,depart,departid,empid,name,gzjb,yfje,kk,gjj,bxkk,zxkk,jckk,ysgzlj,gslj,bygs from r_jshz "); strSql.Append(" where id=@id"); SqlParameter[] parameters = { new SqlParameter("@id", SqlDbType.Int, 4) }; parameters[0].Value = id; Model.gsjs model = new Model.gsjs(); DataSet ds = DbHelperSql.Query(strSql.ToString(), parameters); if (ds.Tables[0].Rows.Count > 0) { if (ds.Tables[0].Rows[0]["id"] != null && ds.Tables[0].Rows[0]["id"].ToString() != "") { model.id = int.Parse(ds.Tables[0].Rows[0]["id"].ToString()); } if (ds.Tables[0].Rows[0]["year"] != null && ds.Tables[0].Rows[0]["year"].ToString() != "") { model.year = ds.Tables[0].Rows[0]["year"].ToString(); } if (ds.Tables[0].Rows[0]["month"] != null && ds.Tables[0].Rows[0]["month"].ToString() != "") { model.month = ds.Tables[0].Rows[0]["month"].ToString(); } if (ds.Tables[0].Rows[0]["depart"] != null && ds.Tables[0].Rows[0]["depart"].ToString() != "") { model.depart = ds.Tables[0].Rows[0]["depart"].ToString(); } if (ds.Tables[0].Rows[0]["departid"] != null && ds.Tables[0].Rows[0]["departid"].ToString() != "") { model.departid = ds.Tables[0].Rows[0]["departid"].ToString(); } if (ds.Tables[0].Rows[0]["empid"] != null && ds.Tables[0].Rows[0]["empid"].ToString() != "") { model.empid = ds.Tables[0].Rows[0]["empid"].ToString(); } if (ds.Tables[0].Rows[0]["name"] != null && ds.Tables[0].Rows[0]["name"].ToString() != "") { model.name = ds.Tables[0].Rows[0]["name"].ToString(); } if (ds.Tables[0].Rows[0]["gzjb"] != null && ds.Tables[0].Rows[0]["gzjb"].ToString() != "") { model.gzjb = ds.Tables[0].Rows[0]["gzjb"].ToString(); } if (ds.Tables[0].Rows[0]["yfje"] != null && ds.Tables[0].Rows[0]["yfje"].ToString() != "") { model.yfje = double.Parse(ds.Tables[0].Rows[0]["yfje"].ToString()); } if (ds.Tables[0].Rows[0]["kk"] != null && ds.Tables[0].Rows[0]["kk"].ToString() != "") { model.kk = double.Parse(ds.Tables[0].Rows[0]["kk"].ToString()); } if (ds.Tables[0].Rows[0]["gjj"] != null && ds.Tables[0].Rows[0]["gjj"].ToString() != "") { model.gjj = double.Parse(ds.Tables[0].Rows[0]["gjj"].ToString()); } if (ds.Tables[0].Rows[0]["bxkk"] != null && ds.Tables[0].Rows[0]["bxkk"].ToString() != "") { model.bxkk = double.Parse(ds.Tables[0].Rows[0]["bxkk"].ToString()); } if (ds.Tables[0].Rows[0]["zxkk"] != null && ds.Tables[0].Rows[0]["zxkk"].ToString() != "") { model.zxkk = double.Parse(ds.Tables[0].Rows[0]["zxkk"].ToString()); } if (ds.Tables[0].Rows[0]["jckk"] != null && ds.Tables[0].Rows[0]["jckk"].ToString() != "") { model.jckk = double.Parse(ds.Tables[0].Rows[0]["jckk"].ToString()); } if (ds.Tables[0].Rows[0]["ysgzlj"] != null && ds.Tables[0].Rows[0]["ysgzlj"].ToString() != "") { model.ysgzlj = double.Parse(ds.Tables[0].Rows[0]["ysgzlj"].ToString()); } if (ds.Tables[0].Rows[0]["gslj"] != null && ds.Tables[0].Rows[0]["gslj"].ToString() != "") { model.gslj = double.Parse(ds.Tables[0].Rows[0]["gslj"].ToString()); } if (ds.Tables[0].Rows[0]["bygs"] != null && ds.Tables[0].Rows[0]["bygs"].ToString() != "") { model.bygs = double.Parse(ds.Tables[0].Rows[0]["bygs"].ToString()); } return(model); } else { return(null); } }
/// <summary> /// 得到一个对象实体 /// </summary> public Model.gzmx GetModel(int id) { StringBuilder strSql = new StringBuilder(); strSql.Append("select top 1 id,year,month,empid,name,yfje,kqtk,kk,gsk,gjj2,gjj,bxkk,sfje from t_gzmx "); strSql.Append(" where id=@id"); SqlParameter[] parameters = { new SqlParameter("@id", SqlDbType.Int, 4) }; parameters[0].Value = id; Model.gzmx model = new Model.gzmx(); DataSet ds = DbHelperSql.Query(strSql.ToString(), parameters); if (ds.Tables[0].Rows.Count > 0) { if (ds.Tables[0].Rows[0]["id"] != null && ds.Tables[0].Rows[0]["id"].ToString() != "") { model.id = int.Parse(ds.Tables[0].Rows[0]["id"].ToString()); } if (ds.Tables[0].Rows[0]["year"] != null && ds.Tables[0].Rows[0]["year"].ToString() != "") { model.year = ds.Tables[0].Rows[0]["year"].ToString(); } if (ds.Tables[0].Rows[0]["month"] != null && ds.Tables[0].Rows[0]["month"].ToString() != "") { model.month = ds.Tables[0].Rows[0]["month"].ToString(); } if (ds.Tables[0].Rows[0]["empid"] != null && ds.Tables[0].Rows[0]["empid"].ToString() != "") { model.empid = ds.Tables[0].Rows[0]["empid"].ToString(); } if (ds.Tables[0].Rows[0]["name"] != null && ds.Tables[0].Rows[0]["name"].ToString() != "") { model.name = ds.Tables[0].Rows[0]["name"].ToString(); } if (ds.Tables[0].Rows[0]["yfje"] != null && ds.Tables[0].Rows[0]["yfje"].ToString() != "") { model.yfje = double.Parse(ds.Tables[0].Rows[0]["yfje"].ToString()); } if (ds.Tables[0].Rows[0]["kqtk"] != null && ds.Tables[0].Rows[0]["kqtk"].ToString() != "") { model.kqtk = double.Parse(ds.Tables[0].Rows[0]["kqtk"].ToString()); } if (ds.Tables[0].Rows[0]["kk"] != null && ds.Tables[0].Rows[0]["kk"].ToString() != "") { model.kk = double.Parse(ds.Tables[0].Rows[0]["kk"].ToString()); } if (ds.Tables[0].Rows[0]["gsk"] != null && ds.Tables[0].Rows[0]["gsk"].ToString() != "") { model.gsk = double.Parse(ds.Tables[0].Rows[0]["gsk"].ToString()); } if (ds.Tables[0].Rows[0]["gjj2"] != null && ds.Tables[0].Rows[0]["gjj2"].ToString() != "") { model.gjj2 = double.Parse(ds.Tables[0].Rows[0]["gjj2"].ToString()); } if (ds.Tables[0].Rows[0]["gjj"] != null && ds.Tables[0].Rows[0]["gjj"].ToString() != "") { model.gjj = double.Parse(ds.Tables[0].Rows[0]["gjj"].ToString()); } if (ds.Tables[0].Rows[0]["bxkk"] != null && ds.Tables[0].Rows[0]["bxkk"].ToString() != "") { model.bxkk = double.Parse(ds.Tables[0].Rows[0]["bxkk"].ToString()); } if (ds.Tables[0].Rows[0]["sfje"] != null && ds.Tables[0].Rows[0]["sfje"].ToString() != "") { model.sfje = double.Parse(ds.Tables[0].Rows[0]["sfje"].ToString()); } return(model); } else { return(null); } }