/// <summary> /// 更新一条数据 /// </summary> public int Update(Model.TASKSCHEME_PRIVATE_ORBIT model) { StringBuilder strSql = new StringBuilder(); strSql.Append("UPDATE LHF.TASKSCHEME_PRIVATE_ORBIT SET "); strSql.Append("SAT_ORBITEPOCH=@in_SAT_ORBITEPOCH,"); strSql.Append("SAT_MEANMOTION=@in_SAT_MEANMOTION,"); strSql.Append("SAT_ECCENTRICITY=@in_SAT_ECCENTRICITY,"); strSql.Append("SAT_INCLINATION=@in_SAT_INCLINATION,"); strSql.Append("SAT_ARGOFPERIGEE=@in_SAT_ARGOFPERIGEE,"); strSql.Append("SAT_RAAN=@in_SAT_RAAN,"); strSql.Append("SAT_MEANANOMALY=@in_SAT_MEANANOMALY,"); strSql.Append("SAT_MEANMOTIONDOT=@in_SAT_MEANMOTIONDOT,"); strSql.Append("SAT_MEANMOTIONDOTDOT=@in_SAT_MEANMOTIONDOTDOT,"); strSql.Append("SAT_BSTAR=@in_SAT_BSTAR,"); strSql.Append("SAT_TLE1=@in_SAT_TLE1,"); strSql.Append("SAT_TLE2=@in_SAT_TLE2,"); strSql.Append("SCHEMEID=@in_SCHEMEID"); strSql.Append(" WHERE SAT_ID=@in_SAT_ID"); SqlParameter[] cmdParms = new SqlParameter[] { new SqlParameter("@in_SAT_ID", SqlDbType.Decimal), new SqlParameter("@in_SAT_ORBITEPOCH", SqlDbType.NVarChar), new SqlParameter("@in_SAT_MEANMOTION", SqlDbType.NVarChar), new SqlParameter("@in_SAT_ECCENTRICITY", SqlDbType.NVarChar), new SqlParameter("@in_SAT_INCLINATION", SqlDbType.NVarChar), new SqlParameter("@in_SAT_ARGOFPERIGEE", SqlDbType.NVarChar), new SqlParameter("@in_SAT_RAAN", SqlDbType.NVarChar), new SqlParameter("@in_SAT_MEANANOMALY", SqlDbType.NVarChar), new SqlParameter("@in_SAT_MEANMOTIONDOT", SqlDbType.NVarChar), new SqlParameter("@in_SAT_MEANMOTIONDOTDOT", SqlDbType.NVarChar), new SqlParameter("@in_SAT_BSTAR", SqlDbType.NVarChar), new SqlParameter("@in_SAT_TLE1", SqlDbType.NVarChar), new SqlParameter("@in_SAT_TLE2", SqlDbType.NVarChar), new SqlParameter("@in_SCHEMEID", SqlDbType.Int) }; cmdParms[0].Value = model.SAT_ID; cmdParms[1].Value = model.SAT_ORBITEPOCH; cmdParms[2].Value = model.SAT_MEANMOTION; cmdParms[3].Value = model.SAT_ECCENTRICITY; cmdParms[4].Value = model.SAT_INCLINATION; cmdParms[5].Value = model.SAT_ARGOFPERIGEE; cmdParms[6].Value = model.SAT_RAAN; cmdParms[7].Value = model.SAT_MEANANOMALY; cmdParms[8].Value = model.SAT_MEANMOTIONDOT; cmdParms[9].Value = model.SAT_MEANMOTIONDOTDOT; cmdParms[10].Value = model.SAT_BSTAR; cmdParms[11].Value = model.SAT_TLE1; cmdParms[12].Value = model.SAT_TLE2; cmdParms[13].Value = model.SCHEMEID; return(DbHelperSQL.ExecuteSql(strSql.ToString(), cmdParms)); }
/// <summary> /// 得到一个对象实体 /// </summary> public Model.TASKSCHEME_PRIVATE_ORBIT GetModel(decimal SAT_ID) { StringBuilder strSql = new StringBuilder(); strSql.Append("SELECT * FROM LHF.TASKSCHEME_PRIVATE_ORBIT "); strSql.Append(" WHERE SAT_ID=" + SAT_ID); Model.TASKSCHEME_PRIVATE_ORBIT model = null; using (DbDataReader dr = DbHelperSQL.ExecuteReader(strSql.ToString())) { while (dr.Read()) { model = GetModel(dr); } return(model); } }
/// <summary> /// 增加一条数据 /// </summary> public int Add(Model.TASKSCHEME_PRIVATE_ORBIT model) { StringBuilder strSql = new StringBuilder(); strSql.Append("INSERT INTO LHF.TASKSCHEME_PRIVATE_ORBIT("); strSql.Append("SAT_ID,SAT_ORBITEPOCH,SAT_MEANMOTION,SAT_ECCENTRICITY,SAT_INCLINATION,SAT_ARGOFPERIGEE,SAT_RAAN,SAT_MEANANOMALY,SAT_MEANMOTIONDOT,SAT_MEANMOTIONDOTDOT,SAT_BSTAR,SAT_TLE1,SAT_TLE2,SCHEMEID)"); strSql.Append(" VALUES ("); strSql.Append("@in_SAT_ID,@in_SAT_ORBITEPOCH,@in_SAT_MEANMOTION,@in_SAT_ECCENTRICITY,@in_SAT_INCLINATION,@in_SAT_ARGOFPERIGEE,@in_SAT_RAAN,@in_SAT_MEANANOMALY,@in_SAT_MEANMOTIONDOT,@in_SAT_MEANMOTIONDOTDOT,@in_SAT_BSTAR,,@in_SAT_TLE1,@in_SAT_TLE2,@in_SCHEMEID)"); SqlParameter[] cmdParms = new SqlParameter[] { new SqlParameter("@in_SAT_ID", SqlDbType.Decimal), new SqlParameter("@in_SAT_ORBITEPOCH", SqlDbType.NVarChar), new SqlParameter("@in_SAT_MEANMOTION", SqlDbType.NVarChar), new SqlParameter("@in_SAT_ECCENTRICITY", SqlDbType.NVarChar), new SqlParameter("@in_SAT_INCLINATION", SqlDbType.NVarChar), new SqlParameter("@in_SAT_ARGOFPERIGEE", SqlDbType.NVarChar), new SqlParameter("@in_SAT_RAAN", SqlDbType.NVarChar), new SqlParameter("@in_SAT_MEANANOMALY", SqlDbType.NVarChar), new SqlParameter("@in_SAT_MEANMOTIONDOT", SqlDbType.NVarChar), new SqlParameter("@in_SAT_MEANMOTIONDOTDOT", SqlDbType.NVarChar), new SqlParameter("@in_SAT_BSTAR", SqlDbType.NVarChar), new SqlParameter("@in_SAT_TLE1", SqlDbType.NVarChar), new SqlParameter("@in_SAT_TLE2", SqlDbType.NVarChar), new SqlParameter("@in_SCHEMEID", SqlDbType.Int) }; cmdParms[0].Value = model.SAT_ID; cmdParms[1].Value = model.SAT_ORBITEPOCH; cmdParms[2].Value = model.SAT_MEANMOTION; cmdParms[3].Value = model.SAT_ECCENTRICITY; cmdParms[4].Value = model.SAT_INCLINATION; cmdParms[5].Value = model.SAT_ARGOFPERIGEE; cmdParms[6].Value = model.SAT_RAAN; cmdParms[7].Value = model.SAT_MEANANOMALY; cmdParms[8].Value = model.SAT_MEANMOTIONDOT; cmdParms[9].Value = model.SAT_MEANMOTIONDOTDOT; cmdParms[10].Value = model.SAT_BSTAR; cmdParms[11].Value = model.SAT_TLE1; cmdParms[12].Value = model.SAT_TLE2; cmdParms[13].Value = model.SCHEMEID; return(DbHelperSQL.ExecuteSql(strSql.ToString(), cmdParms)); }
/// <summary> /// 由一行数据得到一个实体 /// </summary> private Model.TASKSCHEME_PRIVATE_ORBIT GetModel(DbDataReader dr) { Model.TASKSCHEME_PRIVATE_ORBIT model = new Model.TASKSCHEME_PRIVATE_ORBIT(); model.SAT_ID = Convert.ToDecimal(dr["SAT_ID"]); model.SAT_ORBITEPOCH = Convert.ToString(dr["SAT_ORBITEPOCH"]); model.SAT_MEANMOTION = Convert.ToString(dr["SAT_MEANMOTION"]); model.SAT_ECCENTRICITY = Convert.ToString(dr["SAT_ECCENTRICITY"]); model.SAT_INCLINATION = Convert.ToString(dr["SAT_INCLINATION"]); model.SAT_ARGOFPERIGEE = Convert.ToString(dr["SAT_ARGOFPERIGEE"]); model.SAT_RAAN = Convert.ToString(dr["SAT_RAAN"]); model.SAT_MEANANOMALY = Convert.ToString(dr["SAT_MEANANOMALY"]); model.SAT_MEANMOTIONDOT = Convert.ToString(dr["SAT_MEANMOTIONDOT"]); model.SAT_MEANMOTIONDOTDOT = Convert.ToString(dr["SAT_MEANMOTIONDOTDOT"]); model.SAT_BSTAR = Convert.ToString(dr["SAT_BSTAR"]); try { model.SAT_TLE1 = Convert.ToString(dr["SAT_TLE1"]); } catch (Exception e) { model.SAT_TLE1 = ""; } try { model.SAT_TLE2 = Convert.ToString(dr["SAT_TLE2"]); } catch (Exception e) { model.SAT_TLE2 = ""; } try { model.SCHEMEID = Convert.ToInt32(dr["SCHEMEID"]); } catch (Exception e) { model.SCHEMEID = 0; } return(model); }