예제 #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
        private bool NeedUpdateStringPosition(StringPosition stringPosition, StringData stringData)
        {
            if (stringPosition.Date != stringData.Date ||
                stringPosition.AnonymousCompanyName != stringData.AnonymousCompanyName ||
                stringPosition.VacancyName != stringData.VacancyName ||
                stringPosition.VacancyAdditional != stringData.VacancyAdditional ||
                stringPosition.Requirement != stringData.RequirementsData.Value ||
                stringPosition.AgeFrom != stringData.RequirementsData.AgeData.From ||
                stringPosition.AgeTo != stringData.RequirementsData.AgeData.To ||
                stringPosition.GenderId != stringData.RequirementsData.GenderId ||
                stringPosition.EducationId != stringData.RequirementsData.EducationId ||
                stringPosition.CitizenshipId != stringData.RequirementsData.CitizenshipId ||
                stringPosition.ExperienceId != stringData.RequirementsData.ExperienceData.Id ||
                stringPosition.ExperienceValue != stringData.RequirementsData.ExperienceData.Value ||
                stringPosition.Responsibility != stringData.Responsibility ||
                stringPosition.Condition != stringData.ConditionsData.Value ||
                stringPosition.WorkGraphicId != stringData.ConditionsData.WorkGraphicData.Id ||
                stringPosition.WorkGraphic != stringData.ConditionsData.WorkGraphicData.Comment ||
                stringPosition.SalaryFrom != stringData.ConditionsData.SalaryData.From ||
                stringPosition.SalaryTo != stringData.ConditionsData.SalaryData.To ||
                stringPosition.SalaryDescription != stringData.ConditionsData.SalaryData.Description ||
                stringPosition.IsSalaryPercent != stringData.ConditionsData.SalaryData.IsSalaryPercent ||
                stringPosition.ContactFirstName != stringData.ContactData.FirstName ||
                stringPosition.IsFood != stringData.ConditionsData.IsFood ||
                stringPosition.IsHousing != stringData.ConditionsData.IsHousing ||
                stringPosition.ContactSecondName != stringData.ContactData.SecondName ||
                stringPosition.ContactLastName != stringData.ContactData.LastName ||
                stringPosition.Logo != Base64ToBytesConverter.Convert(stringData.LogoData.Base64String) ||
                stringPosition.LogoFileName != stringData.LogoData.FileName)
            {
                return(true);
            }

            return(false);
        }
예제 #3
0
        private void DrawBackground(string base64)
        {
            var bytes = Base64ToBytesConverter.Convert(base64);

            using (var stream = new MemoryStream(bytes))
            {
                var image = Image.FromStream(stream);

                using (var g = Graphics.FromImage(_bitmap))
                {
                    g.DrawImage(image, 0, 0, _bitmap.Width, _bitmap.Height);
                }
            }
        }
예제 #4
0
        public StringPosition Create(int businessUnitId, int companyId, int orderPositionId, StringData stringData)
        {
            var stringPosition = new StringPosition
            {
                Id                   = 0,                                                // Идентификатор строки
                CompanyId            = companyId,                                        // Идентификатор компании
                OrderPositionId      = orderPositionId,
                AnonymousCompanyName = stringData.AnonymousCompanyName,                  // Название компании для анонимных вакансий
                BusinessUnitId       = businessUnitId,                                   // Идентификатор бизнес еденицы
                Date                 = null,                                             // Дата создания строки
                VacancyName          = stringData.VacancyName,                           // Название вакансии
                VacancyAdditional    = stringData.VacancyAdditional,                     // Дополнение к названию вакансии
                VacancyCode          = null,                                             // Код вакансии
                Responsibility       = stringData.Responsibility,                        // Обязаности
                Requirement          = stringData.RequirementsData.Value,                // Требования
                AgeFrom              = stringData.RequirementsData.AgeData.From,         // Возраст от
                AgeTo                = stringData.RequirementsData.AgeData.To,           // Возраст до
                GenderId             = stringData.RequirementsData.GenderId,             // Идентификатор пола
                EducationId          = stringData.RequirementsData.EducationId,          // Идентификатор образования
                ExperienceId         = stringData.RequirementsData.ExperienceData.Id,    // Идентификатор опыта работы
                ExperienceValue      = stringData.RequirementsData.ExperienceData.Value, // Значение опыта
                CitizenshipId        = stringData.RequirementsData.CitizenshipId,        // Идентификатор гражданства
                Condition            = stringData.ConditionsData.Value,                  // Условия
                SalaryFrom           = stringData.ConditionsData.SalaryData.From,        // Доход от
                SalaryTo             = stringData.ConditionsData.SalaryData.To,          // Доход до
                SalaryDescription    = stringData.ConditionsData.SalaryData.Description, // Примечание к уровню дохода
                CurrencyId           = stringData.ConditionsData.SalaryData.CurrencyId,  // Идентификатор валюты
                WorkGraphicId        = stringData.ConditionsData.WorkGraphicData.Id,     // Идентификатор графика работы
                WorkGraphic          = stringData.ConditionsData.WorkGraphicData.Comment,
                Keywords             = null,                                             // Ключевые слова
                Logo                 = Base64ToBytesConverter.Convert(stringData.LogoData.Base64String),
                LogoFileName         = stringData.LogoData.FileName,
                ContactFirstName     = stringData.ContactData.FirstName,                     // Имя контактного лица
                ContactSecondName    = stringData.ContactData.SecondName,                    // Оотчество контактного лица
                ContactLastName      = stringData.ContactData.LastName,                      // Фамилия контактного лица
                Text                 = null,                                                 // изначальный текст
                IsSalaryPercent      = stringData.ConditionsData.SalaryData.IsSalaryPercent, // Процент с продаж
                IsHousing            = stringData.ConditionsData.IsHousing,                  // Предоставляется общежитие
                IsFood               = stringData.ConditionsData.IsFood,                     // Предоставляются обеды
                BeginDate            = DateTime.Now
            };

            return(stringPosition);
        }
