Skip to content

Instantly share code, notes, and snippets.

View ArnisL's full-sized avatar
🦊

Arnis Lapsa ArnisL

🦊
View GitHub Profile
/// <summary>
/// Validates that record is found in Aleph by GetDigitalObjectFromAleph method
/// or user has processed it.
/// Filters records which were not found in Aleph by GetDigitalObjectFromAleph method
/// and not processed by user.
/// </summary>
/// <param name="codeTableCode">The code table code.</param>
/// <param name="value">The value.</param>
/// <param name="elementId">The element id.</param>
/// <param name="elementName">Name of the element.</param>
protected override void ExecuteInContext(IUnitOfWorkContext context, RegisterNewAffairCmd cmd)
{
var affair=Affair.RegisterAffair(cmd.AffairId, cmd.Name, cmd.Location);
//how to save it? :/
context.
_repository.Save(affair);
context.Accept();
}
namespace Web.Bootstrap {
using CommandHandlers;
using Microsoft.Practices.ServiceLocation;
using MvcExtensions;
using Ncqrs;
using Ncqrs.Commanding.ServiceModel;
using Ncqrs.Config.StructureMap;
using Ncqrs.Domain;
using Ncqrs.Domain.Storage;
using Ncqrs.Eventing.ServiceModel.Bus;
namespace Interreg.Config{
using System;
using System.IO;
using Domain;
using FluentNHibernate.Automapping;
using FluentNHibernate.Cfg;
using FluentNHibernate.Cfg.Db;
using FluentNHibernate.Conventions.Helpers;
using NHibernate;
using NHibernate.Context;
namespace Interreg.Web.Bootstrap{
using System;
using Config;
using Microsoft.Practices.ServiceLocation;
using MvcExtensions;
using NHibernate;
using NHibernate.Context;
using StructureMap;
public class NHibernateTask:BootstrapperTask{
private readonly IContainer _container;
namespace MyProject.Web.Binders{
using System.Web.Mvc;
using Domain;
public class RootBinder<TRoot,TRepository>:DefaultModelBinder
where TRepository:IRepository<TRoot> where TRoot:IRoot{
private readonly TRepository _repository;
public RootBinder(TRepository repository){
Guard.AgainstNull(repository);
_repository=repository;
}
namespace MyProject.Web.Binders{
using System.Web.Mvc;
using Domain;
public class RootBinder<TRoot,TRepository>:DefaultModelBinder
where TRepository:IRepository<TRoot> where TRoot:IRoot{
private readonly TRepository _repository;
public RootBinder(TRepository repository){
Guard.AgainstNull(repository);
_repository=repository;
}
if ((sTemp.IndexOf(".") == -1) && (sTemp.Length >= 1) &&
(sTemp.ToUpper().IndexOf("N") == -1) && (sTemp.IndexOf("-") == -1))
{
invRow.AT13 = true;
}
else
{
invRow.AT13 = false;
}
sTemp =
[HttpPost]
public ActionResult ReceivePaperVersion(Application a,ReceivePaperVersionInput inp){
var r=new Func<ActionResult>(()=>RedirectToAction("Details",new {a.Id}));
return this.Do(
()=>{
a.ReceivePaperVersion(inp.PaperVersionSendDate.Value,inp.PaperVersionArrivalDate.Value);
this.Flash("Application paper version received!");
return r();
},r); //1st arg==happy path, 2nd arg==onFail
}
//class Application {
public virtual void ReceivePaperVersion(DateTime sendDate,DateTime arrivalDate){
if(Statuses.ApplicationStatus!=ApplicationStatus.ReceivedElectronically)
throw new ApplicationException
("Paper version can be received only right after electronic version is received.");
var d=Call.ApplicationDeadlines;
if(sendDate>d.PaperVersionSendDeadline)
throw new ApplicationException("Send date exceeds call deadline");
if(arrivalDate>d.PaperVersionArrivalDeadline)
throw new ApplicationException("Arrival date exceeds call deadline");