Esempio n. 1
0
 public ADeeWu.HuoBi3J.Model.Coupons_List GetEntity(string where)
 {
     DataTable dt = this.Select(where,"");
     if(dt.Rows.Count==0) return null;
     DataRow dr = dt.Rows[0];
     ADeeWu.HuoBi3J.Model.Coupons_List Entity = new ADeeWu.HuoBi3J.Model.Coupons_List();
     Entity.ID = int.Parse(dr["ID"].ToString());
     Entity.SubjectID = dr["SubjectID"] as int?;
     Entity.Money = dr["Money"] as decimal?;
     Entity.IsMoney = dr["IsMoney"] as bool?;
     Entity.Password = dr["Password"] as string;
     Entity.StartDate = dr["StartDate"] as DateTime?;
     Entity.EndDate = dr["EndDate"] as DateTime?;
     Entity.IsUse = dr["IsUse"] as bool?;
     Entity.UserID = dr["UserID"] as int?;
     Entity.UseDate = dr["UseDate"] as DateTime?;
     Entity.Memo = dr["Memo"] as string;
     Entity.Inactive = bool.Parse(dr["Inactive"].ToString());
     return Entity;
 }
Esempio n. 2
0
        public ADeeWu.HuoBi3J.Model.Coupons_List[] GetEntityList(string orderBy,string[] columns,params object[] values)
        {
            StringBuilder builder = new StringBuilder();
            builder.Append("select * from [Coupons_List] 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_List[] EntityList = new ADeeWu.HuoBi3J.Model.Coupons_List[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_List Entity = new ADeeWu.HuoBi3J.Model.Coupons_List();
                Entity.ID = int.Parse(dr["ID"].ToString());
                Entity.SubjectID = dr["SubjectID"] as int?;
                Entity.Money = dr["Money"] as decimal?;
                Entity.IsMoney = dr["IsMoney"] as bool?;
                Entity.Password = dr["Password"] as string;
                Entity.StartDate = dr["StartDate"] as DateTime?;
                Entity.EndDate = dr["EndDate"] as DateTime?;
                Entity.IsUse = dr["IsUse"] as bool?;
                Entity.UserID = dr["UserID"] as int?;
                Entity.UseDate = dr["UseDate"] as DateTime?;
                Entity.Memo = dr["Memo"] as string;
                Entity.Inactive = bool.Parse(dr["Inactive"].ToString());
                EntityList[i] = Entity;
            }
             return EntityList;
        }
Esempio n. 3
0
 public ADeeWu.HuoBi3J.Model.Coupons_List GetEntity(int  ID)
 {
     db.Parameters.Clear();
     db.Parameters.Append("@ID",ID);
     DataTable dt = db.Select("select * from [Coupons_List] where 1=1  and [ID]=@ID");
     if(dt.Rows.Count==0) return null;
     DataRow dr = dt.Rows[0];
     ADeeWu.HuoBi3J.Model.Coupons_List Entity = new ADeeWu.HuoBi3J.Model.Coupons_List();
     Entity.ID = int.Parse(dr["ID"].ToString());
     Entity.SubjectID = dr["SubjectID"] as int?;
     Entity.Money = dr["Money"] as decimal?;
     Entity.IsMoney = dr["IsMoney"] as bool?;
     Entity.Password = dr["Password"] as string;
     Entity.StartDate = dr["StartDate"] as DateTime?;
     Entity.EndDate = dr["EndDate"] as DateTime?;
     Entity.IsUse = dr["IsUse"] as bool?;
     Entity.UserID = dr["UserID"] as int?;
     Entity.UseDate = dr["UseDate"] as DateTime?;
     Entity.Memo = dr["Memo"] as string;
     Entity.Inactive = bool.Parse(dr["Inactive"].ToString());
     return Entity;
 }