public async Task <ActionResult> Put([FromBody] SaveMessage <ApplicationUserDTO, string> rec)
        {
            ApplicationUserDTO res;

            Logger.Log(LogLevel.Information, rec.Action + "/" + rec.SubAction);

            try
            {
                res = Repository.Put(rec.DataSubject);

                await bootstrapper.EnsureAdminRoleExists(_userManager);

                Uri uri      = new("rabbitmq://localhost/" + uPromis.Services.Queues.MessageBusQueueNames.REPORTSERVERSAVECLIENT);
                var endPoint = await ReportServerBus.GetSendEndpoint(uri);

                await endPoint.Send <ApplicationUserDTO>(res);
            }
            catch (Exception ex)
            {
                return(this.BadRequest(new APIResult <ApplicationUserDTO, string>()
                {
                    ID = rec.ID, DataSubject = null, Message = ex.Message
                }));
            }

            // return posted values
            return(Ok(new APIResult <ApplicationUserDTO, string>()
            {
                ID = res.Id, DataSubject = res, Message = "User was saved."
            }));
        }
Esempio n. 2
0
 public SpiderBase(IHttpHelper http, SpiderConfig config, SaveMessage saveMessage)
 {
     this.Http        = http;
     this.htmlParser  = new HtmlParser();
     this.Config      = config;
     this.SaveMessage = saveMessage;
 }
Esempio n. 3
0
        /// <summary>
        /// 接收到了保存数据的消息
        /// </summary>
        /// <param name="message"></param>
        private void SaveDataMessage(SaveMessage message)
        {
//            if (!IsInited)
//            {
//                XMLHelper.SaveObjAsXml(ProgramData.Instance, ConstData.SaveSettingDataName);
//            }
        }
Esempio n. 4
0
 private void OnInvalidPathError(FilePanelError error)
 {
     if (error == FilePanelError.InvalidPath)
     {
         SaveMessage?.Invoke(this, "Please select a Bonsai asset within the project's Asset folder.");
     }
 }
Esempio n. 5
0
        private void SaveAs(NotificationMessage <SaveMessage> message)
        {
            SaveMessage content = message.Content;

            content.Map.WriteFile(content.Path);
            content.Map.Project.Value.UpdateFile();
        }
Esempio n. 6
0
 void Td.ClientResultHandler.OnResult(TdApi.BaseObject @object)
 {
     if (@object is TdApi.UpdateAuthorizationState)
     {
         OnAuthorizationStateUpdated((@object as TdApi.UpdateAuthorizationState).AuthorizationState);
     }
     else
     {
         //  Print("Unsupported update: " + @object);
         if (@object is TdApi.UpdateChatLastMessage)
         {
             ///RDV - -1001408447562
             ///HIDE -1001352498778
             ///my -1001260330650
             TdApi.Message lastMessage = (@object as TdApi.UpdateChatLastMessage).LastMessage;
             if (lastMessage != null && appConfig.chatIds.Contains(lastMessage.ChatId))
             {
                 var saveMessage = new SaveMessage();
                 saveMessage.messageID = lastMessage.Id;
                 if (db.SaveMessage.Find(lastMessage.Id) == null)
                 {
                     db.SaveMessage.Add(saveMessage);
                     db.SaveChanges();
                     sendMessage(lastMessage);
                     //    Print(lastMessage.ToString());
                 }
             }
         }
     }
 }
Esempio n. 7
0
        private async void OnSave(SaveMessage message)
        {
            await mindmapStore.SaveAsync(mindmapStore.SelectedFile);

            await mindmapStore.StoreRecentsAsync();

            await mindmapStore.StoreBackupAsync();

            message.Callback();
        }
Esempio n. 8
0
        private void ReceiveSaveMessage(SaveMessage message)
        {
            switch (message.MessageType)
            {
            case SaveMessageType.SaveLoaded:
                IsSaveLoaded = true;
                UpdateListAsync();
                break;

            case SaveMessageType.SaveClosed:
                IsSaveLoaded  = false;
                VariablesView = null;
                break;
            }
        }
