public ADeeWu.HuoBi3J.Model.Coupons_CashWhenFee_Code GetEntity(string where)
 {
     DataTable dt = this.Select(where,"");
     if(dt.Rows.Count==0) return null;
     DataRow dr = dt.Rows[0];
     ADeeWu.HuoBi3J.Model.Coupons_CashWhenFee_Code Entity = new ADeeWu.HuoBi3J.Model.Coupons_CashWhenFee_Code();
     Entity.ID = int.Parse(dr["ID"].ToString());
     Entity.Fee = dr["Fee"] as decimal?;
     Entity.Money = dr["Money"] as decimal?;
     Entity.Count = dr["Count"] as int?;
     Entity.UseCount = dr["UseCount"] as int?;
     Entity.UserID = dr["UserID"] as int?;
     Entity.SaleManUserID = dr["SaleManUserID"] as int?;
     Entity.StartDate = dr["StartDate"] as DateTime?;
     Entity.EndDate = dr["EndDate"] as DateTime?;
     Entity.CreateTime = dr["CreateTime"] as DateTime?;
     Entity.OriginalMoney = decimal.Parse(dr["OriginalMoney"].ToString());
     Entity.ParentCodeID = int.Parse(dr["ParentCodeID"].ToString());
     return Entity;
 }
        public ADeeWu.HuoBi3J.Model.Coupons_CashWhenFee_Code[] GetEntityList(string orderBy,string[] columns,params object[] values)
        {
            StringBuilder builder = new StringBuilder();
            builder.Append("select * from [Coupons_CashWhenFee_Code] where 1=1");
            db.Parameters.Clear();
            for(int i=0;i<columns.Length;i++)
            {
                builder.AppendFormat(" and [{0}]=@{0}", columns[i]);
                db.Parameters.Append("@"+columns[i],values[i]);
            }

            if (!string.IsNullOrEmpty(orderBy))
            {
                builder.AppendFormat(" order by {0}", orderBy);
            }

            DataTable dt = db.Select(builder.ToString());

            ADeeWu.HuoBi3J.Model.Coupons_CashWhenFee_Code[] EntityList = new ADeeWu.HuoBi3J.Model.Coupons_CashWhenFee_Code[dt.Rows.Count];
             if (dt.Rows.Count == 0) return EntityList;
            for (int i = 0; i < dt.Rows.Count; i++)
            {
                DataRow dr = dt.Rows[i];
                ADeeWu.HuoBi3J.Model.Coupons_CashWhenFee_Code Entity = new ADeeWu.HuoBi3J.Model.Coupons_CashWhenFee_Code();
                Entity.ID = int.Parse(dr["ID"].ToString());
                Entity.Fee = dr["Fee"] as decimal?;
                Entity.Money = dr["Money"] as decimal?;
                Entity.Count = dr["Count"] as int?;
                Entity.UseCount = dr["UseCount"] as int?;
                Entity.UserID = dr["UserID"] as int?;
                Entity.SaleManUserID = dr["SaleManUserID"] as int?;
                Entity.StartDate = dr["StartDate"] as DateTime?;
                Entity.EndDate = dr["EndDate"] as DateTime?;
                Entity.CreateTime = dr["CreateTime"] as DateTime?;
                Entity.OriginalMoney = decimal.Parse(dr["OriginalMoney"].ToString());
                Entity.ParentCodeID = dr["ParentCodeID"].ToInt();
                EntityList[i] = Entity;
            }
             return EntityList;
        }
 public ADeeWu.HuoBi3J.Model.Coupons_CashWhenFee_Code GetEntity(int  ID)
 {
     db.Parameters.Clear();
     db.Parameters.Append("@ID",ID);
     DataTable dt = db.Select("select * from [Coupons_CashWhenFee_Code] where 1=1  and [ID]=@ID");
     if(dt.Rows.Count==0) return null;
     DataRow dr = dt.Rows[0];
     ADeeWu.HuoBi3J.Model.Coupons_CashWhenFee_Code Entity = new ADeeWu.HuoBi3J.Model.Coupons_CashWhenFee_Code();
     Entity.ID = int.Parse(dr["ID"].ToString());
     Entity.Fee = dr["Fee"] as decimal?;
     Entity.Money = dr["Money"] as decimal?;
     Entity.Count = dr["Count"] as int?;
     Entity.UseCount = dr["UseCount"] as int?;
     Entity.UserID = dr["UserID"] as int?;
     Entity.SaleManUserID = dr["SaleManUserID"] as int?;
     Entity.StartDate = dr["StartDate"] as DateTime?;
     Entity.EndDate = dr["EndDate"] as DateTime?;
     Entity.CreateTime = dr["CreateTime"] as DateTime?;
     Entity.OriginalMoney = decimal.Parse(dr["OriginalMoney"].ToString());
     Entity.ParentCodeID = dr["ParentCodeID"].ToInt();
     return Entity;
 }