예제 #5
0
        public StringPosition UpdateString(StringPosition stringPosition, StringData stringData, DbTransaction dbTran)
        {
            if (!NeedUpdateStringPosition(stringPosition, stringData))
            {
                return(stringPosition);
            }

            stringPosition.AnonymousCompanyName = stringData.AnonymousCompanyName;
            stringPosition.VacancyName          = stringData.VacancyName;
            stringPosition.VacancyAdditional    = stringData.VacancyAdditional;
            stringPosition.VacancyCode          = stringPosition.VacancyCode;
            stringPosition.Responsibility       = stringData.Responsibility;
            stringPosition.Requirement          = stringData.RequirementsData.Value;
            stringPosition.AgeFrom           = stringData.RequirementsData.AgeData.From;
            stringPosition.AgeTo             = stringData.RequirementsData.AgeData.To;
            stringPosition.GenderId          = stringData.RequirementsData.GenderId;
            stringPosition.EducationId       = stringData.RequirementsData.EducationId;
            stringPosition.ExperienceId      = stringData.RequirementsData.ExperienceData.Id;
            stringPosition.ExperienceValue   = stringData.RequirementsData.ExperienceData.Value;
            stringPosition.CitizenshipId     = stringData.RequirementsData.CitizenshipId;
            stringPosition.Condition         = stringData.ConditionsData.Value;
            stringPosition.SalaryFrom        = stringData.ConditionsData.SalaryData.From;
            stringPosition.SalaryTo          = stringData.ConditionsData.SalaryData.To;
            stringPosition.SalaryDescription = stringData.ConditionsData.SalaryData.Description;
            stringPosition.CurrencyId        = stringData.ConditionsData.SalaryData.CurrencyId;
            stringPosition.WorkGraphicId     = stringData.ConditionsData.WorkGraphicData.Id;
            stringPosition.WorkGraphic       = stringData.ConditionsData.WorkGraphicData.Comment;
            stringPosition.Keywords          = stringPosition.Keywords;
            stringPosition.Logo              = Base64ToBytesConverter.Convert(stringData.LogoData.Base64String);
            stringPosition.LogoFileName      = stringData.LogoData.FileName;
            stringPosition.ContactFirstName  = stringData.ContactData.FirstName;
            stringPosition.ContactSecondName = stringData.ContactData.SecondName;
            stringPosition.ContactLastName   = stringData.ContactData.LastName;
            stringPosition.Text              = stringPosition.Text;
            stringPosition.IsSalaryPercent   = stringData.ConditionsData.SalaryData.IsSalaryPercent;
            stringPosition.IsHousing         = stringData.ConditionsData.IsHousing;
            stringPosition.IsFood            = stringData.ConditionsData.IsFood;

            stringPosition = _repository.SetString(stringPosition, isActual: true, dbTran);

            return(stringPosition);
        }
예제 #6
0
        public void CreatePositionIm(int businessUnitId, int orderId, int orderPositionId, OrderPositionData opd, DbTransaction dbTran)
        {
            Action <int, int, DbTransaction> setOrderIm = (orderId, orderImTypeId, dbTran) =>
            {
                var orderIm = _orderImProcessor.GetOrderIm(orderId, orderImTypeId);

                if (orderIm == null)
                {
                    _orderImProcessor.CreateOrderIm(orderId, orderImTypeId, null, dbTran);
                }
            };

            if (opd.StringData != null)
            {
                var positionIm = _positionImFactory.Create(orderId, orderPositionId, positionImTypeId: 1);
                _repository.SetPositionIm(positionIm, newTaskFile: false, newMaketFile: false, isActual: true, dbTran);

                _stringProcessor.CreateFullString(businessUnitId, opd.ClientId, orderPositionId, opd.StringData, dbTran);

                setOrderIm(orderId, 1, dbTran);
            }

            if (opd.ModuleData != null)
            {
                var positionIm = _positionImFactory.Create(orderId, orderPositionId, positionImTypeId: 2);
                positionIm = _repository.SetPositionIm(positionIm, newTaskFile: true, newMaketFile: false, isActual: true, dbTran);

                _moduleProcessor.CreateModule(opd.ClientId, businessUnitId, orderPositionId, dbTran);

                var bytes        = Base64ToBytesConverter.Convert(opd.ModuleData.Base64String);
                var taskFileDate = (DateTime)positionIm.TaskFileDate;

                _moduleMaketProcessor.CreateSampleImage(orderPositionId, bytes, "ImgTask", taskFileDate);
                _moduleMaketProcessor.CreateModuleGraphics(orderPositionId, bytes, opd.ModuleData.Name);

                setOrderIm(orderId, 2, dbTran);
            }
        }