Beispiel #1
0
 /// <summary>
 /// 得到一个对象实体
 /// </summary>
 public TtNum1.Model.C_a DataRowToModel(DataRow row)
 {
     TtNum1.Model.C_a model=new TtNum1.Model.C_a();
     if (row != null)
     {
         if(row["C_a_id"]!=null && row["C_a_id"].ToString()!="")
         {
             model.C_a_id=int.Parse(row["C_a_id"].ToString());
         }
         if(row["Sub"]!=null)
         {
             model.Sub=row["Sub"].ToString();
         }
         if(row["StartTime"]!=null && row["StartTime"].ToString()!="")
         {
             model.StartTime=DateTime.Parse(row["StartTime"].ToString());
         }
         if(row["StopTime"]!=null && row["StopTime"].ToString()!="")
         {
             model.StopTime=DateTime.Parse(row["StopTime"].ToString());
         }
         if(row["G_id"]!=null && row["G_id"].ToString()!="")
         {
             model.G_id=int.Parse(row["G_id"].ToString());
         }
     }
     return model;
 }
Beispiel #2
0
 /// <summary>
 /// 得到一个对象实体
 /// </summary>
 public TtNum1.Model.C_a GetModel(int C_a_id)
 {
     StringBuilder strSql=new StringBuilder();
     strSql.Append("select  top 1  ");
     strSql.Append(" C_a_id,Sub,StartTime,StopTime,G_id ");
     strSql.Append(" from C_a ");
     strSql.Append(" where C_a_id="+C_a_id+"" );
     TtNum1.Model.C_a model=new TtNum1.Model.C_a();
     DataSet ds=DbHelperSQL.Query(strSql.ToString());
     if(ds.Tables[0].Rows.Count>0)
     {
         if(ds.Tables[0].Rows[0]["C_a_id"]!=null && ds.Tables[0].Rows[0]["C_a_id"].ToString()!="")
         {
             model.C_a_id=int.Parse(ds.Tables[0].Rows[0]["C_a_id"].ToString());
         }
         if(ds.Tables[0].Rows[0]["Sub"]!=null && ds.Tables[0].Rows[0]["Sub"].ToString()!="")
         {
             model.Sub=ds.Tables[0].Rows[0]["Sub"].ToString();
         }
         if(ds.Tables[0].Rows[0]["StartTime"]!=null && ds.Tables[0].Rows[0]["StartTime"].ToString()!="")
         {
             model.StartTime=DateTime.Parse(ds.Tables[0].Rows[0]["StartTime"].ToString());
         }
         if(ds.Tables[0].Rows[0]["StopTime"]!=null && ds.Tables[0].Rows[0]["StopTime"].ToString()!="")
         {
             model.StopTime=DateTime.Parse(ds.Tables[0].Rows[0]["StopTime"].ToString());
         }
         if(ds.Tables[0].Rows[0]["G_id"]!=null && ds.Tables[0].Rows[0]["G_id"].ToString()!="")
         {
             model.G_id=int.Parse(ds.Tables[0].Rows[0]["G_id"].ToString());
         }
         return model;
     }
     else
     {
         return null;
     }
 }
Beispiel #3
0
 /// <summary>
 /// 得到一个对象实体
 /// </summary>
 public TtNum1.Model.C_a GetModel(int C_a_id)
 {
     StringBuilder strSql=new StringBuilder();
     strSql.Append("select  top 1  ");
     strSql.Append(" C_a_id,Sub,StartTime,StopTime,G_id ");
     strSql.Append(" from C_a ");
     strSql.Append(" where C_a_id="+C_a_id+"" );
     TtNum1.Model.C_a model=new TtNum1.Model.C_a();
     DataSet ds=DbHelperSQL.Query(strSql.ToString());
     if(ds.Tables[0].Rows.Count>0)
     {
         return DataRowToModel(ds.Tables[0].Rows[0]);
     }
     else
     {
         return null;
     }
 }