Ejemplo n.º 1
0
 /// <summary>
 /// 得到一个对象实体
 /// </summary>
 public webs_YueyxShop.Model.PaymentBase DataRowToModel(DataRow row)
 {
     webs_YueyxShop.Model.PaymentBase model = new webs_YueyxShop.Model.PaymentBase();
     if (row != null)
     {
         if (row["pay_ID"] != null && row["pay_ID"].ToString() != "")
         {
             model.pay_ID = int.Parse(row["pay_ID"].ToString());
         }
         if (row["pay_Name"] != null)
         {
             model.pay_Name = row["pay_Name"].ToString();
         }
         if (row["pay_Url"] != null)
         {
             model.pay_Url = row["pay_Url"].ToString();
         }
         if (row["pay_IsDel"] != null && row["pay_IsDel"].ToString() != "")
         {
             if ((row["pay_IsDel"].ToString() == "1") || (row["pay_IsDel"].ToString().ToLower() == "true"))
             {
                 model.pay_IsDel = true;
             }
             else
             {
                 model.pay_IsDel = false;
             }
         }
         if (row["pay_isPhone"] != null && row["pay_isPhone"].ToString() != "")
         {
             if ((row["pay_isPhone"].ToString() == "1") || (row["pay_isPhone"].ToString().ToLower() == "true"))
             {
                 model.pay_isPhone = true;
             }
             else
             {
                 model.pay_isPhone = false;
             }
         }
     }
     return model;
 }
Ejemplo n.º 2
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public webs_YueyxShop.Model.PaymentBase GetModel(int pay_ID)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("select  top 1 pay_ID,pay_Name,pay_Url,pay_IsDel,pay_isPhone from PaymentBase ");
            strSql.Append(" where pay_ID=@pay_ID");
            SqlParameter[] parameters = {
                    new SqlParameter("@pay_ID", SqlDbType.Int,4)
            };
            parameters[0].Value = pay_ID;

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