public void Handle(AssociateShareClassToDocument message)
        {
            Document document = repository.GetById <Document>(message.DocumentId, int.MaxValue);

            DocumentShareClassAssociation association =
                new DocumentShareClassAssociation(document.Id, message.ShareClassId, ShareClassType.CreateFromString(message.ShareClassType));

            document.AssociateWithShareClass(association);

            repository.Save(document, Guid.NewGuid(), null);
        }
        public void Handle(CreateShareClass message)
        {
            ShareClass share = new ShareClass(message.Id, new Ticker(message.Ticker), ShareClassType.CreateFromString(message.Type));

            repository.Save(share, Guid.NewGuid(), null);
        }
コード例 #3
0
ファイル: AdminController.cs プロジェクト: jsingh/DeepBlue
 public ActionResult UpdateShareClassType(FormCollection collection)
 {
     EditShareClassTypeModel model=new EditShareClassTypeModel();
     ResultModel resultModel=new ResultModel();
     this.TryUpdateModel(model);
     string ErrorMessage=ShareClassAvailable(model.ShareClass,model.ShareClassTypeId);
     if(String.IsNullOrEmpty(ErrorMessage)==false) {
         ModelState.AddModelError("Name",ErrorMessage);
     }
     if(ModelState.IsValid) {
         ShareClassType shareClassType=AdminRepository.FindShareClassType(model.ShareClassTypeId);
         if(shareClassType==null) {
             shareClassType=new ShareClassType();
             shareClassType.CreatedBy=Authentication.CurrentUser.UserID;
             shareClassType.CreatedDate=DateTime.Now;
         }
         shareClassType.ShareClass=model.ShareClass;
         shareClassType.Enabled=model.Enabled;
         shareClassType.EntityID=Authentication.CurrentEntity.EntityID;
         shareClassType.LastUpdatedBy=Authentication.CurrentUser.UserID;
         shareClassType.LastUpdatedDate=DateTime.Now;
         IEnumerable<ErrorInfo> errorInfo=AdminRepository.SaveShareClassType(shareClassType);
         if(errorInfo!=null) {
             resultModel.Result+=ValidationHelper.GetErrorInfo(errorInfo);
         } else {
             resultModel.Result="True||"+shareClassType.ShareClassTypeID;
         }
     } else {
         foreach(var values in ModelState.Values.ToList()) {
             foreach(var err in values.Errors.ToList()) {
                 if(string.IsNullOrEmpty(err.ErrorMessage)==false) {
                     resultModel.Result+=err.ErrorMessage+"\n";
                 }
             }
         }
     }
     return View("Result",resultModel);
 }