public string GetVisualDataValidationStageName(int validationStageId, bool isValidated) { return(validationStageId == VIS_COO.MasterId ? (isValidated ? Localization.GetText(MasterDefinitions.GetMasterName(validationStageId)) : Localization.GetText(MasterDefinitions.GetMasterName(VIS_TL.MasterId))) : Localization.GetText(MasterDefinitions.GetMasterName(validationStageId))); }
public List <MediaModel> VisualizationMediaSearch( string name, DateTime?dateFrom, DateTime?dateTo) { var visualizationRepository = Globals.Resolve <IVisualizationRepository>(); var result = new List <MediaModel>(); var spMedias = MediaSearch(name, dateFrom, dateTo); var dbMedias = visualizationRepository .MediaGet(IDBContext.Current.Operation, name, dateFrom, dateTo, true); foreach (var media in spMedias) { var mediaUrl = media.MediaUrl.ToLower(); if (!dbMedias.Any(dbm => dbm.MediaUrl.ToLower() == mediaUrl) && !string.IsNullOrEmpty(mediaUrl)) { var mime = ImageHelper.URLGetMime(mediaUrl); if (mime.StartsWith("image/")) { media.MediaTypeId = MasterDefinitions.GetMaster("MEDIA_TYPE", "IMAGE").MasterId; } else { media.MediaTypeId = MasterDefinitions.GetMaster("MEDIA_TYPE", "VIDEO").MasterId; } media.Name = mediaUrl.SubstringFromLast('/'); result.Add(media); } } return(result); }
public bool IsReadyStage(int?validationStage) { if (validationStage == null) { return(false); } return(MasterDefinitions.GetValidationStageId("VIS_READY") == validationStage || MasterDefinitions.GetValidationStageId("VIS_TL") == validationStage); }
/// <summary> /// Save the visual output information /// </summary> /// <param name="vpv">The VPV (operation mapping) data</param> /// <param name="vovs">Array of all vov</param> /// <returns></returns> public virtual ActionResult VisualizationDataSave( VPVVModels vpv, VOVVModel[] vovs) { if (vpv != null) { var business = new VisualizationBusinessContext(); vpv.LocationTypeId = MasterDefinitions.GetMaster("UNDEFINED").MasterId; business.VisualProjectId = vpv.VisualProjectId; business.Load(IDBContext.Current.Operation); business.ViewModel = vpv; if (vpv.VisualProjectMedia != null) { foreach (var media in vpv.VisualProjectMedia) { //TODO: Get the media source from the sended name for each media //TODO: Transform the sended media from base64 and send to sharepoint //new SharepointProxy().AddMediaFile(Request.Files[0]); //TODO: create the media phat based in the sharepoint url+operation+media directory+filename //TODO: Set the URL from in the media model //TODO: Set MediaTypeId depending of the media type sended } } business.Execute("Visualization.VP.Save"); //TODO: Update vpv location with the GeolocationWK //business.VisualizationRepository.VisualProjectVersionSetGeolocation(vpv.GeolocationWNT); } if (vovs != null) { foreach (var vov in vovs) { if (vov.VisualOutputMedia != null) { foreach (var media in vov.VisualOutputMedia) { //TODO: Get the media source from the sended name for each media //TODO: Transform the sended media from base64 and send to sharepoint //new SharepointProxy().AddMediaFile(Request.Files[0]); //TODO: create the media phat based in the sharepoint url+operation+media directory+filename //TODO: Set the URL from in the media model //TODO: Set MediaTypeId depending of the media type sended } } vov.DeliveryStatusId = MasterDefinitions .GetMaster(vov.DeliveryStatus, "VO_DELIVERY_STATUS").MasterId; } } return(Content(string.Empty)); }
public void Load(string operationNumber) { OperationContext = new OperationBusiness(); Globals.Rules.ApplyParentLogic(this, OperationContext); OperationContext.Load(operationNumber); ResultsMatrixContext = new ResultsMatrixBusiness(); Globals.Rules.ApplyParentLogic(this, ResultsMatrixContext); ResultsMatrixContext.Load(OperationContext); Url = new UrlHelper(IDBContext.Current.ContextRequestContext); VIS_TL = MasterDefinitions.GetValidationStage("VIS_TL"); VIS_REV = MasterDefinitions.GetValidationStage("VIS_REV"); VIS_DRAFY = MasterDefinitions.GetValidationStage("VIS_DRAFY"); VIS_READY = MasterDefinitions.GetValidationStage("VIS_READY"); VIS_COO = MasterDefinitions.GetValidationStage("VIS_COO"); LocationTypes = MasterDefinitions.GetMasterByType("VO_LOCATION_TYPE"); MediaSourceTypes = MasterDefinitions.GetMasterByType("MEDIA_SOURCE"); DeliveryStatusTypes = MasterDefinitions.GetMasterByType("VO_DELIVERY_STATUS") .OrderByDescending(a => a.Code).ToList(); Execute("Visualization.Load"); }
/// <summary> /// Save the visual data. /// </summary> /// <param name="operation">The operation.</param> /// <param name="vpv">The VPV.</param> /// <param name="vovs">The vovs.</param> /// <param name="userName"></param> public void VisualizationDataSave( string operation, VPVVModels vpv, VOVVModel[] vovs, string userName) { var imageTypes = new string[] { "png", "jpg", "jpeg", "gif", "bpm" }; IDBContext.Current.Operation = operation; //check if operation mapping is empty before call to save if (vpv.IsNotNull()) { var business = new VisualizationBusinessContext(); vpv.LocationTypeId = MasterDefinitions.GetMaster("UNDEFINED").MasterId; business.VisualProjectId = vpv.VisualProjectId; business.Load(operation); business.ViewModel = vpv; if (vpv.VisualProjectMedia.IsNotNull()) { foreach (var media in vpv.VisualProjectMedia) { //Transform the sended media from base64 and send to sharepoint media.MediaUrl = new SharepointProxy().AddMediaFile( new Base64file(media.MediaFile64, media.MediaUrl)); //Get the media source from the sended name for each media media.MediaSourceId = MasterDefinitions .GetMaster("MEDIA_SOURCE", media.MediaSource).MasterId; //Set MediaTypeId depending of the media type sended var mime = ImageHelper.URLGetMime(media.MediaUrl); if (mime.StartsWith("image/")) { media.MediaTypeId = MasterDefinitions.GetMaster("MEDIA_TYPE", "IMAGE").MasterId; } else { media.MediaTypeId = MasterDefinitions.GetMaster("MEDIA_TYPE", "VIDEO").MasterId; } } } business.ViewModel = vpv; business.Execute("Visualization.VP.Save"); } if (vovs.IsNotNull()) { var business = new VisualizationBusinessContext(); business.ViewModel = vpv; foreach (var vov in vovs) { vov.LocationTypeId = MasterDefinitions.GetMaster("UNDEFINED").MasterId; if (vov.VisualOutputId == -1) { business.OutputId = vov.OutputId.Value; } else { business.VisualOutputId = vov.VisualOutputId; business.OutputId = business .VisualOutputGet(vov.VisualOutputId) .VisualOutputVersions .First() .OutputYearPlan .OutputId; } business.Load(IDBContext.Current.Operation); vov.LocationTypeId = MasterDefinitions.GetMasterByName("VO_LOCATION_TYPE", vov.LocationType).MasterId; vov.DeliveryStatusId = MasterDefinitions.GetMasterByName("VO_DELIVERY_STATUS", vov.DeliveryStatus).MasterId; business.ViewModel = vov; if (vov.VisualOutputMedia.IsNotNull()) { foreach (var media in vov.VisualOutputMedia) { //Transform the sended media from base64 and send to sharepoint media.MediaUrl = new SharepointProxy().AddMediaFile( new Base64file(media.MediaFile64, media.MediaUrl)); //Get the media source from the sended name for each media media.MediaSourceId = MasterDefinitions .GetMaster("MEDIA_SOURCE", media.MediaSource).MasterId; //get the history status from given information media.MediaHistoryStatusId = MasterDefinitions.GetMasterByName( "VO_DELIVERY_STATUS", media.MediaHistoryStatus).MasterId; //Set MediaTypeId depending of the media type sended var mime = ImageHelper.URLGetMime(media.MediaUrl); if (mime.StartsWith("image/")) { media.MediaTypeId = MasterDefinitions.GetMaster("MEDIA_TYPE", "IMAGE").MasterId; } else { media.MediaTypeId = MasterDefinitions.GetMaster("MEDIA_TYPE", "VIDEO").MasterId; } } } business.Execute("Visualization.VO.Save"); } } }