Esempio n. 9
0
 public IActionResult Post([FromBody] SaveMessage request)
 {
     /*
      * if (!request.IsValid)
      * {
      *  return BadRequest(request.Errors);
      * }
      *
      * //Convert to domain model
      * //Call manager to save
      * //Covnert response to save to service model for response
      *
      * return Ok( new Message { Title = "Test", Content = "This is just a test." } );
      */
     throw new NotImplementedException();
 }
        public async Task <ActionResult> Delete([FromBody] SaveMessage <ApplicationUserDTO, string> rec)
        {
            bool res;

            Logger.Log(LogLevel.Information, rec.Action + "/" + rec.SubAction);

            try
            {
                if (rec.DataSubject.UserName == UserBootstrapper.DefaultAdminUser)
                {
                    return(BadRequest(new APIResult <ApplicationUserDTO, string>()
                    {
                        ID = "", DataSubject = null, Message = "This user may not be deleted."
                    }));
                }
                res = Repository.Delete(rec.ID);

                if (res == false)
                {
                    return(NotFound(new APIResult <ApplicationUserDTO, string>()
                    {
                        ID = rec.ID, DataSubject = null, Message = "Delete failed - record not found"
                    }));
                }

                await bootstrapper.EnsureAdminRoleExists(_userManager);

                Uri uri      = new("rabbitmq://localhost/" + uPromis.Services.Queues.MessageBusQueueNames.REPORTSERVERDELETECLIENT);
                var endPoint = await ReportServerBus.GetSendEndpoint(uri);

                await endPoint.Send <ApplicationUserDTO>(rec.DataSubject);
            }
            catch (Exception ex)
            {
                return(this.BadRequest(new APIResult <ApplicationUserDTO, string>()
                {
                    ID = "", DataSubject = null, Message = ex.Message
                }));
            }

            // return
            return(Ok(new APIResult <ApplicationUserDTO, string>()
            {
                ID = rec.ID, DataSubject = null, Message = "User was deleted."
            }));
        }
        public async Task <ActionResult> Post([FromBody] SaveMessage <ApplicationUserDTO, string> rec)
        {
            ApplicationUserDTO res;

            Logger.Log(LogLevel.Information, rec.Action + "/" + rec.SubAction);

            try
            {
                //Models.ApplicationUser record = new() {
                //    Id = rec.DataSubject.ID,
                //    Email = rec.DataSubject.Email,
                //    UserName = rec.DataSubject.UserName
                //};

                //BusinessRules.ApplyBusinessRules(record, rec.DataSubject, User);

                //if (BusinessRules.HasErrors())
                //{
                //    return UnprocessableEntity(new APIResult<UserDTO, string>() { ID = "", DataSubject = null, Message = "Validation failed", AdditionalInfo = BusinessRules.Result.ToArray() });
                //}

                res = Repository.Post(rec.DataSubject);

                await bootstrapper.EnsureAdminRoleExists(_userManager);

                Uri uri      = new("rabbitmq://localhost/" + uPromis.Services.Queues.MessageBusQueueNames.REPORTSERVERSAVECLIENT);
                var endPoint = await ReportServerBus.GetSendEndpoint(uri);

                await endPoint.Send <ApplicationUserDTO>(res);
            }
            catch (Exception ex)
            {
                return(this.BadRequest(new APIResult <ApplicationUserDTO, string>()
                {
                    ID = "", DataSubject = null, Message = ex.Message
                }));
            }

            // return posted values
            return(Ok(new APIResult <ApplicationUserDTO, string>()
            {
                ID = res.Id, DataSubject = res, Message = "New User was created."
            }));
        }
Esempio n. 12
0
        private void Save(SaveMessage msg)
        {
            Stream         myStream;
            SaveFileDialog saveFileDialog1 = new SaveFileDialog();

            saveFileDialog1.Filter           = "Xml files (*.xml)|*.xml|Text files (*.txt)|*.txt|All files (*.*)|*.*";
            saveFileDialog1.FilterIndex      = 1;
            saveFileDialog1.RestoreDirectory = true;
            var showDialog = saveFileDialog1.ShowDialog();

            if (showDialog != null && showDialog.Value)
            {
                if ((myStream = saveFileDialog1.OpenFile()) != null)
                {
                    XmlSerializer xs = new XmlSerializer(typeof(GameData));
                    TextWriter    tw = new StreamWriter(myStream);
                    xs.Serialize(tw, SaveHelper.SaveGameModel(ApplicationModel.GameModel));
                    myStream.Close();
                }
            }
        }
