Ejemplo n.º 1
0
 private DocumentMovements CreateNewEntity()
 {
     DocumentMovements entity = new DocumentMovements();
     entity.Sender = UserDao.Load(CurrentUser.Id);
     entity.CreateDate = DateTime.Now;
     entity.Docs = new List<DocumentMovements_SelectedDocs>();
     return entity;
 }
Ejemplo n.º 2
0
 public int SaveCreateWithoutSendModel(DocumentMovementsEditModel model)
 {
     DocumentMovements entity = new DocumentMovements();
     entity.SendDate = DateTime.Now;
     entity.ReceiverCheckDate = DateTime.Now;
     entity.CreateDate = DateTime.Now;
     entity.Direction = 2;
     entity.StatusId = 3;
     entity.Receiver = UserDao.Load(10);
     entity.ReceiverRuscount = DocumentMovementsRoleRecordsDao.Load(model.SenderRuscount);
     entity.Sender = UserDao.Load(model.User.Id);
     entity.Descript = model.Descript;
     entity.User = entity.Sender;
     entity.Docs = new List<DocumentMovements_SelectedDocs>();
     var newdocs = model.SelectedDocs.Where(x => x.RecieverCheck).ToList();
     foreach (var newdoc in newdocs)
         entity.Docs.Add(new DocumentMovements_SelectedDocs { DocType = DocumentMovements_DocTypesDao.Load(newdoc.Type), Movement = entity, RecieverCheck= true, SenderCheck = true, RecieverCheckDate=DateTime.Now, SenderCheckDate = DateTime.Now });
     DocumentMovementsDao.SaveAndFlush(entity);
     return entity.Id;
 }