本文整理汇总了C#中BLToolkit.Data.DbManager类的典型用法代码示例。如果您正苦于以下问题:C# DbManager类的具体用法?C# DbManager怎么用?C# DbManager使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
DbManager类属于BLToolkit.Data命名空间,在下文中一共展示了DbManager类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Save
public void Save(CustomerPriceAgreement PriceAgreement)
{
PriceAgreement.AccountCode = account.AccountCode;
PriceAgreement.BranchCode = branch.BranchCode;
PriceAgreement.BrandCode = brand.BrandCode;
//TEMPORARY DATE AND USER SAVING
PriceAgreement.DateCreated = DateTime.Now;
PriceAgreement.CreatedBy = "SYSTEM";
PriceAgreement.ModifiedBy = "SYSTEM";
PriceAgreement.DateModified = DateTime.Now;
//TEMPORARY DATE AND USER SAVING
using (DbManager db = new DbManager())
{
try
{
if (PriceAgreement.RecordNo != 0)
{
Accessor.Query.Update(db, PriceAgreement);
}
else
{
Accessor.Query.Insert(db, PriceAgreement);
}
}
catch (Exception except)
{
throw new System.ArgumentException(except.Message);
}
}
}
示例2: Delete
public void Delete(Forwarder FORWARDER)
{
using (DbManager db = new DbManager())
{
Accessor.Query.Delete(db, FORWARDER);
}
}
示例3: GetParameters
public IDbDataParameter[] GetParameters(DbManager db, object obj)
{
var parameters = new IDbDataParameter[_parameters.Count];
for (var i = 0; i < _parameters.Count; i++)
{
var info = _parameters[i];
//parameters[i] = db.Parameter(info.ParameterName, info.MemberMapper.GetValue(obj));
var mmi = info.MemberMapper.MapMemberInfo;
var val = info.MemberMapper.GetValue(obj);
if (val == null && mmi.Nullable/* && mmi.NullValue == null*/)
{
//replace value with DbNull
val = DBNull.Value;
}
if (mmi.IsDbTypeSet)
{
parameters[i] = mmi.IsDbSizeSet
? db.Parameter(info.ParameterName, val, info.MemberMapper.DbType, mmi.DbSize)
: db.Parameter(info.ParameterName, val, info.MemberMapper.DbType);
}
else
{
parameters[i] = db.Parameter(info.ParameterName, val);
}
}
return parameters;
}
示例4: TearDown
protected override void TearDown()
{
using (var dbManager = new DbManager("PerformanceTest"))
dbManager
.SetCommand("TRUNCATE TABLE Simplests")
.ExecuteNonQuery();
}
示例5: Save
public void Save(PricePoint Object)
{
using (DbManager dbm = new DbManager())
{
Accessor.Query.Insert(dbm, Object);
}
}
示例6: DeleteRequest
public void DeleteRequest(PulloutHeader PH)
{
using (DbManager db = new DbManager())
{
Accessor.Query.Delete(db, PH);
}
}
示例7: DeleteByMemoID
public void DeleteByMemoID(int MemoID)
{
using (DbManager dbm = new DbManager())
{
dbm.SetCommand(string.Format("DELETE FROM GENMEMODTL WHERE GENMEMOID = {0}", MemoID)).ExecuteNonQuery();
}
}
示例8: Delete
public void Delete(Message Message)
{
using (DbManager dbm = new DbManager())
{
Accessor.Query.Delete(dbm, Message);
}
}
示例9: Messages
public List<Message> Messages()
{
using (DbManager dbm = new DbManager())
{
return Accessor.Query.SelectAll<Message>(dbm);
}
}
示例10: Delete
public void Delete(Memo memo)
{
using (DbManager db = new DbManager())
{
Accessor.Query.Delete(db, memo);
}
}
示例11: Test
public void Test()
{
using (DbManager db = new DbManager())
{
List<Person> list = db
.SetCommand(@"
SELECT
ps.*,
d.Taxonomy,
p.Diagnosis,
CASE
WHEN d.PersonID IS NOT NULL THEN 'D'
WHEN p.PersonID IS NOT NULL THEN 'P'
END as PersonType
FROM
Person ps
LEFT JOIN Doctor d ON d.PersonID = ps.PersonID
LEFT JOIN Patient p ON p.PersonID = ps.PersonID
ORDER BY
ps.PersonID")
.ExecuteList<Person>();
Assert.AreEqual(list[0].GetType(), /*[a]*/typeof(Doctor)/*[/a]*/);
Assert.AreEqual(list[1].GetType(), /*[a]*/typeof(Patient)/*[/a]*/);
if (list.Count > 2)
Assert.AreEqual(list[2].GetType(), typeof(Person));
}
}
示例12: GetPersonByID
// Insert, Update, and Delete a person.
//
public Person GetPersonByID(DbManager db, int id)
{
return db
./*[a]*/SetCommand/*[/a]*/("SELECT * FROM Person WHERE PersonID = @id",
db./*[a]*/Parameter/*[/a]*/("@id", id))
.ExecuteObject<Person>();
}
示例13: OutputParameterTest
public void OutputParameterTest()
{
using (DbManager db = new DbManager())
{
/*
* CREATE Procedure Scalar_OutputParameter
* @outputInt int = 0 output,
* @outputString varchar(50) = '' output
* AS
* BEGIN
* SET @outputInt = 12345
* SET @outputString = '54321'
* END
*/
db
.SetSpCommand("Scalar_OutputParameter",
db./*[a]*/OutputParameter/*[/a]*/("@outputInt", 1),
db./*[a]*/OutputParameter/*[/a]*/("@outputString", "1"))
.ExecuteNonQuery();
Assert.AreEqual(12345, (int) db./*[a]*/Parameter("@outputInt"). Value/*[/a]*/);
Assert.AreEqual("54321", (string)db./*[a]*/Parameter("@outputString").Value/*[/a]*/);
}
}
示例14: Delete
public void Delete(DeliveryReceipt DeliveryReceipt)
{
using (DbManager db = new DbManager())
{
Accessor.Query.Delete(db, DeliveryReceipt);
}
}
示例15: ConfirmCustomerReturnSlip
public void ConfirmCustomerReturnSlip(CustomerReturnSlipConfirmation crs)
{
using (DbManager dbm = new DbManager())
{
Accessor.Query.Insert(dbm, crs);
}
}