Esempio n. 13
0
        void ReleaseDesignerOutlets()
        {
            if (PropertyChooser != null)
            {
                PropertyChooser.Dispose();
                PropertyChooser = null;
            }

            if (DocumentChooser != null)
            {
                DocumentChooser.Dispose();
                DocumentChooser = null;
            }

            if (ChosenDocumentLabel != null)
            {
                ChosenDocumentLabel.Dispose();
                ChosenDocumentLabel = null;
            }

            if (SenderChooser != null)
            {
                SenderChooser.Dispose();
                SenderChooser = null;
            }

            if (ReceiverChooser != null)
            {
                ReceiverChooser.Dispose();
                ReceiverChooser = null;
            }

            if (SenderReceiverLabel != null)
            {
                SenderReceiverLabel.Dispose();
                SenderReceiverLabel = null;
            }

            if (StatusChooser != null)
            {
                StatusChooser.Dispose();
                StatusChooser = null;
            }

            if (TransmitChooser != null)
            {
                TransmitChooser.Dispose();
                TransmitChooser = null;
            }

            if (ActionDateChooser != null)
            {
                ActionDateChooser.Dispose();
                ActionDateChooser = null;
            }

            if (RecordDateChooser != null)
            {
                RecordDateChooser.Dispose();
                RecordDateChooser = null;
            }

            if (SaveMessage != null)
            {
                SaveMessage.Dispose();
                SaveMessage = null;
            }
        }
Esempio n. 14
0
 private void OnTreeCopied()
 {
     SaveMessage?.Invoke(this, "Tree Copied");
 }
Esempio n. 15
0
 private void OnLoadSuccess()
 {
     SaveMessage?.Invoke(this, "Tree loaded");
 }
Esempio n. 16
0
 private void OnLoadFailure()
 {
     SaveMessage?.Invoke(this, "Failed to load tree.");
 }
 private void Save(SaveMessage saveMessage)
 {
     Save();
 }
Esempio n. 18
0
        private void UndeliveredMessage(GridInstantMessage im)
        {
            if (im.dialog != (byte)InstantMessageDialog.MessageFromObject &&
                im.dialog != (byte)InstantMessageDialog.MessageFromAgent &&
                im.dialog != (byte)InstantMessageDialog.GroupNotice &&
                im.dialog != (byte)InstantMessageDialog.GroupInvitation &&
                im.dialog != (byte)InstantMessageDialog.InventoryOffered &&
                im.dialog != (byte)InstantMessageDialog.TaskInventoryOffered)
            {
                return;
            }

            if (!m_ForwardOfflineGroupMessages)
            {
                if (im.dialog == (byte)InstantMessageDialog.GroupNotice ||
                    im.dialog == (byte)InstantMessageDialog.GroupInvitation)
                {
                    return;
                }
            }

            Scene scene = FindScene(new UUID(im.fromAgentID));

            if (scene == null)
            {
                scene = m_SceneList[0];
            }

            SaveMessage sm = new SaveMessage();

            sm.im    = im;
            sm.omm   = this;
            sm.scene = scene;

            if (m_TranslatorModule == null)
            {
                sm.Finished(im.message);
            }
            else
            {
                int i = im.message.IndexOf('|');
                if (i < 0)
                {
                    /*
                     * Just a message body, translate in one piece.
                     */
                    m_TranslatorModule.WhatevToAgent(im.toAgentID.ToString(), sm.Finished, im.message);
                }
                else
                {
                    /*
                     * Title and body, translate each separately in case of showoriginal mode.
                     */
                    string title = im.message.Substring(0, i);
                    string body  = im.message.Substring(++i);
                    if (title.StartsWith("[[[") && ((i = title.IndexOf("]]]")) >= 0))
                    {
                        body = title.Substring(0, i + 3) + body;
                    }
                    m_log.Debug("[OfflineMessageModule]: UndeliveredMessage*: title=" + title);
                    m_log.Debug("[OfflineMessageModule]: UndeliveredMessage*: body=" + body);
                    m_TranslatorModule.WhatevToAgent(im.toAgentID.ToString(), sm.FinTitle, title);
                    m_TranslatorModule.WhatevToAgent(im.toAgentID.ToString(), sm.FinBody, body);
                }
            }
        }