📄 vendoraccessor.cs
字号:
using System.Collections;
using System.Collections.Generic;
using Mied.BusinessObject;
using Mied.DAL.Cache;
using System.Data.Common;
using CommonUtil;
namespace Mied.DAL.Accesses
{
public class VendorAccessor : ContactAccessor
{
public VendorAccessor(MiedDatabase database)
: base(database, typeof(Vendor), ContactType.Vendor)
{
}
public Vendor SelectVendor(int id)
{
return (Vendor)base.Select(id);
}
public Vendor SelectVendor(ContactKey contactKey)
{
return (Vendor)base.SelectContact(contactKey);
}
public VendorList SelectVendorList()
{
return (VendorList)SelectList();
}
protected override IList CreateEntityList()
{
return new VendorList();
}
protected override IList CreateCacheListObject()
{
return new VendorCacheList(this);
}
protected override void SaveAfter(Entity entity, Entity entityOld, DbTransaction transaction)
{
base.SaveAfter(entity, entityOld, transaction);
if (null == entityOld) //insert action
{
Vendor vendor = (Vendor)entity;
string strLastActivity = CommonHelper.LastActivity_VendorCreated;
string strNote = vendor.Note;
CommonHelper.ConstructLastActivityAndNote(ref strLastActivity, ref strNote);
if (vendor.VendorCreditLimit != 0)
{
strLastActivity = string.Format(CommonHelper.LastActivity_VendorCreditLimit, vendor.VendorCreditLimit);
CommonHelper.ConstructLastActivityAndNote(ref strLastActivity, ref strNote);
}
if (vendor.VendorDiscount != 0)
{
strLastActivity = string.Format(CommonHelper.LastActivity_VendorDiscount, vendor.VendorDiscount);
CommonHelper.ConstructLastActivityAndNote(ref strLastActivity, ref strNote);
}
this.UpdateLastActivity(vendor.ID.Value, strLastActivity, strNote, transaction);
}
else //update action
{
Vendor vendor = (Vendor)entity;
Vendor vendorOld = (Vendor)entityOld;
string strLastActivity = "";
string strNote = vendor.Note;
if (vendor.VendorCreditLimit != vendorOld.VendorCreditLimit)
{
strLastActivity = string.Format(CommonHelper.LastActivity_VendorCreditLimit, vendor.VendorCreditLimit);
CommonHelper.ConstructLastActivityAndNote(ref strLastActivity, ref strNote);
}
if (vendor.VendorDiscount != vendorOld.VendorDiscount)
{
strLastActivity = string.Format(CommonHelper.LastActivity_VendorDiscount, vendor.VendorDiscount);
CommonHelper.ConstructLastActivityAndNote(ref strLastActivity, ref strNote);
}
if (!string.IsNullOrEmpty(strLastActivity))
{
this.UpdateLastActivity(vendor.ID.Value, strLastActivity, strNote, transaction);
}
}
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -