本文整理汇总了C#中ICustomerRepository.Add方法的典型用法代码示例。如果您正苦于以下问题:C# ICustomerRepository.Add方法的具体用法?C# ICustomerRepository.Add怎么用?C# ICustomerRepository.Add使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ICustomerRepository
的用法示例。
在下文中一共展示了ICustomerRepository.Add方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: TestInit
public void TestInit() {
_customerRepository = Ioc.Create<ICustomerRepository>();
_customerRepository.Clear();
_customerA = Customer.GetCustomerA();
_customerB = Customer.GetCustomerB();
_customerRepository.Add( _customerA );
_customerRepository.Add( _customerB );
}
示例2: TestInit
public void TestInit() {
//添加测试数据
_customerRepository = Ioc.Create<ICustomerRepository>();
_customerRepository.Clear();
_customerRepository.Add( Customer.GetCustomerA() );
_customerRepository.Add( Customer.GetCustomerB() );
//创建查询对象
_query = new Query<Customer, int>();
}
示例3: TestInit
public void TestInit() {
//设置基础数据
_customerRepository = Ioc.Create<ICustomerRepository>();
_customerRepository.Clear();
_customerRepository.Add( Customer.GetCustomerA() );
_customerRepository.Add( Customer.GetCustomerB() );
_customerRepository.Add( Customer.GetCustomerC() );
//设置查询
_queryable = _customerRepository.Find();
}
示例4: TestInit
public void TestInit() {
//添加测试数据
_customerRepository = Ioc.Create<ICustomerRepository>();
_customerRepository.Clear();
for( int i = 0; i < 6; i++ ) {
_customerRepository.Add( Customer.GetCustomerA() );
_customerRepository.Add( Customer.GetCustomerB() );
_customerRepository.Add( Customer.GetCustomerC() );
}
//创建查询对象
_query = new Query<Customer, int>();
_query.PageSize = 3;
_query.OrderBy( t => t.Name );
}
示例5: UpdateContactLabels
private void UpdateContactLabels(ICustomerRepository repository)
{
//delete old values
var originalValues = CurrentCustomer.Labels.ToList();
foreach (var labelItem in originalValues)
{
if (CustomerDetailViewModel.ContactLabels.All(l => l.LabelId != labelItem.LabelId))
{
if (CurrentCustomer == null)
break;
CurrentCustomer.Labels.Remove(labelItem);
repository.Attach(labelItem);
repository.Remove(labelItem);
}
}
//add new values
foreach (var labelItem in CustomerDetailViewModel.ContactLabels)
{
if (_originalContact.Labels.All(l => l.LabelId != labelItem.LabelId))
{
if (CurrentCustomer == null)
break;
labelItem.MemberId = CurrentCustomer.MemberId;
repository.Add(labelItem);
CurrentCustomer.Labels.Add(labelItem);
}
}
repository.UnitOfWork.Commit();
}
示例6: UpdateCaseLabels
private void UpdateCaseLabels(ICustomerRepository repository)
{
//delete old values
var originalLabels = InnerItem.Labels.ToList();
foreach (var labelItem in originalLabels)
{
if (CaseDetailViewModel.CaseLabelList.All(l => l.LabelId != labelItem.LabelId))
{
InnerItem.Labels.Remove(labelItem);
repository.Attach(labelItem);
repository.Remove(labelItem);
}
}
//add new values
foreach (var labelItem in CaseDetailViewModel.CaseLabelList)
{
if (_originalItem.Labels.All(l => l.LabelId != labelItem.LabelId))
{
labelItem.CaseId = InnerItem.CaseId;
repository.Add(labelItem);
InnerItem.Labels.Add(labelItem);
}
}
repository.UnitOfWork.Commit();
}
示例7: GetNotesToCaseFromCaseCommunications
/// <summary>
/// add notes to InnerItem from CaseCommunicationViewModel
/// </summary>
private void GetNotesToCaseFromCaseCommunications(ICustomerRepository repository)
{
var adaptor = new CommunicationAdaptor();
if (CaseCommunications != null && CaseCommunications.Items != null)
{
var result = new List<Note>();
result = result.Union(CaseCommunications.Items
.Where(n => n.Type == CommunicationItemType.Note)
.Where(
n =>
n.State !=
CommunicationItemState.Deleted)
.Select(
n =>
adaptor.NoteCommunicationViewModel2Note(
n as CommunicationItemNoteViewModel))).ToList();
foreach (var note in result)
{
var noteForUpdate = CaseNotes.SingleOrDefault(caseNote => caseNote.NoteId == note.NoteId);
if (noteForUpdate == null)
{
note.CaseId = InnerItem.CaseId;
CaseNotes.Add(note);
repository.Add(note);
}
}
//if messsage was writed in textbox, but Enter was not pressed
//then create new noteItem and save it;
if (!string.IsNullOrEmpty(CaseCommunications.NewBody))
{
var activeCommand = CaseCommunications.ToolBarCommmands.SingleOrDefault(c => c.IsActive);
if ((CommunicationItemType)activeCommand.CommandParametr == CommunicationItemType.Note)
{
var note = new Note
{
AuthorName = _authorName,
Body = CaseCommunications.NewBody,
Title = InnerItem.Title,
Created = (DateTime.SpecifyKind(DateTime.Now, DateTimeKind.Local)).ToUniversalTime(),
CaseId = InnerItem.CaseId
};
note.LastModified = note.Created;
CaseNotes.Add(note);
repository.Add(note);
}
OnUIThread(() =>
{
if (activeCommand != null)
{
activeCommand.Command.Execute(CaseCommunications.NewBody);
}
});
}
}
}
示例8: GetCommunicationItemsFromCaseCommunications
/// <summary>
/// Add communication item to CurrentCase
/// </summary>
/// <returns></returns>
private void GetCommunicationItemsFromCaseCommunications(ICustomerRepository repository)
{
var adaptor = new CommunicationAdaptor();
if (CaseCommunications != null && CaseCommunications.Items != null)
{
var result = new List<CommunicationItem>();
result = result.Union(CaseCommunications.Items
.Where(item => item.Type == CommunicationItemType.PublicReply)
.Where(item => item.State != CommunicationItemState.Deleted)
.Select(
item =>
adaptor.PublicReplyViewModel2PublicReplyItem(
item as CommunicationItemPublicReplyViewModel))).ToList();
foreach (var item in result)
{
var itemForUpdate =
CaseCommunicationItems.SingleOrDefault(
comItem => comItem.CommunicationItemId == item.CommunicationItemId);
if (itemForUpdate == null)
{
item.CaseId = InnerItem.CaseId;
CaseCommunicationItems.Add(item);
repository.Add(item);
}
}
//if messsage was writed in textbox, but Enter was not pressed
//then create new publicReplyItem and save it;
if (!string.IsNullOrEmpty(CaseCommunications.NewBody))
{
var activeCommand = CaseCommunications.ToolBarCommmands.SingleOrDefault(c => c.IsActive);
if ((CommunicationItemType)activeCommand.CommandParametr == CommunicationItemType.PublicReply)
{
PublicReplyItem publicReplyItem = new PublicReplyItem();
publicReplyItem.AuthorName = _authorName;
publicReplyItem.Body = CaseCommunications.NewBody;
publicReplyItem.Title = InnerItem.Title;
publicReplyItem.Created =
(DateTime.SpecifyKind(DateTime.Now, DateTimeKind.Local)).ToUniversalTime();
publicReplyItem.LastModified = publicReplyItem.Created;
publicReplyItem.CaseId = InnerItem.CaseId;
CaseCommunicationItems.Add(publicReplyItem);
repository.Add(publicReplyItem);
}
OnUIThread(() =>
{
if (activeCommand != null)
{
activeCommand.Command.Execute(CaseCommunications.NewBody);
}
});
}
}
}