示例#1
0
        /// <summary>
        /// Сохраняет в базе модель создания элемента.
        /// </summary>
        /// <param name="token">Токен безопасности.</param>
        /// <param name="model">Модель создания сущности для сохранения.</param>
        /// <param name="result">Результат с ошибками.</param>
        public override void SaveCreateModel(SecurityToken token, TransferDocCreateModel model, GridSaveModelResult result)
        {
            var entity = new TransferDoc
            {
                CreatorID            = token.User.UserID,
                DocDate              = model.DocDate,
                DocDescription       = model.DocDescription,
                DocNumber            = model.DocNumber,
                RecipientWarehouseID = model.RecipientWarehouseID,
                SenderWarehouseID    = model.SenderWarehouseID,
                TransferDocID        = model.TransferDocID
            };

            RemontinkaServer.Instance.EntitiesFacade.SaveTransferDoc(token, entity);
        }
        /// <summary>
        /// Сохраняет в базе модель создания элемента.
        /// </summary>
        /// <param name="token">Токен безопасности.</param>
        /// <param name="model">Модель создания сущности для сохранения.</param>
        /// <param name="result">Результат выполнения..</param>
        public override TransferDocGridItemModel SaveCreateModel(SecurityToken token, TransferDocCreateModel model, JGridSaveModelResult result)
        {
            var entity = new TransferDoc
            {
                CreatorID            = token.User.UserID,
                DocDate              = model.DocDate,
                DocDescription       = model.DocDescription,
                DocNumber            = model.DocNumber,
                RecipientWarehouseID = model.RecipientWarehouseID,
                SenderWarehouseID    = model.SenderWarehouseID,
                TransferDocID        = model.Id
            };

            RemontinkaServer.Instance.EntitiesFacade.SaveTransferDoc(token, entity);

            var item = RemontinkaServer.Instance.EntitiesFacade.GetTransferDoc(token, entity.TransferDocID);

            return(CreateModel(item));
        }