Esempio n. 1
0
 /// <summary>
 /// 得到一个对象实体
 /// </summary>
 public WisdCar.Model.PO.ClubCardTypePO DataRowToModel(DataRow row)
 {
     WisdCar.Model.PO.ClubCardTypePO model = new WisdCar.Model.PO.ClubCardTypePO();
     if (row != null)
     {
         if (row["ClubCardTypeID"] != null && row["ClubCardTypeID"].ToString() != "")
         {
             model.ClubCardTypeID = int.Parse(row["ClubCardTypeID"].ToString());
         }
         if (row["CardTypeName"] != null)
         {
             model.CardTypeName = row["CardTypeName"].ToString();
         }
         if (row["PackageDiscount"] != null && row["PackageDiscount"].ToString() != "")
         {
             model.PackageDiscount = decimal.Parse(row["PackageDiscount"].ToString());
         }
         if (row["PayDiscount"] != null && row["PayDiscount"].ToString() != "")
         {
             model.PayDiscount = decimal.Parse(row["PayDiscount"].ToString());
         }
         if (row["LogicalStatus"] != null && row["LogicalStatus"].ToString() != "")
         {
             model.LogicalStatus = int.Parse(row["LogicalStatus"].ToString());
         }
         if (row["CreatorID"] != null)
         {
             model.CreatorID = row["CreatorID"].ToString();
         }
         if (row["CreatedDate"] != null && row["CreatedDate"].ToString() != "")
         {
             model.CreatedDate = DateTime.Parse(row["CreatedDate"].ToString());
         }
         if (row["LastModifierID"] != null)
         {
             model.LastModifierID = row["LastModifierID"].ToString();
         }
         if (row["LastModifiedDate"] != null && row["LastModifiedDate"].ToString() != "")
         {
             model.LastModifiedDate = DateTime.Parse(row["LastModifiedDate"].ToString());
         }
         if (row["Reserved1"] != null)
         {
             model.Reserved1 = row["Reserved1"].ToString();
         }
         if (row["Reserved2"] != null)
         {
             model.Reserved2 = row["Reserved2"].ToString();
         }
         if (row["Reserved3"] != null)
         {
             model.Reserved3 = row["Reserved3"].ToString();
         }
     }
     return model;
 }
Esempio n. 2
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public WisdCar.Model.PO.ClubCardTypePO GetModel(int ClubCardTypeID)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("select  top 1 ClubCardTypeID,CardTypeName,PackageDiscount,PayDiscount,LogicalStatus,CreatorID,CreatedDate,LastModifierID,LastModifiedDate,Reserved1,Reserved2,Reserved3 from ClubCardType ");
            strSql.Append(" where ClubCardTypeID=@ClubCardTypeID");
            SqlParameter[] parameters = {
                    new SqlParameter("@ClubCardTypeID", SqlDbType.Int,4)
            };
            parameters[0].Value = ClubCardTypeID;

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