Beispiel #1
0
 /// <summary>
 /// 得到一个对象实体
 /// </summary>
 public Gymnasium_APP.Model.BackCardInfoModel DataRowToModel(DataRow row)
 {
     Gymnasium_APP.Model.BackCardInfoModel model=new Gymnasium_APP.Model.BackCardInfoModel();
     if (row != null)
     {
         if(row["Id"]!=null && row["Id"].ToString()!="")
         {
             model.Id=int.Parse(row["Id"].ToString());
         }
         if(row["CardNumber"]!=null)
         {
             model.CardNumber=row["CardNumber"].ToString();
         }
         if(row["CardType"]!=null)
         {
             model.CardType=row["CardType"].ToString();
         }
         if(row["Name"]!=null)
         {
             model.Name=row["Name"].ToString();
         }
         if(row["IDCardType"]!=null)
         {
             model.IDCardType=row["IDCardType"].ToString();
         }
         if(row["IDCardNumber"]!=null)
         {
             model.IDCardNumber=row["IDCardNumber"].ToString();
         }
         if(row["AddTime"]!=null && row["AddTime"].ToString()!="")
         {
             model.AddTime=DateTime.Parse(row["AddTime"].ToString());
         }
         if(row["StartTime"]!=null && row["StartTime"].ToString()!="")
         {
             model.StartTime=DateTime.Parse(row["StartTime"].ToString());
         }
         if(row["EndTime"]!=null && row["EndTime"].ToString()!="")
         {
             model.EndTime=DateTime.Parse(row["EndTime"].ToString());
         }
         if(row["TotalDays"]!=null && row["TotalDays"].ToString()!="")
         {
             model.TotalDays=int.Parse(row["TotalDays"].ToString());
         }
         if(row["LeftDays"]!=null && row["LeftDays"].ToString()!="")
         {
             model.LeftDays=int.Parse(row["LeftDays"].ToString());
         }
         if(row["TotalTimes"]!=null && row["TotalTimes"].ToString()!="")
         {
             model.TotalTimes=int.Parse(row["TotalTimes"].ToString());
         }
         if(row["LeftTimes"]!=null && row["LeftTimes"].ToString()!="")
         {
             model.LeftTimes=int.Parse(row["LeftTimes"].ToString());
         }
         if(row["PaidAmount"]!=null && row["PaidAmount"].ToString()!="")
         {
             model.PaidAmount=decimal.Parse(row["PaidAmount"].ToString());
         }
         if(row["ChangeAmount"]!=null && row["ChangeAmount"].ToString()!="")
         {
             model.ChangeAmount=decimal.Parse(row["ChangeAmount"].ToString());
         }
         if(row["PatchAmount"]!=null && row["PatchAmount"].ToString()!="")
         {
             model.PatchAmount=decimal.Parse(row["PatchAmount"].ToString());
         }
         if(row["UsedAmount"]!=null && row["UsedAmount"].ToString()!="")
         {
             model.UsedAmount=decimal.Parse(row["UsedAmount"].ToString());
         }
         if(row["CreateTime"]!=null && row["CreateTime"].ToString()!="")
         {
             model.CreateTime=DateTime.Parse(row["CreateTime"].ToString());
         }
     }
     return model;
 }
Beispiel #2
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public Gymnasium_APP.Model.BackCardInfoModel GetModel()
        {
            //该表无主键信息,请自定义主键/条件字段
            StringBuilder strSql=new StringBuilder();
            strSql.Append("select  top 1 Id,CardNumber,CardType,Name,IDCardType,IDCardNumber,AddTime,StartTime,EndTime,TotalDays,LeftDays,TotalTimes,LeftTimes,PaidAmount,ChangeAmount,PatchAmount,UsedAmount,CreateTime from BackCardInfo ");
            strSql.Append(" where ");
            SqlParameter[] parameters = {
            };

            Gymnasium_APP.Model.BackCardInfoModel model=new Gymnasium_APP.Model.BackCardInfoModel();
            DataSet ds=DbHelperSQL.Query(strSql.ToString(),parameters);
            if(ds.Tables[0].Rows.Count>0)
            {
                return DataRowToModel(ds.Tables[0].Rows[0]);
            }
            else
            {
                return null;
            }
        }