示例#1
0
        public void UpdatePositionIm(PositionIm positionIm, OrderPositionData opd, DbTransaction dbTran)
        {
            if (NeedReCreatePositionIm(positionIm, opd.FormatData.Id))
            {
                DeletePositionIm(positionIm, dbTran);
                CreatePositionIm(positionIm.OrderPosition.Order.BusinessUnitId, opd.OrderId, opd.OrderPositionId, opd, dbTran);
                return;
            }

            if (_stringProcessor.CanUpdateString(positionIm))
            {
                positionIm = _repository.SetPositionIm(positionIm, newTaskFile: false, newMaketFile: false, isActual: true, dbTran);
                _stringProcessor.UpdateFullString(positionIm.OrderPositionId, opd.StringData, dbTran);
            }

            if (_moduleMaketProcessor.CanUpdateModule(positionIm))
            {
                positionIm = _repository.SetPositionIm(positionIm, newTaskFile: true, newMaketFile: false, isActual: true, dbTran);

                // Обновляем графические материалы позиции ИМ-а
                var taskFileDate = (DateTime)positionIm.TaskFileDate;
                var bytes        = Base64ToBytesConverter.Convert(opd.ModuleData.Base64String);

                _moduleMaketProcessor.CreateSampleImage(positionIm.OrderPositionId, bytes, "ImgTask", taskFileDate);
                _moduleMaketProcessor.UpdateModuleGraphics(positionIm.OrderPositionId, bytes, opd.ModuleData.Name);
            }
        }
示例#2
0
        public PositionIm Create(int orderId, int orderPositionId, int positionImTypeId)
        {
            var positionIm = new PositionIm
            {
                OrderId          = orderId,
                OrderPositionId  = orderPositionId,
                PositionImTypeId = positionImTypeId,
                ParentPositionId = null,
                MaketStatusId    = 1, // 1 - Черновик, 4 - Готово
                MaketCategoryId  = 2,
                Text             = string.Empty,
                Comments         = string.Empty,
                Url                       = string.Empty,
                DistributionUrl           = string.Empty,
                LegalPersonPersonalDataId = null,
                Xml                       = null,
                Rating                    = 0,
                RatingDescription         = string.Empty,
                TaskFileDate              = null,
                MaketFileDate             = null,
                DontVerify                = false,
                RdvRating                 = false,
                BeginDate                 = DateTime.Now
            };

            return(positionIm);
        }
示例#3
0
        public void DeletePositionIm(PositionIm positionIm, DbTransaction dbTran)
        {
            if (positionIm == null)
            {
                return;
            }

            _stringProcessor.DeleteFullString(positionIm.OrderPositionId, dbTran);
            _moduleProcessor.DeleteModule(positionIm.OrderPositionId, dbTran);
            _moduleMaketProcessor.DeleteModuleGraphics(positionIm.OrderPositionId);

            _repository.SetPositionIm(positionIm, newTaskFile: false, newMaketFile: false, isActual: false, dbTran);
            _context.Entry(positionIm).Reload();

            var orderIm = _orderImProcessor.GetOrderIm(positionIm.OrderId, positionIm.PositionImType.OrderImTypeId);

            if (_orderImProcessor.NeedDeleteOrderIm(orderIm))
            {
                _orderImProcessor.DeleteOrderIm(orderIm, dbTran);
            }
            else
            {
                _orderImProcessor.UpdateOrderIm(orderIm, dbTran);
            }
        }
示例#4
0
        public PositionIm UpdatePositionIm(PositionIm positionIm, int orderId, int maketStatusId, DbTransaction dbTran)
        {
            positionIm.OrderId       = orderId;       // Меняем заказ позиции ИМ-а
            positionIm.MaketStatusId = maketStatusId; // Меняем статус позиции ИМ-а на "Вёрстка"
            positionIm = _repository.SetPositionIm(positionIm, newTaskFile: false, newMaketFile: false, isActual: true, dbTran);

            return(positionIm);
        }
        public PositionIm SetPositionIm(
            PositionIm positionIm,
            bool newTaskFile, bool newMaketFile,
            bool isActual, DbTransaction dbTran)
        {
            DateTime?taskFileDate  = positionIm.TaskFileDate;
            DateTime?maketFileDate = positionIm.MaketFileDate;

            var lastEditDate = DateTime.Now;

            SetPositionIm(
                dbTran: dbTran,
                orderId: positionIm.OrderId,
                orderPositionId: positionIm.OrderPositionId,
                positionImTypeId: positionIm.PositionImTypeId,
                parentPositionId: positionIm.ParentPositionId,
                maketStatusId: positionIm.MaketStatusId,
                maketCategoryId: positionIm.MaketCategoryId,
                text: positionIm.Text,
                comments: positionIm.Comments,
                url: positionIm.Url,
                distributionUrl: positionIm.DistributionUrl,
                legalPersonPersonalDataId: positionIm.LegalPersonPersonalDataId,
                xml: positionIm.Xml,
                rating: positionIm.Rating,
                ratingDescription: positionIm.RatingDescription,
                newTaskFile: newTaskFile,
                newMaketFile: newMaketFile,
                taskFileDate: ref taskFileDate,
                maketFileDate: ref maketFileDate,
                dontVerify: positionIm.DontVerify,
                rdvRating: positionIm.RdvRating,
                isActual: isActual,
                lastEditDate: ref lastEditDate,
                editUserId: _editUserId);

            positionIm.TaskFileDate  = taskFileDate;
            positionIm.MaketFileDate = maketFileDate;
            positionIm.BeginDate     = lastEditDate;

            return(positionIm);
        }
示例#6
0
 public bool CanUpdateString(PositionIm positionIm)
 {
     return(positionIm != null && positionIm.PositionImType.OrderImTypeId == 1);
 }
示例#7
0
 private bool NeedReCreatePositionIm(PositionIm positionIm, int pricePositionId)
 {
     return(positionIm != null && positionIm.OrderPosition.PricePositionId != pricePositionId);
 }
示例#8
0
 public bool CanUpdateModule(PositionIm positionIm)
 {
     return(positionIm != null && (positionIm.TaskFileDate != null || positionIm.MaketFileDate != null));
 }