企业库DAAB基本用法

  public   class  Category
ExpandedBlockStart.gifContractedBlock.gif    
dot.gif {
InBlock.gif        
private Database db;
InBlock.gif        
public Category()
ExpandedSubBlockStart.gifContractedSubBlock.gif        
dot.gif{
InBlock.gif            db 
= DatabaseFactory.CreateDatabase();
ExpandedSubBlockEnd.gif        }

InBlock.gif
InBlock.gif        
private string _ClassID;
InBlock.gif        
private string _ClassName;
InBlock.gif        
private int _Sort;
InBlock.gif        
private string _LogoImage;
InBlock.gif        
private string _ClassDetails;
InBlock.gif        
private byte[] _DateMark;
InBlock.gif
ExpandedSubBlockStart.gifContractedSubBlock.gif        
/**//// <summary>
InBlock.gif        
/// 类别ID
ExpandedSubBlockEnd.gif        
/// </summary>

InBlock.gif        public string ClassID
ExpandedSubBlockStart.gifContractedSubBlock.gif        
dot.gif{
ExpandedSubBlockStart.gifContractedSubBlock.gif            
setdot.gif{_ClassID = value;}
ExpandedSubBlockStart.gifContractedSubBlock.gif            
getdot.gif{return _ClassID;}
ExpandedSubBlockEnd.gif        }

InBlock.gif
ExpandedSubBlockStart.gifContractedSubBlock.gif        
/**//// <summary>
InBlock.gif        
/// 类别名称
ExpandedSubBlockEnd.gif        
/// </summary>

InBlock.gif        public string ClassName
ExpandedSubBlockStart.gifContractedSubBlock.gif        
dot.gif{
ExpandedSubBlockStart.gifContractedSubBlock.gif            
setdot.gif{_ClassName = value;}
ExpandedSubBlockStart.gifContractedSubBlock.gif            
getdot.gif{return _ClassName;}
ExpandedSubBlockEnd.gif        }

InBlock.gif
ExpandedSubBlockStart.gifContractedSubBlock.gif        
/**//// <summary>
InBlock.gif        
/// 排序值
ExpandedSubBlockEnd.gif        
/// </summary>

InBlock.gif        public int Sort
ExpandedSubBlockStart.gifContractedSubBlock.gif        
dot.gif{
ExpandedSubBlockStart.gifContractedSubBlock.gif            
setdot.gif{_Sort = value;}
ExpandedSubBlockStart.gifContractedSubBlock.gif            
getdot.gif{return _Sort;}
ExpandedSubBlockEnd.gif        }

InBlock.gif
ExpandedSubBlockStart.gifContractedSubBlock.gif        
/**//// <summary>
InBlock.gif        
/// 类别图片
ExpandedSubBlockEnd.gif        
/// </summary>

InBlock.gif        public string LogoImage
ExpandedSubBlockStart.gifContractedSubBlock.gif        
dot.gif{
ExpandedSubBlockStart.gifContractedSubBlock.gif            
setdot.gif{_LogoImage = value;}
ExpandedSubBlockStart.gifContractedSubBlock.gif            
getdot.gif{return _LogoImage;}
ExpandedSubBlockEnd.gif        }

InBlock.gif
ExpandedSubBlockStart.gifContractedSubBlock.gif        
/**//// <summary>
InBlock.gif        
/// 类别说明
ExpandedSubBlockEnd.gif        
/// </summary>

InBlock.gif        public string ClassDetails
ExpandedSubBlockStart.gifContractedSubBlock.gif        
dot.gif{
ExpandedSubBlockStart.gifContractedSubBlock.gif            
setdot.gif{_ClassDetails = value;}
ExpandedSubBlockStart.gifContractedSubBlock.gif            
getdot.gif{return _ClassDetails;}
ExpandedSubBlockEnd.gif        }

InBlock.gif
ExpandedSubBlockStart.gifContractedSubBlock.gif        
/**//// <summary>
InBlock.gif        
/// 最后修改时间
ExpandedSubBlockEnd.gif        
/// </summary>

InBlock.gif        public byte[] DateMark
ExpandedSubBlockStart.gifContractedSubBlock.gif        
dot.gif{
ExpandedSubBlockStart.gifContractedSubBlock.gif            
setdot.gif{_DateMark = value;}
ExpandedSubBlockStart.gifContractedSubBlock.gif            
getdot.gif{return _DateMark;}
ExpandedSubBlockEnd.gif        }

InBlock.gif
InBlock.gif
InBlock.gif
ExpandedSubBlockStart.gifContractedSubBlock.gif        
/**//// <summary>
InBlock.gif        
/// 获取Category对象集合
InBlock.gif        
/// </summary>
ExpandedSubBlockEnd.gif        
/// <returns>返回所有对象集合</returns>

InBlock.gif        public IList GetCategoryList()
ExpandedSubBlockStart.gifContractedSubBlock.gif        
dot.gif{
InBlock.gif            IList il 
= new ArrayList();
InBlock.gif            DBCommandWrapper dw 
= db.GetStoredProcCommandWrapper("CategoryGetList_p");
InBlock.gif            IDataReader dr 
= db.ExecuteReader(dw);
InBlock.gif            
while(dr.Read())
ExpandedSubBlockStart.gifContractedSubBlock.gif            
dot.gif{
InBlock.gif                Category obj 
= new Category();
InBlock.gif                obj.ClassID 
= Convert.ToString(dr["ClassID"]);
InBlock.gif                obj.ClassName 
= Convert.ToString(dr["ClassName"]);
InBlock.gif                obj.Sort 
= Convert.ToInt32(dr["Sort"]);
InBlock.gif                obj.LogoImage 
= Convert.ToString(dr["LogoImage"]);
InBlock.gif                obj.ClassDetails 
= Convert.ToString(dr["ClassDetails"]);
InBlock.gif                obj.DateMark 
= (byte[])(dr["DateMark"]);
InBlock.gif                il.Add(obj);
ExpandedSubBlockEnd.gif            }

InBlock.gif            
return il;
ExpandedSubBlockEnd.gif        }

InBlock.gif
InBlock.gif
ExpandedSubBlockStart.gifContractedSubBlock.gif        
/**//// <summary>
InBlock.gif        
/// 对Category对象的简单查询操作
InBlock.gif        
/// </summary>
InBlock.gif        
/// <param name="ClassID">类别ID</param>
ExpandedSubBlockEnd.gif        
/// <returns>返回Category对象</returns>

InBlock.gif        public Category GetCategoryByClassID(string ClassID)
ExpandedSubBlockStart.gifContractedSubBlock.gif        
dot.gif{
InBlock.gif            
bool HasData = false;
InBlock.gif            Category obj 
= new Category();
InBlock.gif            DBCommandWrapper dw 
= db.GetStoredProcCommandWrapper("CategoryGet_p");
InBlock.gif            dw.AddInParameter(
"@ClassID",DbType.String,ClassID);
InBlock.gif            IDataReader dr 
= db.ExecuteReader(dw);
InBlock.gif            
while(dr.Read())
ExpandedSubBlockStart.gifContractedSubBlock.gif            
dot.gif{
InBlock.gif                obj.ClassID 
= Convert.ToString(dr["ClassID"]);
InBlock.gif                obj.ClassName 
= Convert.ToString(dr["ClassName"]);
InBlock.gif                obj.Sort 
= Convert.ToInt32(dr["Sort"]);
InBlock.gif                obj.LogoImage 
= Convert.ToString(dr["LogoImage"]);
InBlock.gif                obj.ClassDetails 
= Convert.ToString(dr["ClassDetails"]);
InBlock.gif                obj.DateMark 
= (byte[])(dr["DateMark"]);
InBlock.gif                HasData 
= true;
ExpandedSubBlockEnd.gif            }

InBlock.gif            dr.Close();
InBlock.gif            
if(!HasData)
InBlock.gif                
return null;
InBlock.gif            
else
InBlock.gif                
return obj;
ExpandedSubBlockEnd.gif        }

InBlock.gif
InBlock.gif
ExpandedSubBlockStart.gifContractedSubBlock.gif        
/**//// <summary>
InBlock.gif        
/// 对Category对象的插入操作
InBlock.gif        
/// </summary>
InBlock.gif        
/// <param name="obj">Category对象</param>
ExpandedSubBlockEnd.gif        
/// <returns>返回影响行数</returns>

InBlock.gif        public int InsertCategory(Category obj,out string newid)
ExpandedSubBlockStart.gifContractedSubBlock.gif        
dot.gif{
InBlock.gif            DBCommandWrapper dw 
= db.GetStoredProcCommandWrapper("CategoryInsert_p");
InBlock.gif            dw.AddInParameter(
"@ClassID",DbType.String,obj.ClassID);
InBlock.gif            dw.AddOutParameter(
"@NewID",DbType.String,6);
InBlock.gif            dw.AddInParameter(
"@ClassName",DbType.String,obj.ClassName);
InBlock.gif            dw.AddInParameter(
"@Sort",DbType.Int32,obj.Sort);
InBlock.gif            dw.AddInParameter(
"@LogoImage",DbType.String,obj.LogoImage);
InBlock.gif            dw.AddInParameter(
"@ClassDetails",DbType.String,obj.ClassDetails);
InBlock.gif            dw.AddOutParameter(
"@RowCount",DbType.Int32,4);
InBlock.gif            db.ExecuteNonQuery(dw);
InBlock.gif            
int rlt = Convert.ToInt32(dw.GetParameterValue("@RowCount"));
InBlock.gif            newid 
= Convert.ToString(dw.GetParameterValue("@NewID"));
InBlock.gif            db.ClearParameterCache();
InBlock.gif            dw.Dispose();
InBlock.gif            
return rlt;
ExpandedSubBlockEnd.gif        }

InBlock.gif
InBlock.gif
ExpandedSubBlockStart.gifContractedSubBlock.gif        
/**//// <summary>
InBlock.gif        
/// 对Category对象的更新操作
InBlock.gif        
/// </summary>
InBlock.gif        
/// <param name="obj">Category对象</param>
ExpandedSubBlockEnd.gif        
/// <returns>返回影响行数</returns>

InBlock.gif        public int UpdateCategory(Category obj)
ExpandedSubBlockStart.gifContractedSubBlock.gif        
dot.gif{
InBlock.gif            DBCommandWrapper dw 
= db.GetStoredProcCommandWrapper("CategoryUpdate_p");
InBlock.gif            dw.AddInParameter(
"@ClassID",DbType.String,obj.ClassID);
InBlock.gif            dw.AddInParameter(
"@ClassName",DbType.String,obj.ClassName);
InBlock.gif            dw.AddInParameter(
"@Sort",DbType.Int32,obj.Sort);
InBlock.gif            dw.AddInParameter(
"@LogoImage",DbType.String,obj.LogoImage);
InBlock.gif            dw.AddInParameter(
"@ClassDetails",DbType.String,obj.ClassDetails);
InBlock.gif            dw.AddInParameter(
"@DateMark",DbType.Binary,obj.DateMark);
InBlock.gif            dw.AddOutParameter(
"@RowCount",DbType.Int32,4);
InBlock.gif            db.ExecuteNonQuery(dw);
InBlock.gif            
int rlt = Convert.ToInt32(dw.GetParameterValue("@RowCount"));
InBlock.gif            db.ClearParameterCache();
InBlock.gif            dw.Dispose();
InBlock.gif            
return rlt;
ExpandedSubBlockEnd.gif        }

InBlock.gif
InBlock.gif
ExpandedSubBlockStart.gifContractedSubBlock.gif        
/**//// <summary>
InBlock.gif        
/// 对Category对象的删除操作
InBlock.gif        
/// </summary>
InBlock.gif        
/// <param name="obj">Category对象</param>
ExpandedSubBlockEnd.gif        
/// <returns>返回影响行数</returns>

InBlock.gif        public int DeleteCategory(Category obj)
ExpandedSubBlockStart.gifContractedSubBlock.gif        
dot.gif{
InBlock.gif            DBCommandWrapper dw 
= db.GetStoredProcCommandWrapper("CategoryDelete_p");
InBlock.gif            dw.AddInParameter(
"@ClassID",DbType.String,obj.ClassID);
InBlock.gif            dw.AddInParameter(
"@DateMark",DbType.Binary,obj.DateMark);
InBlock.gif            dw.AddOutParameter(
"@RowCount",DbType.Int32,4);
InBlock.gif            db.ExecuteNonQuery(dw);
InBlock.gif            
int rlt = Convert.ToInt32(dw.GetParameterValue("@RowCount"));
InBlock.gif            db.ClearParameterCache();
InBlock.gif            dw.Dispose();
InBlock.gif            
return rlt;
ExpandedSubBlockEnd.gif        }

InBlock.gif
ExpandedBlockEnd.gif    }
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值