当前位置: 首页>>代码示例>>C#>>正文


C# Data.DbManager类代码示例

本文整理汇总了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);
                }
            }
        }
开发者ID:DennisPitallano,项目名称:IRMS-MARKETING,代码行数:32,代码来源:CustomerPriceAgreementManager.cs

示例2: Delete

 public void Delete(Forwarder FORWARDER)
 {
     using (DbManager db = new DbManager())
     {
         Accessor.Query.Delete(db, FORWARDER);
     }
 }
开发者ID:DennisPitallano,项目名称:IRMS-WAREHOUSE,代码行数:7,代码来源:ForwarderManager.cs

示例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;
		}
开发者ID:MozgC,项目名称:bltoolkit,代码行数:33,代码来源:SqlQueryInfo.cs

示例4: TearDown

 protected override void TearDown()
 {
     using (var dbManager = new DbManager("PerformanceTest"))
         dbManager
             .SetCommand("TRUNCATE TABLE Simplests")
             .ExecuteNonQuery();
 }
开发者ID:sdanyliv,项目名称:ormbattle,代码行数:7,代码来源:BLToolkitTest.cs

示例5: Save

 public void Save(PricePoint Object)
 {
     using (DbManager dbm = new DbManager())
     {
         Accessor.Query.Insert(dbm, Object);
     }
 }
开发者ID:DennisPitallano,项目名称:IRMS-MARKETING,代码行数:7,代码来源:PricePointManager.cs

示例6: DeleteRequest

 public void DeleteRequest(PulloutHeader PH)
 {
     using (DbManager db = new DbManager())
     {
         Accessor.Query.Delete(db, PH);
     }
 }
开发者ID:DennisPitallano,项目名称:IRMS-WAREHOUSE,代码行数:7,代码来源:PulloutHeaderManager.cs

示例7: DeleteByMemoID

 public void DeleteByMemoID(int MemoID)
 {
     using (DbManager dbm = new DbManager())
     {
         dbm.SetCommand(string.Format("DELETE FROM GENMEMODTL WHERE GENMEMOID = {0}", MemoID)).ExecuteNonQuery();
     }
 }
开发者ID:DennisPitallano,项目名称:IRMS-MARKETING,代码行数:7,代码来源:GeneralMemoConcessionDetailManager.cs

示例8: Delete

 public void Delete(Message Message)
 {
     using (DbManager dbm = new DbManager())
     {
         Accessor.Query.Delete(dbm, Message);
     }
 }
开发者ID:DennisPitallano,项目名称:IRMS-ACCOUNTING,代码行数:7,代码来源:MessageManager.cs

示例9: Messages

 public List<Message> Messages()
 {
     using (DbManager dbm = new DbManager())
     {
         return Accessor.Query.SelectAll<Message>(dbm);
     }
 }
开发者ID:DennisPitallano,项目名称:IRMS-ACCOUNTING,代码行数:7,代码来源:MessageManager.cs

示例10: Delete

 public void Delete(Memo memo)
 {
     using (DbManager db = new DbManager())
     {
         Accessor.Query.Delete(db, memo);
     }
 }
开发者ID:DennisPitallano,项目名称:IRMS-ACCOUNTING,代码行数:7,代码来源:MemoManager.cs

示例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));
			}
		}
开发者ID:MajidSafari,项目名称:bltoolkit,代码行数:29,代码来源:ObjectFactory.cs

示例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>();
		}
开发者ID:MajidSafari,项目名称:bltoolkit,代码行数:9,代码来源:SetCommand.cs

示例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]*/);
			}
		}
开发者ID:MajidSafari,项目名称:bltoolkit,代码行数:25,代码来源:Parameter.cs

示例14: Delete

 public void Delete(DeliveryReceipt DeliveryReceipt)
 {
     using (DbManager db = new DbManager())
     {
         Accessor.Query.Delete(db, DeliveryReceipt);
     }
 }
开发者ID:DennisPitallano,项目名称:IRMS-WAREHOUSE,代码行数:7,代码来源:DeliveryReceiptManager.cs

示例15: ConfirmCustomerReturnSlip

 public void ConfirmCustomerReturnSlip(CustomerReturnSlipConfirmation crs)
 {
     using (DbManager dbm = new DbManager())
     {
         Accessor.Query.Insert(dbm, crs);
     }
 }
开发者ID:DennisPitallano,项目名称:IRMS-WAREHOUSE,代码行数:7,代码来源:CustomerReturnSlipManager.cs


注:本文中的BLToolkit.Data.DbManager类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。