public void Initialize(Guid organisationUID, Guid? positionUID = null) { var isNew = positionUID == null; if (isNew) { Position = new Position() { Name = "Новая должность", OrganisationUID = organisationUID }; } else { var operationResult = PositionHelper.GetDetails(positionUID.Value); Position = operationResult; } if (Position.Photo != null && Position.Photo.Data != null) { photoData = string.Format("data:image/gif;base64,{0}", Convert.ToBase64String(Position.Photo.Data)); Position.Photo.Data = null; } }
public static bool Save(Position position, bool isNew) { var operationResult = ClientManager.RubezhService.SavePosition(position, isNew); return Common.ThrowErrorIfExists(operationResult); }
public OperationResult<bool> SavePosition(Guid clientUID, Position item, bool isNew) { if (isNew) AddJournalMessage(JournalEventNameType.Редактирование_должности, item.Name, item.UID, clientUID, JournalEventDescriptionType.Добавление_должность, JournalObjectType.Position); else AddJournalMessage(JournalEventNameType.Редактирование_должности, item.Name, item.UID, clientUID, JournalEventDescriptionType.Редактирование_должность, JournalObjectType.Position); using (var databaseService = new RubezhDAL.DataClasses.DbService()) { return databaseService.PositionTranslator.Save(item); } }