Exemple #1
0
 private void bindAttachmentPanel( MessageData msgData )
 {
     IBlock attachmentPanel = getBlock( "attachmentPanel" );
     if (msgData.AttachmentCount > 0) {
         bindAttachments( attachmentPanel, msgData );
     }
 }
        protected void Page_Load(object sender, EventArgs e)
        {
            MessageData msgData = new MessageData();
            if (Request.Form != null
                && Request.Form.Count > 0)
            {
                foreach (string s in Request.Form.AllKeys)
                {
                    msgData.PostParameters.Add(new NameValuePair(s, Request.Form[s]));
                }                
            }
                        
            if (Request.Cookies != null
                && Request.Cookies.Count > 0)
            {
                foreach (string s in Request.Cookies.AllKeys)
                {
                    msgData.Cookies.Add(new NameValuePair(s, Request.Cookies[s].Value));
                }
            }

            if (Request.Files != null
                && Request.Files.Count > 0)
            {
                foreach (string key in Request.Files.AllKeys)
                {
                    msgData.Files.Add(new NameValuePair(Request.Files[key].FileName, Request.Files[key].ContentLength.ToString()));
                }
            }
            Response.Write(msgData.ToString());
        }
Exemple #3
0
        private MessageData AddMessage(string tag, int receivers, object message)
        {
            MessageData msg = new MessageData(tag, receivers, message);
            mMessages.Add(msg);

            return msg;
        }
 public void AddSafeIgnoresDuplicates()
 {
     var data = new MessageData();
     data.AddIfAbsent("myKey", "data1");
     data.AddIfAbsent("myKey", "data2");
     Assert.That((string)data["myKey"] == "data1");
 }
 public Page1()
 {
     this.InitializeComponent();
     
     messageData = new MessageData();
     GridView1.ItemsSource = messageData.Collection;
 }
 public void SendMessage(MessageData message)
 {
     if (string.IsNullOrEmpty(message.UserName))
         throw new NotSupportedException("User name can not be empty.");
     if (string.IsNullOrEmpty(message.Message))
         throw new NotSupportedException("Message can not be empty.");
     base.Clients.addMessage(message);
 }
        public Message(MessageData data)
        {
            InitializeComponent();
            DataContext = this;

            Data = data;
            Read = data.Read;
        }
        public LogglyEvent()
        {
            Options = new EventOptions();
            Syslog = new SyslogHeader();
            Data = new MessageData();

            Timestamp = DateTimeOffset.Now;
        }
Exemple #9
0
    private MessageData GetData()
    {
        MessageData data = new MessageData();
        data.LOID = Convert.ToDouble(this.txtLOID.Text.Trim());
        data.MESSAGE = this.txtMessage.Text.Trim();
        data.EFDATE = this.dtpDateFrom.DateValue;
        data.EPDATE = this.dtpDateTo.DateValue;

        return data;
    }
Exemple #10
0
    public static byte[] ToByteArray(MessageData msg)
    {
        MemoryStream stream = new MemoryStream();
        BinaryFormatter formatter = new BinaryFormatter();

        formatter.Serialize(stream, msg.type);
        formatter.Serialize(stream, msg.stringData);

        return stream.ToArray();
    }
    public static void Send(MessageData msgData)
    {
        if (singleton.m_Socket == null)
            return;

        byte[] sendData = MessageData.ToByteArray(msgData);
        byte[] prefix = new byte[1];
        prefix[0] = (byte)sendData.Length;
        singleton.m_Socket.Send(prefix);
        singleton.m_Socket.Send(sendData);
    }
Exemple #12
0
        public Scenario2()
        {
            this.InitializeComponent();

            // initializing sample data
            messageData = new MessageData();
            // setting the ListView source to the sample data 
            ItemListView.ItemsSource = messageData.Collection;
            // making sure the first item is the selected item
            ItemListView.SelectedIndex = 0;
        }
Exemple #13
0
 public static void Send(MessageData msg)
 {
     if (singleton == null)
     {
         return;
     }
     Debug.Log("Sending Package...");
     byte[] sendData = MessageData.ToByteArray(msg);
     byte[] buffer = new byte[1];
     buffer[0] = (byte)sendData.Length;
     singleton.sServer.Send(buffer);
     singleton.sServer.Send(sendData);
 }
Exemple #14
0
    void RecieveMessage(MessageType msgType, GameObject go, MessageData msgData)
    {
        switch (msgType)
        {
            case MessageType.HEALTHCHANGED:
                HealthData hpData = msgData as HealthData;

                if (hpData != null)
                {
                    UpdateUi(hpData.maxHealth, hpData.curHealth);
                }
                break;
        }
    }
Exemple #15
0
    void RecieveMessage(MessageType msgType, GameObject go, MessageData msgData)
    {
        switch (msgType)
        {
            case MessageType.DAMAGED:
                DamageData dmgData = msgData as DamageData;

                if (dmgData != null)
                {
                    DoDamage(dmgData.damage, go);
                }
                break;
        }
    }
Exemple #16
0
    void RecieveMessage(MessageType msgType, GameObject go, MessageData msgData)
    {
        switch (msgType)
        {
            case MessageType.DIED:
                DeathData dthData = msgData as DeathData;

                if (dthData != null)
                {
                    Die();
                }
                break;
        }
    }
    //    public byte[]  byteImg;
    public static MessageData FromByteArray(byte[] input)
    {
        // Create a memory stream, and serialize.
        MemoryStream stream = new MemoryStream(input);
        // Create a binary formatter.
        BinaryFormatter formatter = new BinaryFormatter();

        MessageData data = new MessageData();
        data.Chaine = (string)formatter.Deserialize(stream);
        data.reel = (float)formatter.Deserialize(stream);
        data.entier = (int)formatter.Deserialize(stream);

        return data;
    }
    void MDataSend()
    {
        // Create the message it and send it off!
        MessageData msgData = new MessageData();
            msgData.Chaine="hello:";
            //msgData.reel=Time.deltaTime;
            //msgData.entier=3;
        /*msgData.mousex = Input.mousePosition.x / Screen.width;
        msgData.mousey = Input.mousePosition.y / Screen.height;
        msgData.stringData = "Hello World";
        */

        Client.Send(msgData);
    }
Exemple #19
0
    public static MessageData FromByteArray(byte[] input)
    {
        MemoryStream stream = new MemoryStream(input);
        BinaryFormatter formatter = new BinaryFormatter();
        MessageData data = new MessageData();
        data.type = (int)formatter.Deserialize(stream);
        data.stringData = (string)formatter.Deserialize(stream);

        if (data.stringData == "")
        {
            data.type = 999;
            data.stringData = "No Command Included";
        }
        return data;
    }
Exemple #20
0
        public MessageImpl(MessageData message, string directedBody, bool isAddressedAtMe)
        {
            this.ReplyTo = message.ReplyTo;
            this.SenderAddress = message.SenderAddress;
            this.SenderName = message.SenderName;

            this.IsAddressedAtMe = isAddressedAtMe;
            this.IsFromMyself = message.IsFromMyself;
            this.IsHistorical = message.IsHistorical;
            this.IsPrivate = message.IsPrivate;

            this.Body = isAddressedAtMe ? directedBody : message.Body;
            this.DirectedBody = directedBody;
            this.FullBody = message.Body;
        }
Exemple #21
0
        private void bindAttachments( IBlock attachmentPanel, MessageData msgData )
        {
            List<MessageAttachment> list = attachmentService.GetByMsg( msgData.Id );

            IBlock block = attachmentPanel.GetBlock( "attachments" );
            foreach (MessageAttachment obj in list) {

                block.Set( "obj.FileName", obj.FileName );
                block.Set( "obj.FileSizeKB", obj.FileSizeKB );
                block.Set( "obj.DownloadUrl", to( DownloadAttachment, obj.Id ) );
                block.Next();
            }

            attachmentPanel.Next();
        }
    public static byte[] ToByteArray(MessageData msg)
    {
        // Create a memory stream, and serialize.
        MemoryStream stream = new MemoryStream();
        // Create a binary formatter.
        BinaryFormatter formatter = new BinaryFormatter();

        // Serialize.
        formatter.Serialize(stream, msg.Chaine);
        formatter.Serialize(stream, msg.reel);
        formatter.Serialize(stream, msg.entier);

        // Now return the array.
        return stream.ToArray();
    }
Exemple #23
0
	public static MessageData UnParse (byte[] buffer) {
		int iHead = 13;
		{
			Message_Head head = UnParseHead(buffer);
			if (head != null && head.Length <= (buffer.Length - iHead)) {
				Message_Body body = new Message_Body();
				System.Array.Reverse(buffer, 13, 4);
				body.iCommand = System.BitConverter.ToInt32(buffer, 13);
				body.body = new byte[head.Length - 4];
				System.Array.Copy(buffer, iHead + 4, body.body, 0, body.body.Length);
				MessageData data = new MessageData();
				data.head = head;
				data.body = body;
				return data;
			}
		}
		return null;
	}
Exemple #24
0
 public Message(string jsonStr)
 {
     JToken json = JObject.Parse(jsonStr).SelectToken("data");
     Topic = json.SelectToken("topic")?.ToString();
     var encodedJsonMessage = json.SelectToken("message").ToString();
     switch(Topic.Split('.')[0])
     {
         case "chat_moderator_actions":
             messageData = new ChatModeratorActions(encodedJsonMessage);
             break;
         case "channel-bitsevents":
             messageData = new ChannelBitsEvents(encodedJsonMessage);
             break;
         case "video-playback":
             messageData = new VideoPlayback(encodedJsonMessage);
             break;
         case "whispers":
             messageData = new Whisper(encodedJsonMessage);
             break;
     }
 }
 protected void Page_Load(object sender, EventArgs e)
 {
     MessageData msgData = new MessageData();
     if (Request.QueryString != null
         && Request.QueryString.Count > 0)
     {
         foreach (string s in Request.QueryString.AllKeys)
         {
             msgData.QueryParameters.Add(new NameValuePair(s, Request.QueryString[s]));
         }
     }
     if (Request.QueryString != null
         && Request.QueryString.Count > 0)
     {
         foreach (string s in Request.QueryString.AllKeys)
         {
             Response.Cookies.Add(new HttpCookie(s, Request.QueryString[s]));
         }
     }
     Response.Write(msgData.ToString());
 }
Exemple #26
0
        private static void GetFolderData(pstsdk.definition.pst.folder.IFolder rootfolder, string currpath, bool filtered, bool includemessages, ref List<FolderData> folders)
        {
            if (rootfolder.Name != string.Empty)
                currpath += (currpath != string.Empty ? "\\" : string.Empty) + rootfolder.Name;

            if (rootfolder.Name == string.Empty)
                currpath = "Root Container";

            FolderData folderdata = null;
            if ((folderdata = folders.FirstOrDefault(x => (x.FolderPath == currpath) || (x.FolderEntryId == rootfolder.EntryID.ToString()))) != null)
            {
                folderdata.NodeId = rootfolder.Node;
                if(folderdata.FolderEntryId == string.Empty)
                    folderdata.FolderEntryId = rootfolder.EntryID.ToString();
                if (folderdata.FolderPath == string.Empty)
                    folderdata.FolderPath = currpath;
            }
            else if (filtered == false)
                folders.Add(folderdata = new FolderData(currpath, rootfolder, includemessages ? (uint)rootfolder.MessageCount : 0, includemessages ? (uint)rootfolder.Messages.Count(x => x.AttachmentCount > 0) : 0));

            if (folderdata != null && includemessages == true)
            {
                List<MessageData> messagedatalist = folderdata.MessageData;
                foreach (pstsdk.definition.pst.message.IMessage msg in rootfolder.Messages)
                {
                    MessageData messagedata = new MessageData(msg.EntryID.ToString(), msg.Node, (uint)msg.AttachmentCount);
                    messagedatalist.Add(messagedata);
                    msg.Dispose();
                }
            }

            if (rootfolder.Name == string.Empty)
                currpath = string.Empty;

            foreach (pstsdk.definition.pst.folder.IFolder folder in rootfolder.SubFolders)
            {
                GetFolderData(folder, currpath, filtered, includemessages, ref folders);
                folder.Dispose();
            }
        }
    public bool GiveMessage(MessageType msgType, GameObject go, MessageData msgData)
    {
        bool approved = false;

        for (int i = 0; i < messages.Count; i++)
        {
            if (messages[i] == msgType)
            {
                approved = true;
                break;
            }
        }

        if (!approved)
            return false;

        for (int i = 0; i < m_messageDelegates.Count; i++)
        {
            m_messageDelegates[i](msgType, go, msgData);
        }

        return true;
    }
Exemple #28
0
        private async Task HandleResponseAsync(MessageData <Response[]> message)
        {
            if (message?.Data == null || message.Data.Length == 0)
            {
                Logger.LogWarning($"{Id} receive empty message");
                return;
            }

            _lastRequestedTime = DateTimeOffset.Now;

            var responses = message.Data;

            try
            {
                if (responses.Length == 0)
                {
                    Logger.LogWarning($"{Id} receive empty message");
                    return;
                }

                _responded.Add(responses.Length);

                // 只要有回应就从缓存中删除,即便是异常要重新下载会成 EnqueueRequest 中重新加回缓存
                // 此处只需要保证: 发 -> 收 可以一对一删除就可以保证检测机制的正确性
                foreach (var response in responses)
                {
                    _enqueuedRequestDict.TryRemove(response.Request.Hash, out _);
                }

                var agentId = responses.First().AgentId;

                var successResponses = responses.Where(x => x.Success).ToList();
                // 统计下载成功
                if (successResponses.Count > 0)
                {
                    var elapsedMilliseconds = successResponses.Sum(x => x.ElapsedMilliseconds);
                    await _statisticsService.IncrementDownloadSuccessAsync(agentId, successResponses.Count,
                                                                           elapsedMilliseconds);
                }

                // 处理下载成功的请求
                Parallel.ForEach(successResponses, async response =>
                {
                    Logger.LogInformation($"{Id} download {response.Request.Url} success");

                    try
                    {
                        using (var scope = Services.CreateScope())
                        {
                            var context = new DataFlowContext(response, scope.ServiceProvider);

                            foreach (var dataFlow in _dataFlows)
                            {
                                var dataFlowResult = await dataFlow.HandleAsync(context);
                                var @break         = false;
                                switch (dataFlowResult)
                                {
                                case DataFlowResult.Success:
                                    {
                                        continue;
                                    }

                                case DataFlowResult.Failed:
                                    {
                                        // 如果处理失败,则直接返回
                                        Logger.LogInformation(
                                            $"{Id} handle {response.Request.Url} failed: {context.Message}");
                                        await _statisticsService.IncrementFailedAsync(Id);
                                        return;
                                    }

                                case DataFlowResult.Terminated:
                                    {
                                        @break = true;
                                        break;
                                    }
                                }

                                if (@break)
                                {
                                    break;
                                }
                            }

                            var resultIsEmpty = !context.HasData && !context.HasParseData;
                            // 如果解析结果为空,重试
                            if (resultIsEmpty && RetryWhenResultIsEmpty)
                            {
                                if (response.Request.RetriedTimes < response.Request.RetryTimes)
                                {
                                    response.Request.RetriedTimes++;
                                    await EnqueueRequests(response.Request);
                                    // 即然是重试这个请求,则解析必然还会再执行一遍,所以解析到的目标链接、成功状态都应该到最后来处理。
                                    Logger.LogInformation($"{Id} retry {response.Request.Url} because empty result");
                                    return;
                                }
                            }

                            // 解析的目标请求
                            if (context.ExtraRequests != null && context.ExtraRequests.Count > 0)
                            {
                                var requests = new List <Request>();
                                foreach (var newRequest in context.ExtraRequests)
                                {
                                    newRequest.Depth = response.Request.Depth + 1;
                                    if (newRequest.Depth <= Depth)
                                    {
                                        // 在此强制设制 OwnerId, 防止用户忘记导致出错
                                        if (string.IsNullOrWhiteSpace(newRequest.OwnerId))
                                        {
                                            newRequest.OwnerId = context.Response.Request.OwnerId;
                                            newRequest.AgentId = context.Response.Request.AgentId;
                                        }

                                        requests.Add(newRequest);
                                    }
                                }

                                var count = _scheduler.Enqueue(requests);
                                if (count > 0)
                                {
                                    await _statisticsService.IncrementTotalAsync(Id, count);
                                }
                            }

                            if (!resultIsEmpty)
                            {
                                await _statisticsService.IncrementSuccessAsync(Id);
                                Logger.LogInformation($"{Id} handle {response.Request.Url} success");
                            }
                            else
                            {
                                if (RetryWhenResultIsEmpty)
                                {
                                    await _statisticsService.IncrementFailedAsync(Id);
                                    Logger.LogInformation(
                                        $"{Id} handle {response.Request.Url} failed,extract result is empty");
                                }
                                else
                                {
                                    await _statisticsService.IncrementSuccessAsync(Id);
                                    Logger.LogInformation(
                                        $"{Id} handle {response.Request.Url} success,extract result is empty");
                                }
                            }
                        }
                    }
                    catch (Exception e)
                    {
                        await _statisticsService.IncrementFailedAsync(Id);
                        Logger.LogInformation($"{Id} handle {response.Request.Url} failed: {e}");
                    }
                });

                // TODO: 此处需要优化
                var retryResponses =
                    responses.Where(x => !x.Success && x.Request.RetriedTimes < x.Request.RetryTimes)
                    .ToList();
                var downloadFailedResponses =
                    responses.Where(x => !x.Success)
                    .ToList();
                var failedResponses =
                    responses.Where(x => !x.Success && x.Request.RetriedTimes >= x.Request.RetryTimes)
                    .ToList();

                foreach (var response in downloadFailedResponses)
                {
                    Logger.LogError($"{Id} download {JsonConvert.SerializeObject(response)} failed");
                }

                foreach (var response in failedResponses)
                {
                    Logger.LogError($"{Id} process {JsonConvert.SerializeObject(response)} failed");
                }

                if (retryResponses.Count > 0)
                {
                    retryResponses.ForEach(x =>
                    {
                        x.Request.RetriedTimes++;
                        Logger.LogInformation($"{Id} download {JsonConvert.SerializeObject(x)} failed and retry");
                    });
                    await EnqueueRequests(retryResponses.Select(x => x.Request).ToArray());
                }

                // 统计下载失败
                if (downloadFailedResponses.Count > 0)
                {
                    var elapsedMilliseconds = downloadFailedResponses.Sum(x => x.ElapsedMilliseconds);
                    await _statisticsService.IncrementDownloadFailedAsync(agentId,
                                                                          downloadFailedResponses.Count, elapsedMilliseconds);
                }

                // 统计失败
                if (failedResponses.Count > 0)
                {
                    await _statisticsService.IncrementFailedAsync(Id, failedResponses.Count);
                }
            }
            catch (Exception ex)
            {
                Logger.LogError($"{Id} handle message {message} failed: {ex}");
            }
        }
Exemple #29
0
 protected virtual void DoHandleMessage(MessageData message, int sequence)
 {
     int insertedSequence = SaveMessage(message);
 }
Exemple #30
0
    public int ShowTips(int msg_id, RectTransform rtf, string str = "")
    {
        string msg = MessageData.GetMessage(msg_id);

        return(ShowTips(msg, rtf, str));
    }
Exemple #31
0
        public async Task <IReadOnlyList <MessageData> > GetMessagesAsync(CancellationToken cancellationToken)
        {
            using (var linkedCts = CancellationTokenSource.CreateLinkedTokenSource(this.releaseCancellationToken, cancellationToken))
            {
                bool pendingOrchestratorMessageLimitReached = false;
                bool isWaitingForMoreMessages = false;

                while (!linkedCts.IsCancellationRequested)
                {
                    // Pause dequeuing if the total number of locked messages gets too high.
                    long pendingOrchestratorMessages = this.stats.PendingOrchestratorMessages.Value;
                    if (pendingOrchestratorMessages >= this.settings.ControlQueueBufferThreshold)
                    {
                        if (!pendingOrchestratorMessageLimitReached)
                        {
                            pendingOrchestratorMessageLimitReached = true;
                            AnalyticsEventSource.Log.PendingOrchestratorMessageLimitReached(
                                this.storageAccountName,
                                this.settings.TaskHubName,
                                pendingOrchestratorMessages,
                                Utils.ExtensionVersion);
                        }

                        await Task.Delay(TimeSpan.FromSeconds(1));

                        continue;
                    }

                    pendingOrchestratorMessageLimitReached = false;

                    try
                    {
                        OperationContext context = new OperationContext {
                            ClientRequestID = Guid.NewGuid().ToString()
                        };
                        IEnumerable <CloudQueueMessage> batch = await TimeoutHandler.ExecuteWithTimeout("GetMessages", context.ClientRequestID, storageAccountName, settings.TaskHubName, () =>
                        {
                            return(this.storageQueue.GetMessagesAsync(
                                       this.settings.ControlQueueBatchSize,
                                       this.settings.ControlQueueVisibilityTimeout,
                                       this.settings.ControlQueueRequestOptions,
                                       context,
                                       linkedCts.Token));
                        });

                        this.stats.StorageRequests.Increment();

                        if (!batch.Any())
                        {
                            if (!isWaitingForMoreMessages)
                            {
                                isWaitingForMoreMessages = true;
                                AnalyticsEventSource.Log.WaitingForMoreMessages(
                                    this.storageAccountName,
                                    this.settings.TaskHubName,
                                    this.storageQueue.Name,
                                    Utils.ExtensionVersion);
                            }

                            await this.backoffHelper.WaitAsync(linkedCts.Token);

                            continue;
                        }

                        isWaitingForMoreMessages = false;

                        var batchMessages = new ConcurrentBag <MessageData>();
                        await batch.ParallelForEachAsync(async delegate(CloudQueueMessage queueMessage)
                        {
                            this.stats.MessagesRead.Increment();

                            MessageData messageData = await this.messageManager.DeserializeQueueMessageAsync(
                                queueMessage,
                                this.storageQueue.Name);

                            // Check to see whether we've already dequeued this message.
                            lock (this.pendingMessageIds)
                            {
                                if (this.pendingMessageIds.Add(queueMessage.Id))
                                {
                                    this.stats.PendingOrchestratorMessages.Increment();
                                }
                                else
                                {
                                    // This message is already loaded in memory and is therefore a duplicate.
                                    // We will continue to process it because we need the updated pop receipt.
                                    AnalyticsEventSource.Log.DuplicateMessageDetected(
                                        this.storageAccountName,
                                        this.settings.TaskHubName,
                                        queueMessage.Id,
                                        messageData.TaskMessage.OrchestrationInstance.InstanceId,
                                        messageData.TaskMessage.OrchestrationInstance.ExecutionId,
                                        this.Name,
                                        queueMessage.DequeueCount,
                                        Utils.ExtensionVersion);
                                }
                            }

                            batchMessages.Add(messageData);
                        });

                        this.backoffHelper.Reset();

                        // Try to preserve insertion order when processing
                        IReadOnlyList <MessageData> sortedMessages = batchMessages.OrderBy(m => m, MessageOrderingComparer.Default).ToList();
                        foreach (MessageData message in sortedMessages)
                        {
                            AzureStorageOrchestrationService.TraceMessageReceived(
                                message,
                                this.storageAccountName,
                                this.settings.TaskHubName);
                        }

                        return(sortedMessages);
                    }
                    catch (Exception e)
                    {
                        if (!linkedCts.IsCancellationRequested)
                        {
                            AnalyticsEventSource.Log.MessageFailure(
                                this.storageAccountName,
                                this.settings.TaskHubName,
                                string.Empty /* MessageId */,
                                string.Empty /* InstanceId */,
                                string.Empty /* ExecutionId */,
                                this.storageQueue.Name,
                                string.Empty /* EventType */,
                                0 /* TaskEventId */,
                                e.ToString(),
                                Utils.ExtensionVersion);

                            await this.backoffHelper.WaitAsync(linkedCts.Token);
                        }
                    }
                }

                this.IsReleased = true;
                return(EmptyMessageList);
            }
        }
        /// <summary>
        /// update data to db
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void Ok_btn_Click(object sender, EventArgs e)
        {
            InventoryReasonVo inVo = new InventoryReasonVo();

            if (CheckMandatory())
            {
                var sch = StringCheckHelper.GetInstance();

                if (string.IsNullOrEmpty(InventoryReasonCode_txt.Text) || string.IsNullOrEmpty(InventoryReasonName_txt.Text))
                {
                    messageData = new MessageData("mmce00003", Properties.Resources.mmce00003);
                    logger.Info(messageData);
                    popUpMessage.ConfirmationOkCancel(messageData, Text);

                    if (string.IsNullOrEmpty(InventoryReasonCode_txt.Text))
                    {
                        InventoryReasonCode_txt.Focus();
                    }
                    else
                    {
                        InventoryReasonName_txt.Focus();
                    }

                    return;
                }

                inVo.InventoryReasonCode = InventoryReasonCode_txt.Text.Trim();
                inVo.InventoryReasonName = InventoryReasonName_txt.Text.Trim();
                //inVo.RegistrationDateTime = DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss");
                inVo.RegistrationUserCode = UserData.GetUserData().UserCode;
                inVo.FactoryCode          = UserData.GetUserData().FactoryCode;

                if (string.Equals(mode, CommonConstants.MODE_ADD))
                {
                    InventoryReasonVo checkVo = DuplicateCheck(inVo);

                    if (checkVo != null && checkVo.AffectedCount > 0)
                    {
                        messageData = new MessageData("mmce00001", Properties.Resources.mmce00001, InventoryReasonCode_lbl.Text + " : " + InventoryReasonCode_txt.Text);
                        logger.Info(messageData);
                        popUpMessage.ApplicationError(messageData, Text);

                        return;
                    }
                }

                try
                {
                    if (string.Equals(mode, CommonConstants.MODE_ADD))
                    {
                        InventoryReasonVo outVo = (InventoryReasonVo)base.InvokeCbm(new AddInventoryReasonMasterMntCbm(), inVo, false);
                        IntSuccess = outVo.AffectedCount;
                    }
                    else if (string.Equals(mode, CommonConstants.MODE_UPDATE))
                    {
                        inVo.InventoryReasonId = updateData.InventoryReasonId;
                        InventoryReasonVo outVo = (InventoryReasonVo)base.InvokeCbm(new UpdateInventoryReasonMasterMntCbm(), inVo, false);
                        IntSuccess = outVo.AffectedCount;
                    }
                }
                catch (Framework.ApplicationException exception)
                {
                    popUpMessage.ApplicationError(exception.GetMessageData(), Text);
                    logger.Error(exception.GetMessageData());
                    return;
                }

                if ((IntSuccess > 0) || (IntSuccess == 0))
                {
                    this.Close();
                }
            }
        }
 public void AppendMessageData(MessageData data)
 {
     this.Message.Data.Add(data);
     this.LastMessageDataTime = DateTime.Now;
 }
        /// <inheritdoc/>
        void IMessageSubscriber <UltravioletMessageID> .ReceiveMessage(UltravioletMessageID type, MessageData data)
        {
            if (type == UltravioletMessages.ApplicationSuspending)
            {
                if (!suspended)
                {
                    awaitingResume = true;
                    Suspend();
                }
                return;
            }

            if (type == UltravioletMessages.ApplicationResumed)
            {
                if (awaitingResume)
                {
                    awaitingResume = false;
                    Resume();
                }
                return;
            }
        }
Exemple #35
0
 public MessageEventArgs(MessageType msgType, GameObject attackerObject, MessageData msgData)
 {
     MsgType        = msgType;
     AttackerObject = attackerObject;
     MsgData        = msgData;
 }
Exemple #36
0
 /// <summary>
 /// 每解析出来一条消息则会回掉此消息
 /// </summary>
 /// <param name="mdata"></param>
 private void ParseMessageCallBack(MessageData mdata)
 {
     msgContent.EnqueueMsg(mdata);
 }
        private void ProcessCopy_cntxMnu_ItemClicked(object sender, ToolStripItemClickedEventArgs e)
        {
            if (string.IsNullOrEmpty(e.ClickedItem.Text) || InspectionProcessDetails_dgv.Rows.Count == 0)
            {
                return;
            }

            if (InspectionProcessDetails_dgv.SelectedRows.Count > 0)
            {
                ProcessCopy_cntxMnu.Items.Clear();

                this.Cursor = Cursors.WaitCursor;

                int selectedrowindex = InspectionProcessDetails_dgv.SelectedCells[0].RowIndex;

                InspectionProcessVo InspectionCopyVo = (InspectionProcessVo)InspectionProcessDetails_dgv.Rows[selectedrowindex].DataBoundItem;

                InspectionProcessVo inspProcessVo = new InspectionProcessVo();
                inspProcessVo.InspectionFormatId      = FormatId;
                inspProcessVo.InspectionFormatCode    = FormatCode;
                inspProcessVo.InspectionFormatName    = FormatName;
                inspProcessVo.InspectionProcessIdCopy = InspectionCopyVo.InspectionProcessId;
                inspProcessVo.InspectionProcessName   = InspectionCopyVo.InspectionProcessName;

                AddInspectionProcessForFormatForm newAddForm = new AddInspectionProcessForFormatForm(CommonConstants.MODE_ADD, inspProcessVo);

                newAddForm.ShowDialog();

                if (newAddForm.IntSuccess > 0)
                {
                    messageData = new MessageData("mmci00001", Properties.Resources.mmci00001, null);
                    logger.Info(messageData);
                    popUpMessage.Information(messageData, Text);

                    GridBind();

                    if (InspectionProcessDetails_dgv.Rows.Count > 0 && InspectionProcessDetails_dgv.Columns.Count > 0 &&
                        InspectionProcessDetails_dgv.Columns["colInspectionProcessId"] != null)
                    {
                        int searchProcessId;
                        if (newAddForm.IntSuccess > 0)
                        {
                            searchProcessId = newAddForm.IntSuccess;
                        }
                        else
                        {
                            this.Cursor = Cursors.Default;
                            return;
                        }

                        DataGridViewRow row = InspectionProcessDetails_dgv.Rows
                                              .Cast <DataGridViewRow>()
                                              .FirstOrDefault(r => r.Cells["colInspectionProcessId"].Value.ToString().Equals(searchProcessId.ToString()));

                        if (row == null)
                        {
                            this.Cursor = Cursors.Default; return;
                        }

                        InspectionProcessDetails_dgv.Rows[row.Index].Selected = true;
                        InspectionProcessDetails_dgv_CellClick(sender, new DataGridViewCellEventArgs(0, row.Index));
                        InspectionProcessDetails_dgv.FirstDisplayedScrollingRowIndex = row.Index;
                    }
                }

                this.Cursor = Cursors.Default;
            }
        }
        /// <summary>
        /// delete the selected record
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void Delete_btn_Click(object sender, EventArgs e)
        {
            int selectedrowindex = InspectionProcessDetails_dgv.SelectedCells[0].RowIndex;

            DataGridViewRow selectedRow = InspectionProcessDetails_dgv.Rows[selectedrowindex];

            messageData = new MessageData("mmcc00004", Properties.Resources.mmcc00004, selectedRow.Cells["colInspectionProcessName"].Value.ToString());
            // Logger.Info(messageData);
            DialogResult dialogResult = popUpMessage.ConfirmationOkCancel(messageData, Text);

            if (dialogResult == DialogResult.OK)
            {
                InspectionProcessVo inVo = new InspectionProcessVo();

                inVo.InspectionProcessId = Convert.ToInt32(selectedRow.Cells["colInspectionProcessId"].Value.ToString());
                inVo.DeleteFlag          = true;
                //inVo.InspectionProcessCode = selectedRow.Cells["colInspectionProcessCode"].Value.ToString();

                string message = string.Format(Properties.Resources.mmci00038, "Inspection Process", selectedRow.Cells["colInspectionProcessName"].Value.ToString());
                StartProgress(message);

                ValueObjectList <ValueObject> inVoList     = new ValueObjectList <ValueObject>();
                InspectionFormatVo            passformatVo = FormFormatVo(inVo.InspectionProcessId);
                if (passformatVo == null || passformatVo.InspectionFormatId == 0)
                {
                    return;
                }

                inVoList.add(passformatVo);
                inVoList.add(inVo);
                inVoList.add(null);
                inVoList.add(null);
                inVoList.add(null);
                inVoList.add(null);
                inVoList.add(null);

                InspectionReturnVo outVo = new InspectionReturnVo();

                try
                {
                    outVo = (InspectionReturnVo)base.InvokeCbm(new UpdateAllInspectionFunctionMasterMntCbm(), inVoList, false);
                }
                catch (Framework.ApplicationException exception)
                {
                    popUpMessage.ApplicationError(exception.GetMessageData(), Text);
                    logger.Error(exception.GetMessageData());
                }
                finally
                {
                    CompleteProgress();
                }

                if (outVo == null)
                {
                    return;
                }
                if (outVo.InspectionFormatId > 0)
                {
                    FormatId = outVo.InspectionFormatId;
                }
                //FormDatatableFromVo();
                //ComboBind(InspectionFormatId_cmb, inspectionformatDatatable, "Name", "Id");
                //InspectionFormatId_cmb.SelectedValue = FormatId;
                GridBind();
                this.messageData = new MessageData("mmci00003", Properties.Resources.mmci00003, null);
                logger.Info(this.messageData);
                popUpMessage.Information(this.messageData, Text);



                //try
                //{

                //    InspectionProcessVo tableCount = CheckInspectionProcessRelationCbm(inVo);
                //    if (tableCount.InspectionProcessId > 0)
                //    {
                //        messageData = new MessageData("mmce00007", Properties.Resources.mmce00007, InspectionItem.ToString());
                //        popUpMessage.Information(messageData, Text);
                //        return;
                //    }

                //    InspectionProcessVo outVo = (InspectionProcessVo)base.InvokeCbm(new DeleteInspectionProcessMasterMntCbm(), inVo, false);

                //    if (outVo.AffectedCount > 0)
                //    {
                //        this.messageData = new MessageData("mmci00003", Properties.Resources.mmci00003, null);
                //        logger.Info(this.messageData);
                //        popUpMessage.Information(this.messageData, Text);

                //        GridBind();
                //    }
                //    else if (outVo.AffectedCount == 0)
                //    {
                //        messageData = new MessageData("mmci00007", Properties.Resources.mmci00007, null);
                //        logger.Info(messageData);
                //        popUpMessage.Information(messageData, Text);
                //        GridBind();
                //    }
                //}
                //catch (Framework.ApplicationException exception)
                //{
                //    popUpMessage.ApplicationError(exception.GetMessageData(), Text);
                //    logger.Error(exception.GetMessageData());
                //}
            }
            else if (dialogResult == DialogResult.Cancel)
            {
                //do something else
            }
        }
 public void SetupSource(MessageData messageData)
 {
 }
Exemple #40
0
        bool Checkdata()
        {
            if (lot_txt.Text.Length < 3)
            {
                messageData = new MessageData("mmcc00005", Properties.Resources.mmcc00005, lot_lbl.Text);
                popUpMessage.Warning(messageData, Text);
                lot_txt.Focus();
                return(false);
            }
            if (plan_txt.Text == "")
            {
                messageData = new MessageData("mmcc00005", Properties.Resources.mmcc00005, plan_lbl.Text);
                popUpMessage.Warning(messageData, Text);
                plan_txt.Focus();
                return(false);
            }
            if (st_plan_txt.Text == "")
            {
                messageData = new MessageData("mmcc00005", Properties.Resources.mmcc00005, st_plan_lbl.Text);
                popUpMessage.Warning(messageData, Text);
                st_plan_txt.Focus();
                return(false);
            }
            if (st_actual_txt.Text == "")
            {
                messageData = new MessageData("mmcc00005", Properties.Resources.mmcc00005, st_actual_lbl.Text);
                popUpMessage.Warning(messageData, Text);
                st_actual_txt.Focus();
                return(false);
            }
            if (actual_co_txt.Text == "")
            {
                messageData = new MessageData("mmcc00005", Properties.Resources.mmcc00005, actual_co_lbl.Text);
                popUpMessage.Warning(messageData, Text);
                actual_co_txt.Focus();
                return(false);
            }
            if (absent_co_txt.Text == "")
            {
                messageData = new MessageData("mmcc00005", Properties.Resources.mmcc00005, absent_co_lbl.Text);
                popUpMessage.Warning(messageData, Text);
                absent_co_txt.Focus();
                return(false);
            }
            if (actual_ra_txt.Text == "")
            {
                messageData = new MessageData("mmcc00005", Properties.Resources.mmcc00005, actual_ra_lbl.Text);
                popUpMessage.Warning(messageData, Text);
                actual_ra_txt.Focus();
                return(false);
            }
            if (absent_ra_txt.Text == "")
            {
                messageData = new MessageData("mmcc00005", Properties.Resources.mmcc00005, absent_ra_lbl.Text);
                popUpMessage.Warning(messageData, Text);
                absent_ra_txt.Focus();
                return(false);
            }
            if (actual_ma_txt.Text == "")
            {
                messageData = new MessageData("mmcc00005", Properties.Resources.mmcc00005, actual_ma_lbl.Text);
                popUpMessage.Warning(messageData, Text);
                actual_ma_txt.Focus();
                return(false);
            }
            if (absent_ma_txt.Text == "")
            {
                messageData = new MessageData("mmcc00005", Properties.Resources.mmcc00005, absent_ma_lbl.Text);
                popUpMessage.Warning(messageData, Text);
                absent_ma_txt.Focus();
                return(false);
            }
            if (actual_ba_txt.Text == "")
            {
                messageData = new MessageData("mmcc00005", Properties.Resources.mmcc00005, actual_ba_lbl.Text);
                popUpMessage.Warning(messageData, Text);
                actual_ba_txt.Focus();
                return(false);
            }
            if (absent_ba_txt.Text == "")
            {
                messageData = new MessageData("mmcc00005", Properties.Resources.mmcc00005, absent_ba_lbl.Text);
                popUpMessage.Warning(messageData, Text);
                absent_ba_txt.Focus();
                return(false);
            }
            if (actual_ca_txt.Text == "")
            {
                messageData = new MessageData("mmcc00005", Properties.Resources.mmcc00005, actual_ca_lbl.Text);
                popUpMessage.Warning(messageData, Text);
                actual_ca_txt.Focus();
                return(false);
            }
            if (absent_ca_txt.Text == "")
            {
                messageData = new MessageData("mmcc00005", Properties.Resources.mmcc00005, absent_ca_lbl.Text);
                popUpMessage.Warning(messageData, Text);
                absent_ca_txt.Focus();
                return(false);
            }


            if (shift_cmb.SelectedItem == null)
            {
                messageData = new MessageData("mmcc00005", Properties.Resources.mmcc00005, shift_lbl.Text);
                popUpMessage.Warning(messageData, Text);
                shift_cmb.Focus();
                return(false);
            }
            if (line_cmb.Text == "" || line_cmb.Text == "All Line")
            {
                messageData = new MessageData("mmcc00005", Properties.Resources.mmcc00005, line_lbl.Text);
                popUpMessage.Warning(messageData, Text);
                line_cmb.Focus();
                return(false);
            }
            if (model_cmb.Text == "")
            {
                messageData = new MessageData("mmcc00005", Properties.Resources.mmcc00005, model_lbl.Text);
                popUpMessage.Warning(messageData, Text);
                model_cmb.Focus();
                return(false);
            }
            PersonVo check = (PersonVo)DefaultCbmInvoker.Invoke(new CheckPerson_DuplicateCbm(), new PersonVo()
            {
                DateTimes = datetime_dtp.Value, Model = model_cmb.Text, Line = line_cmb.Text, Shift = int.Parse(shift_cmb.Text)
            });

            if (check.AffectedCount >= 1 && add_btn.Text == "Cập Nhật")
            {
                messageData = new MessageData("mmcc00005", "Dữ liệu ca " + shift_cmb.Text + " Line " + line_cmb.Text + " ngày " + datetime_dtp.Text + " đã tồn tại !", leader_lbl.Text);
                popUpMessage.Warning(messageData, Text);
                leader_txt.Focus();
                return(false);
            }

            if (leader_txt.Text == "")
            {
                messageData = new MessageData("mmcc00005", Properties.Resources.mmcc00005, leader_lbl.Text);
                popUpMessage.Warning(messageData, Text);
                leader_txt.Focus();
                return(false);
            }
            return(true);
        }
Exemple #41
0
        public async Task <Result> SendAndConnectMessageAsync()
        {
            /*
             * var serverPort = ((_port > 0) ? _port : CliServDefaults.DfltPort);
             * string address = _ip;
             *
             * // Connect to the Server
             * var connectResult = await conn.ConnectAsync(_port, _ip, 3000, 10);
             *
             * Console.WriteLine("Connecting to IP: {0}, Port: {1}", (!String.IsNullOrEmpty(address) ? address : "localhost"), serverPort);
             *
             * // Connection failure. Just return
             * if (connectResult.Failure)
             * {
             *  return Result.Fail("There was an error connecting to the server.");
             * }
             *
             * _clientSocket = connectResult.Value;
             */

            if (!_clientSocket.Connected)
            {
                var connectResult = await Connect();

                if (connectResult.Failure)
                {
                    return(Result.Fail("No connection."));
                }
            }

            // Register a name for this client
            if (reset)
            {
                Console.WriteLine("<<< Reset detected.  Hit ENTER before typing name. >>>");
                reset = false;
            }
            MessageData sendData = new MessageData()
            {
                name = _name
            };
            MessageData eventData = null;

            while (!done)
            {
                // Reset connection vars.
                ResetEvent?.Invoke(false);
                sndResult = null;
                rcvResult = null;
                //EnableRead();

                try
                {
                    eventData = UserSendEvent();
                    if (eventData != null)
                    {
                        string message = (string)eventData.message;

                        if (String.Compare(message, "exit", true) == 0)
                        {
                            done    = true;
                            message = "I'm exiting.  Goodbye.";
                        }
                        sendData.message = message;
                        sendData.id      = eventData.id;

                        if (sendData.id > 0)
                        {
                            var sendResult = await SendMessageAsync(sendData);

                            if (sendResult.Failure)
                            {
                                return(sendResult);
                            }
                        }
                        else
                        {
                            System.Threading.Thread.Sleep(250);
                        }
                    }
                    else
                    {
                        Console.WriteLine("Empty Message.");
                    }
                }
                catch (InvalidOperationException)
                {
                    Console.WriteLine("Input Cancelled.");
                }
                catch (OperationCanceledException)
                {
                    Console.WriteLine("Input Cancelled.");
                }
            }

            // Report successful
            return(Result.Ok());
        }
Exemple #42
0
 public IActionResult Notifications([FromBody] MessageData msg)
 {
     NEEOEnvironment.Logger.LogInformation($"Notification {msg.Type} - {msg.Data}");
     return(Ok());
 }
 public bool Handle(MessageData <TParameters> eventData)
 {
     eventAction.Invoke(eventData);
     return(true);
 }
Exemple #44
0
 private Task SendChangeEmailMessage(MessageData data)
 {
     return(PrepareAndSendMailAsync <SystemMessage>(data, "ConfirmChangedEmail", "Potwierdź adres e-mail"));
 }
 public override Task DeleteMessageAsync(MessageData message, SessionBase?session = null)
 {
     this.stats.PendingOrchestratorMessages.TryRemove(message.OriginalQueueMessage.Id, out _);
     return(base.DeleteMessageAsync(message, session));
 }
Exemple #46
0
 private Task SendConfirmAccountMessage(MessageData data)
 {
     return(PrepareAndSendMailAsync <SystemMessage>(data, "ConfirmAccountEmail", "Potwierdź swoje konto"));
 }
        /*
         * thuat toan
         * A = acquisition_cost_cmb.Text
         * B = current_depreciation_txt.Text
         * C =  monthl_depreciation_txt.Text
         * D = accum_depreciation_txt.Text
         * E = net_value_txt.Text
         * accountmainVo.MonthCounter = y nhu tren
         * TL = asset_life_cmb.Text
         * ==>
         * C= A/(TL*12)
         * B = accountmainVo.MonthCounter*c
         * D = B+ C
         * E = A -D
         */
        bool Checkdata()
        {
            if (user_location_code_txt.Text.Trim().Length == 0)
            {
                messageData = new MessageData("mmcc00005", Properties.Resources.mmcc00005, UserCode_lbl.Text);
                popUpMessage.Warning(messageData, Text);
                user_location_code_txt.Focus();
                return(false);
            }
            if (asset_code_txt.Text.Trim().Length == 0)
            {
                messageData = new MessageData("mmcc00005", Properties.Resources.mmcc00005, asset_code_lbl.Text);
                popUpMessage.Warning(messageData, Text);
                asset_code_txt.Focus();
                return(false);
            }
            if (rank_code_cmb.SelectedItem == null)
            {
                messageData = new MessageData("mmcc00005", Properties.Resources.mmcc00005, rank_code_lbl.Text);
                popUpMessage.Warning(messageData, Text);
                rank_code_cmb.Focus();
                return(false);
            }
            if (account_code_cmb.SelectedItem == null)
            {
                messageData = new MessageData("mmcc00005", Properties.Resources.mmcc00005, account_code_lbl.Text);
                popUpMessage.Warning(messageData, Text);
                account_code_cmb.Focus();
                return(false);
            }
            if (section_cd_cmb.SelectedItem == null)
            {
                messageData = new MessageData("mmcc00005", Properties.Resources.mmcc00005, section_cd_lbl.Text);
                popUpMessage.Warning(messageData, Text);
                section_cd_cmb.Focus();
                return(false);
            }
            if (location_cmb.SelectedItem == null)
            {
                messageData = new MessageData("mmcc00005", Properties.Resources.mmcc00005, location_lbl.Text);
                popUpMessage.Warning(messageData, Text);
                location_cmb.Focus();
                return(false);
            }
            if (unit_cmb.SelectedItem == null)
            {
                messageData = new MessageData("mmcc00005", Properties.Resources.mmcc00005, unit_lbl.Text);
                popUpMessage.Warning(messageData, Text);
                unit_cmb.Focus();
                return(false);
            }
            if (user_location_name_cmb.SelectedItem == null)
            {
                messageData = new MessageData("mmcc00005", Properties.Resources.mmcc00005, user_location_name_lbl.Text);
                popUpMessage.Warning(messageData, Text);
                user_location_name_cmb.Focus();
                return(false);
            }
            if (qty_txt.Text.Trim().Length == 0)
            {
                messageData = new MessageData("mmcc00005", Properties.Resources.mmcc00005, qty_lbl.Text);
                popUpMessage.Warning(messageData, Text);
                qty_txt.Focus();
                return(false);
            }
            if (end_depreciation_dtp.Value <= start_depreciation_dtp.Value)
            {
                messageData = new MessageData("mmcc00005", Properties.Resources.mmcc00005, end_depreciation_lbl.Text);
                popUpMessage.Warning(messageData, Text);
                end_depreciation_dtp.Focus();
                return(false);
            }

            return(true);
        }
Exemple #48
0
        private void add_btn_Click(object sender, EventArgs e)
        {
            totaltime();
            if (Checkdata())
            {
                PersonVo outvo = new PersonVo();
                try
                {
                    if (add_btn.Text == "Cập Nhật")
                    {
                        PersonVo invo = new PersonVo
                        {
                            Model                = model_cmb.Text,
                            Line                 = line_cmb.Text,
                            DateTimes            = datetime_dtp.Value,
                            FactoryCode          = UserData.GetUserData().FactoryCode,
                            BuildingCode         = "2A",
                            LotNumber            = lot_txt.Text,
                            LeaderName           = leader_txt.Text,
                            Shift                = int.Parse(shift_cmb.Text),
                            PlanPro              = int.Parse(plan_txt.Text),
                            PlanST               = double.Parse(st_plan_txt.Text),
                            ActualSt             = double.Parse(st_actual_txt.Text),
                            DoCo                 = double.Parse(actual_co_txt.Text),
                            DoRa                 = double.Parse(actual_ra_txt.Text),
                            DoCa                 = double.Parse(actual_ca_txt.Text),
                            DoBa                 = double.Parse(actual_ba_txt.Text),
                            DoMa                 = double.Parse(actual_ma_txt.Text),
                            AbsentCo             = double.Parse(absent_co_txt.Text),
                            AbsentRa             = double.Parse(absent_ra_txt.Text),
                            AbsentCa             = double.Parse(absent_ca_txt.Text),
                            AbsentBa             = double.Parse(absent_ba_txt.Text),
                            AbsentMa             = double.Parse(absent_ma_txt.Text),
                            TimeOver             = double.Parse(overtime_txt.Text),
                            TimeOffset           = double.Parse(offsettime_txt.Text),
                            TimeTotal            = double.Parse(totaltime_txt.Text),
                            RegistrationUserCode = UserData.GetUserData().UserCode,
                        };
                        outvo = (PersonVo)DefaultCbmInvoker.Invoke(new AddPersonProCbm(), invo);
                    }
                    else if (add_btn.Text == "Chỉnh Sửa")
                    {
                        PersonVo invoUpdate = new PersonVo
                        {
                            PersonId             = vo.PersonId,
                            Model                = model_cmb.Text,
                            Line                 = line_cmb.Text,
                            DateTimes            = datetime_dtp.Value,
                            FactoryCode          = UserData.GetUserData().FactoryCode,
                            BuildingCode         = "2A",
                            LotNumber            = lot_txt.Text,
                            LeaderName           = leader_txt.Text,
                            Shift                = int.Parse(shift_cmb.Text),
                            PlanPro              = int.Parse(plan_txt.Text),
                            PlanST               = double.Parse(st_plan_txt.Text),
                            ActualSt             = double.Parse(st_actual_txt.Text),
                            DoCo                 = double.Parse(actual_co_txt.Text),
                            DoRa                 = double.Parse(actual_ra_txt.Text),
                            DoCa                 = double.Parse(actual_ca_txt.Text),
                            DoBa                 = double.Parse(actual_ba_txt.Text),
                            DoMa                 = double.Parse(actual_ma_txt.Text),
                            AbsentCo             = double.Parse(absent_co_txt.Text),
                            AbsentRa             = double.Parse(absent_ra_txt.Text),
                            AbsentCa             = double.Parse(absent_ca_txt.Text),
                            AbsentBa             = double.Parse(absent_ba_txt.Text),
                            AbsentMa             = double.Parse(absent_ma_txt.Text),
                            TimeOver             = double.Parse(overtime_txt.Text),
                            TimeOffset           = double.Parse(offsettime_txt.Text),
                            TimeTotal            = double.Parse(totaltime_txt.Text),
                            RegistrationUserCode = UserData.GetUserData().UserCode
                        };
                        outvo             = (PersonVo)DefaultCbmInvoker.Invoke(new UpdatePersonProCbm(), invoUpdate);
                        add_btn.Text      = "Cập Nhật";
                        add_btn.BackColor = Color.Green;
                        setting_gbc.Text  = "Info";
                    }

                    messageData = new MessageData("mmce00001", Properties.Resources.mmce00001, leader_lbl.Text + " : " + leader_txt.Text);
                    logger.Info(messageData);
                    popUpMessage.Information(messageData, Text);
                    clearcmb();
                }
                catch (Framework.ApplicationException exception)
                {
                    popUpMessage.ApplicationError(exception.GetMessageData(), Text);
                    logger.Error(exception.GetMessageData());
                    return;
                }
            }
        }
Exemple #49
0
        public async Task <ActionResult> Add(int threadId = 0, int messageIdToQuote = 0)
        {
            if (this.HttpContext.Session.IsAnonymousUser())
            {
                return(RedirectToAction("Index", "Home"));
            }

            var(userMayAddMessages, thread) = await PerformAddMessageSecurityChecksAsync(threadId);

            if (!userMayAddMessages)
            {
                return(RedirectToAction("Index", "Home"));
            }

            MessageEntity messageToQuote       = null;
            UserEntity    userOfMessageToQuote = null;

            if (messageIdToQuote > 0)
            {
                messageToQuote = await MessageGuiHelper.GetMessageAsync(messageIdToQuote);

                if (messageToQuote == null || messageToQuote.ThreadID != threadId)
                {
                    // doesn't exist, or is in another thread, ignore.
                    return(RedirectToAction("Index", "Home"));
                }

                userOfMessageToQuote = await UserGuiHelper.GetUserAsync(messageToQuote.PostedByUserID);

                if (userOfMessageToQuote == null)
                {
                    return(RedirectToAction("Index", "Home"));
                }
            }

            var forum = await _cache.GetForumAsync(thread.ForumID);

            if (forum == null)
            {
                return(RedirectToAction("Index", "Home"));
            }

            string messageTextForEditor = messageToQuote == null
                                ? string.Empty
                                : string.Format("@quote {0}{1}{2}{1}@end{1}", userOfMessageToQuote.NickName, Environment.NewLine,
                                                messageToQuote.MessageText);
            var messageData = new MessageData()
            {
                MessageText         = messageTextForEditor,
                CurrentUserID       = this.HttpContext.Session.GetUserID(),
                ForumID             = forum.ForumID,
                ThreadID            = thread.ThreadID,
                ForumName           = forum.ForumName,
                SectionName         = await _cache.GetSectionNameAsync(forum.SectionID),
                ThreadSubject       = thread.Subject,
                PageNo              = 1,
                LastMessageInThread = await ThreadGuiHelper.GetLastMessageInThreadDtoAsync(threadId),
            };

            return(View(messageData));
        }
Exemple #50
0
        private void bindMsgDetail( int id, MessageData msgData, IMember dataSender )
        {
            String senderUrl = "";
            String replyButton = "";
            if (dataSender.GetType() != typeof( Site )) {
                String userLink = getFullUrl( toUser( dataSender ) );
                senderUrl = string.Format( "<span class=\"senderUrl\">&lt;<a href=\"{0}\" target=\"_blank\">{0}</a>&gt;</span>&nbsp;<a href=\"{0}\" target=\"_blank\">{1}</a>", userLink, lang( "viewSender" ) );
                replyButton = string.Format( "<a href=\"{1}\" />{0}</a>", lang( "reply" ), to( Reply, id ) );
            }

            set( "m.SenderUrl", senderUrl );
            set( "m.ReplyButton", replyButton );
            set( "m.ForwardUrl", to( Forward, id ) );
            set( "m.PrevUrl", getPrevUrl( id ) );
            set( "m.NextUrl", getNextUrl( id ) );
            set( "m.DeleteUrl", to( Delete, id ) );

            set( "m.Sender", msgData.SenderName );
            set( "m.Title", msgData.Title );
            set( "m.CreateTime", msgData.Created );
            set( "m.Content", msgData.Body );
        }
Exemple #51
0
 private Task SendResetPasswordMessage(MessageData data)
 {
     return(PrepareAndSendMailAsync <SystemMessage>(data, "ResetPasswordEmail", "Ustaw nowe hasło"));
 }
        /// <summary>
        /// update data to db
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void Ok_btn_Click(object sender, EventArgs e)
        {
            var sch = StringCheckHelper.GetInstance();

            if (CheckMandatory())
            {
                if (!sch.IsASCII(UserCode_txt.Text))
                {
                    messageData = new MessageData("mmce00003", Properties.Resources.mmce00003);
                    logger.Info(messageData);
                    popUpMessage.ConfirmationOkCancel(messageData, Text);
                    UserCode_txt.Focus();

                    return;
                }

                //if (string.IsNullOrEmpty(UserCode_txt.Text) || string.IsNullOrEmpty(UserName_txt.Text))
                //{
                //    messageData = new MessageData("mmce00003", Properties.Resources.mmce00003);
                //    logger.Info(messageData);
                //    popUpMessage.ConfirmationOkCancel(messageData, Text);

                //    if (string.IsNullOrEmpty(UserCode_txt.Text))
                //    {
                //        UserCode_txt.Focus();
                //    }
                //    else
                //    {
                //        UserName_txt.Focus();
                //    }
                //    return;
                //}

                string multilogin = string.Empty;
                string language   = string.Empty;
                int    country    = 0;

                if (MultiLogin_chk.Checked)
                {
                    multilogin = "******";
                }

                //if (Language_cmb.SelectedIndex > -1)
                //{
                //    language = Language_cmb.SelectedValue.ToString();
                //}
                if (Country_cmb.SelectedIndex > -1)
                {
                    country = Convert.ToInt32(Country_cmb.SelectedValue.ToString());
                }



                UserVo inVo = new UserVo
                {
                    UserCode = UserCode_txt.Text.Trim(),
                    UserName = UserName_txt.Text.Trim(),
                    PassWord = encryptDecrypt.Encrypt(Password_txt.Text.Trim()),
                    //Language = language,
                    MultiLoginFlag          = multilogin,
                    IpAddress               = UserData.GetUserData().IpAddress,
                    RegistrationUserCode    = UserData.GetUserData().UserCode,
                    LocaleId                = country,
                    RegistrationFactoryCode = FactoryCode_cmb.SelectedValue.ToString()
                };
                if (string.Equals(mode, CommonConstants.MODE_ADD))
                {
                    UserVo checkVo = DuplicateCheck(inVo);

                    if (checkVo != null && checkVo.AffectedCount > 0)
                    {
                        messageData = new MessageData("mmce00001", Properties.Resources.mmce00001, UserCode_lbl.Text + " : " + UserCode_txt.Text);
                        popUpMessage.ConfirmationOkCancel(messageData, Text);

                        return;
                    }
                }

                try
                {
                    if (string.Equals(mode, CommonConstants.MODE_ADD))
                    {
                        UserVo outVo = (UserVo)base.InvokeCbm(new AddLoginPasswordMasterMntCbm(), inVo, false);
                        IntSuccess = outVo.AffectedCount;
                    }
                    else if (string.Equals(mode, CommonConstants.MODE_UPDATE))
                    {
                        UserVo outVo = (UserVo)base.InvokeCbm(new UpdateLocalUserMasterMntCbm(), inVo, false);
                        IntSuccess = outVo.AffectedCount;
                    }
                }
                catch (Framework.ApplicationException exception)
                {
                    popUpMessage.ApplicationError(exception.GetMessageData(), Text);
                    logger.Error(exception.GetMessageData());
                    return;
                }

                if ((IntSuccess > 0) || (IntSuccess == 0))
                {
                    this.Close();
                }
            }
        }
Exemple #53
0
 private Task SendMessageFromUser(MessageData data)
 {
     return(PrepareAndSendMailAsync <UserMessage>(data, "FeedbackEmail", ((UserMessage)data.Model).Subject));
 }
Exemple #54
0
    public void StartSend(int opCode, int subCode, object value)
    {
        MessageData msg = new MessageData(opCode, subCode, value);

        StartSend(msg);
    }
        public void AddConsultation( SMT.Workflow.Common.Model.FLOW_CONSULTATION_T flowConsultation, SubmitData submitData)
        {
            if (strIsFlowEngine.ToLower() == "true")
            {
                try
                {
                    #region 记录日志
                    SMT.Workflow.Common.Model.FLOW_CONSULTATION_T entity = flowConsultation;
                    StringBuilder sb = new StringBuilder();
                    sb.AppendLine("FLOW_CONSULTATION_T entity= new FLOW_CONSULTATION_T();");//
                    sb.AppendLine("entity.CONSULTATIONID = \"" + entity.CONSULTATIONID + "\";");//
                    sb.AppendLine("entity.FLOWRECORDDETAILID = \"" + (entity.FLOW_FLOWRECORDDETAIL_T == null ? "" : entity.FLOW_FLOWRECORDDETAIL_T.FLOWRECORDDETAILID) + "\";");
                    sb.AppendLine("entity.CONSULTATIONUSERID = \"" + entity.CONSULTATIONUSERID + "\";");
                    sb.AppendLine("entity.CONSULTATIONUSERNAME = \"" + entity.CONSULTATIONUSERNAME + "\";");
                    sb.AppendLine("entity.CONSULTATIONCONTENT =\"" + entity.CONSULTATIONCONTENT + "\";");
                    sb.AppendLine("entity.CONSULTATIONDATE = \"" + entity.CONSULTATIONDATE + "\";");
                    sb.AppendLine("entity.REPLYUSERID = \"" + entity.REPLYUSERID + "\";");
                    sb.AppendLine("entity.REPLYUSERNAME = \"" + entity.REPLYUSERNAME + "\";");
                    sb.AppendLine("entity.REPLYCONTENT = \"" + entity.REPLYCONTENT + "\";");
                    sb.AppendLine("entity.REPLYDATE = \"" + entity.REPLYDATE + "\";");
                    sb.AppendLine("entity.FLAG = \"" + entity.FLAG + "\";");//0未回复,1回复

                    sb.AppendLine("FLOW_FLOWRECORDDETAIL_T model=new FLOW_FLOWRECORDDETAIL_T();");
                    sb.AppendLine("  model.FLOWRECORDDETAILID=\"" + entity.FLOW_FLOWRECORDDETAIL_T.FLOWRECORDDETAILID + "\";");
                    //sb.AppendLine("  model.FLOWRECORDMASTERID=\""+entity.FLOW_FLOWRECORDDETAIL_T.FLOWRECORDMASTERID+"\";");
                    sb.AppendLine("  model.STATECODE=\"" + entity.FLOW_FLOWRECORDDETAIL_T.STATECODE + "\";");
                    sb.AppendLine("  model.PARENTSTATEID=\"" + entity.FLOW_FLOWRECORDDETAIL_T.PARENTSTATEID + "\";");
                    sb.AppendLine("  model.CONTENT=\"" + entity.FLOW_FLOWRECORDDETAIL_T.CONTENT + "\";");
                    sb.AppendLine("  model.CHECKSTATE=\"" + entity.FLOW_FLOWRECORDDETAIL_T.CHECKSTATE + "\";//同意:1,不同意:0 ,未处理:2,会签同意7,会签不同意8");
                    sb.AppendLine("  model.FLAG=\"" + entity.FLOW_FLOWRECORDDETAIL_T.FLAG + "\";//已审批:1,未审批:0");
                    sb.AppendLine("  model.CREATEUSERID=\"" + entity.FLOW_FLOWRECORDDETAIL_T.CREATEUSERID + "\";");
                    sb.AppendLine("  model.CREATEUSERNAME=\"" + entity.FLOW_FLOWRECORDDETAIL_T.CREATEUSERNAME + "\";");
                    sb.AppendLine("  model.CREATECOMPANYID=\"" + entity.FLOW_FLOWRECORDDETAIL_T.CREATECOMPANYID + "\";");
                    sb.AppendLine("  model.CREATEDEPARTMENTID=\"" + entity.FLOW_FLOWRECORDDETAIL_T.CREATEDEPARTMENTID + "\";");
                    sb.AppendLine("  model.CREATEPOSTID=\"" + entity.FLOW_FLOWRECORDDETAIL_T.CREATEPOSTID + "\";");
                    sb.AppendLine("  model.CREATEDATE=\"" + entity.FLOW_FLOWRECORDDETAIL_T.CREATEDATE + "\";");
                    sb.AppendLine("  model.EDITUSERID=\"" + entity.FLOW_FLOWRECORDDETAIL_T.EDITUSERID + "\";");
                    sb.AppendLine("  model.EDITUSERNAME=\"" + entity.FLOW_FLOWRECORDDETAIL_T.EDITUSERNAME + "\";");
                    sb.AppendLine("  model.EDITCOMPANYID=\"" + entity.FLOW_FLOWRECORDDETAIL_T.EDITCOMPANYID + "\";");
                    sb.AppendLine("  model.EDITDEPARTMENTID=\"" + entity.FLOW_FLOWRECORDDETAIL_T.EDITDEPARTMENTID + "\";");
                    sb.AppendLine("  model.EDITPOSTID=\"" + entity.FLOW_FLOWRECORDDETAIL_T.EDITPOSTID + "\";");
                    sb.AppendLine("  model.EDITDATE=\"" + entity.FLOW_FLOWRECORDDETAIL_T.EDITDATE + "\";");
                    sb.AppendLine("  model.AGENTUSERID=\"" + entity.FLOW_FLOWRECORDDETAIL_T.AGENTUSERID + "\";");
                    sb.AppendLine("  model.AGENTERNAME=\"" + entity.FLOW_FLOWRECORDDETAIL_T.AGENTERNAME + "\";");
                    sb.AppendLine("  model.AGENTEDITDATE=\"" + entity.FLOW_FLOWRECORDDETAIL_T.AGENTEDITDATE + "\";");
                    sb.AppendLine("  entity.FLOW_FLOWRECORDDETAIL_T = model;");

                    sb.AppendLine("FLOW_FLOWRECORDMASTER_T eentity=new FLOW_FLOWRECORDMASTER_T();");
                    sb.AppendLine("  eentity.FLOWRECORDMASTERID=\"" + entity.FLOW_FLOWRECORDDETAIL_T.FLOW_FLOWRECORDMASTER_T.FLOWRECORDMASTERID + "\";");
                    sb.AppendLine("  eentity.INSTANCEID=\"" + entity.FLOW_FLOWRECORDDETAIL_T.FLOW_FLOWRECORDMASTER_T.INSTANCEID + "\";");
                    sb.AppendLine("  eentity.FLOWSELECTTYPE=\"" + entity.FLOW_FLOWRECORDDETAIL_T.FLOW_FLOWRECORDMASTER_T.FLOWSELECTTYPE + "\";//0:固定流程,1:自选流程");
                    sb.AppendLine("  eentity.MODELCODE=\"" + entity.FLOW_FLOWRECORDDETAIL_T.FLOW_FLOWRECORDMASTER_T.MODELCODE + "\";");
                    sb.AppendLine("  eentity.FLOWCODE=\"" + entity.FLOW_FLOWRECORDDETAIL_T.FLOW_FLOWRECORDMASTER_T.FLOWCODE + "\";");
                    sb.AppendLine("  eentity.FORMID=\"" + entity.FLOW_FLOWRECORDDETAIL_T.FLOW_FLOWRECORDMASTER_T.FORMID + "\";");
                    sb.AppendLine("  eentity.FLOWTYPE=\"" + entity.FLOW_FLOWRECORDDETAIL_T.FLOW_FLOWRECORDMASTER_T.FLOWTYPE + "\";//0:审批流程,1:任务流程");
                    sb.AppendLine("  eentity.CHECKSTATE=\"" + entity.FLOW_FLOWRECORDDETAIL_T.FLOW_FLOWRECORDMASTER_T.CHECKSTATE + "\";//1:审批中,2:审批通过,3审批不通过,5撤销(为与字典保持一致)");
                    sb.AppendLine("  eentity.CREATEUSERID=\"" + entity.FLOW_FLOWRECORDDETAIL_T.FLOW_FLOWRECORDMASTER_T.CREATEUSERID + "\";");
                    sb.AppendLine("  eentity.CREATEUSERNAME=\"" + entity.FLOW_FLOWRECORDDETAIL_T.FLOW_FLOWRECORDMASTER_T.CREATEUSERNAME + "\";");
                    sb.AppendLine("  eentity.CREATECOMPANYID=\"" + entity.FLOW_FLOWRECORDDETAIL_T.FLOW_FLOWRECORDMASTER_T.CREATECOMPANYID + "\";");
                    sb.AppendLine("  eentity.CREATEDEPARTMENTID=\"" + entity.FLOW_FLOWRECORDDETAIL_T.FLOW_FLOWRECORDMASTER_T.CREATEDEPARTMENTID + "\";");
                    sb.AppendLine("  eentity.CREATEPOSTID=\"" + entity.FLOW_FLOWRECORDDETAIL_T.FLOW_FLOWRECORDMASTER_T.CREATEPOSTID + "\";");
                    sb.AppendLine("  eentity.CREATEDATE=\"" + entity.FLOW_FLOWRECORDDETAIL_T.FLOW_FLOWRECORDMASTER_T.CREATEDATE + "\";");
                    sb.AppendLine("  eentity.EDITUSERID=\"" + entity.FLOW_FLOWRECORDDETAIL_T.FLOW_FLOWRECORDMASTER_T.EDITUSERID + "\";");
                    sb.AppendLine("  eentity.EDITUSERNAME=\"" + entity.FLOW_FLOWRECORDDETAIL_T.FLOW_FLOWRECORDMASTER_T.EDITUSERNAME + "\";");
                    sb.AppendLine("  eentity.EDITDATE=\"" + entity.FLOW_FLOWRECORDDETAIL_T.FLOW_FLOWRECORDMASTER_T.EDITDATE + "\";");
                    sb.AppendLine("  eentity.ACTIVEROLE=\"" + entity.FLOW_FLOWRECORDDETAIL_T.FLOW_FLOWRECORDMASTER_T.ACTIVEROLE + "\";");
                    sb.AppendLine("  eentity.BUSINESSOBJECT=\"" + entity.FLOW_FLOWRECORDDETAIL_T.FLOW_FLOWRECORDMASTER_T.BUSINESSOBJECT + "\";");
                    sb.AppendLine("  eentity.KPITIMEXML=\"" + entity.FLOW_FLOWRECORDDETAIL_T.FLOW_FLOWRECORDMASTER_T.KPITIMEXML + "\";");
                    sb.AppendLine("  entity.FLOW_FLOWRECORDDETAIL_T.FLOW_FLOWRECORDMASTER_T = eentity;");

                    Tracer.Debug("流程引擎的XML数据"+ "SubimtFlow入口处 进行咨询: FormID=" + submitData.FormID + ";ModelCode=" + submitData.ModelCode + " \r\n FLOW_CONSULTATION_T 实体:\r\n" + sb.ToString());
                    LogSubmitData(submitData);
                    #endregion

                    flowConsultation.FLOW_FLOWRECORDDETAIL_T.FLOW_FLOWRECORDMASTER_T =
                        FlowBLL.GetFLOW_FLOWRECORDMASTER_T( flowConsultation.FLOW_FLOWRECORDDETAIL_T.FLOW_FLOWRECORDMASTER_T.FLOWRECORDMASTERID);
                    //FlowEngineService.EngineWcfGlobalFunctionClient FlowEngine = new FlowEngineService.EngineWcfGlobalFunctionClient();
                    //FlowEngineService.CustomUserMsg[] cs = new FlowEngineService.CustomUserMsg[1];
                    //FlowEngineService.CustomUserMsg cu = new FlowEngineService.CustomUserMsg();
                    //cu.FormID = flowConsultation.FLOW_FLOWRECORDDETAIL_T.FLOW_FLOWRECORDMASTER_T.FORMID;
                    //cu.UserID = flowConsultation.REPLYUSERID;
                    //cs[0] = cu;

                    List<CustomUserMsg> UserAndForm = new List<CustomUserMsg>();
                    CustomUserMsg cu = new CustomUserMsg();
                    cu.FormID = flowConsultation.FLOW_FLOWRECORDDETAIL_T.FLOW_FLOWRECORDMASTER_T.FORMID;
                    cu.UserID = flowConsultation.REPLYUSERID;
                    UserAndForm.Add(cu);

                    ModelInfo modelinfo = FlowBLL.GetSysCodeByModelCode( submitData.ModelCode);
                    MessageData tmpMessageData = new MessageData("Flow", modelinfo.SysCode,
                        flowConsultation.FLOW_FLOWRECORDDETAIL_T.FLOW_FLOWRECORDMASTER_T.CREATECOMPANYID,
                        submitData.ModelCode, modelinfo.ModelName, submitData.FormID, flowConsultation.FLOW_FLOWRECORDDETAIL_T.STATECODE, flowConsultation.FLOW_FLOWRECORDDETAIL_T.CHECKSTATE, "", "", "", "");
                    FlowBLL flowBLL = new FlowBLL();
                    StringBuilder FlowResultXml = flowBLL.BuildMessageData(tmpMessageData);
                    //FlowEngine = new FlowEngineService.EngineWcfGlobalFunctionClient();
                    //log = FlowEngine.SaveFlowTriggerData(FlowResultXml.ToString(), submitData.XML);
                    if (!string.IsNullOrEmpty(flowConsultation.FLOW_FLOWRECORDDETAIL_T.FLOW_FLOWRECORDMASTER_T.BUSINESSOBJECT))
                    {
                        submitData.XML = flowConsultation.FLOW_FLOWRECORDDETAIL_T.FLOW_FLOWRECORDMASTER_T.BUSINESSOBJECT;
                    }

                    //bool b = FlowEngine.FlowConsultati(cs, "", FlowResultXml.ToString(), submitData.XML);
                    EnginFlowBLL efbll = new EnginFlowBLL();

                    bool b = efbll.FlowConsultati( UserAndForm, "", FlowResultXml.ToString(), submitData.XML);
                    if (!b)
                    {
                        Tracer.Debug("发送咨询失败:FormID" + flowConsultation.FLOW_FLOWRECORDDETAIL_T.FLOW_FLOWRECORDMASTER_T.FORMID
                            + "\n\r submitData.XML:" + submitData.XML);
                    }

                    FlowBLL bll = new FlowBLL();

                    bll.AddConsultation( flowConsultation);
                }
                catch (Exception ex)
                {
                    Tracer.Debug("发送咨询出错: FORMID=" + flowConsultation.FLOW_FLOWRECORDDETAIL_T.FLOW_FLOWRECORDMASTER_T.FORMID + "异常信息:\r\n" + ex.InnerException + ex.Message);
                    throw ex;
                }
                finally
                {
                }
            }
        }
Exemple #56
0
 protected virtual int SaveMessage(MessageData msg)
 {
     return(0);
 }
Exemple #57
0
 private String getAttachmentIcon( MessageData x )
 {
     return x.AttachmentCount > 0 ? string.Format( "<img src=\"{0}attachment.gif\" />", sys.Path.Img ) : "";
 }
Exemple #58
0
        ///Call the functions assigned to the event with argument
        public bool Dispatch <T>(string message, T arg, object sender = null)
        {
            if (sender == null)
            {
                sender = this;
            }

            List <object> targets;

            if (!listeners.TryGetValue(message, out targets))
            {
                return(false);
            }

            for (var i = 0; i < targets.Count; i++)
            {
                var target = targets[i];
                if (target == null)
                {
                    continue;
                }

                MethodInfo method = null;

                if (target is Delegate)
                {
                    method = (target as Delegate).RTGetDelegateMethodInfo();
                }
                else
                {
                    method = target.GetType().GetMethod(message, METHOD_FLAGS);
                }

                if (method == null)
                {
                    Logger.LogError(string.Format("Can't resolve method {0}.{1}.", target.GetType().Name, message), "Events", target);
                    continue;
                }

                var parameters = method.GetParameters();
                if (parameters.Length > 1)
                {
                    Logger.LogError(string.Format("Parameters on method {0}.{1}, are more than 1.", target.GetType().Name, message), "Events", target);
                    continue;
                }

                object[] argsArray = null;
                if (parameters.Length == 1)
                {
                    object realArg;
                    if (typeof(MessageData).RTIsAssignableFrom(parameters[0].ParameterType))
                    {
                        realArg = new MessageData <T>(arg, this.gameObject, sender);
                    }
                    else
                    {
                        realArg = arg;
                    }
                    argsArray = ReflectionTools.SingleTempArgsArray(realArg);
                }

                if (target is Delegate)
                {
                    (target as Delegate).DynamicInvoke(argsArray);
                }
                else
                {
                    if (method.ReturnType == typeof(IEnumerator))
                    {
                        MonoManager.current.StartCoroutine((IEnumerator)method.Invoke(target, argsArray));
                    }
                    else
                    {
                        method.Invoke(target, argsArray);
                    }
                }
            }

            return(true);
        }
        /// <summary>
        /// inserts new record
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void Ok_btn_Click(object sender, EventArgs e)
        {
            InspectionItemSelectionDatatypeValueVo inVo = new InspectionItemSelectionDatatypeValueVo();
            var sch = StringCheckHelper.GetInstance();

            if (CheckMandatory() == true)
            {
                inVo.InspectionItemSelectionDatatypeValueText = SelectionDatatypeValueText_txt.Text.Trim();

                inVo.DisplayOrder = Convert.ToInt32(InspectionItemDisplayOrder_txt.Text);

                if (InspectionItem_cmb.SelectedValue != null && InspectionItem_cmb.SelectedIndex >= 0)
                {
                    inVo.InspectionItemId = Convert.ToInt32(InspectionItem_cmb.SelectedValue.ToString());
                }

                if (updateData != null)
                {
                    inVo.InspectionItemId = updateData.InspectionItemId;
                }

                if (mode.Equals(CommonConstants.MODE_UPDATE))
                {
                    inVo.InspectionItemSelectionDatatypeValueId = updateData.InspectionItemSelectionDatatypeValueId;
                }

                inVo.Mode = mode;

                try
                {
                    if (string.Equals(mode, CommonConstants.MODE_ADD) || string.Equals(mode, CommonConstants.MODE_SELECT))
                    {
                        InspectionItemSelectionDatatypeValueVo checkVo = DuplicateCheck(inVo);
                        if (checkVo != null && checkVo.AffectedCount > 0)
                        {
                            messageData = new MessageData("mmce00001", Properties.Resources.mmce00001, SelectionDatatypeValueText_lbl.Text + " : " + SelectionDatatypeValueText_txt.Text);
                            popUpMessage.Information(messageData, Text);

                            return;
                        }

                        InspectionItemSelectionDatatypeValueVo checkDisplayVo = DuplicateDisplayCheck(inVo);
                        if (checkDisplayVo != null && checkDisplayVo.AffectedCount > 0)
                        {
                            messageData = new MessageData("mmce00001", Properties.Resources.mmce00001, InspectionItemDisplayOrder_lbl.Text + " : " + InspectionItemDisplayOrder_txt.Text);
                            logger.Info(messageData);
                            popUpMessage.Information(messageData, Text);
                            InspectionItemDisplayOrder_txt.Focus();
                            return;
                        }

                        inVo.InspectionItemSelectionDatatypeValueCode = InspectionItemCode
                                                                        + GlobalMasterDataTypeEnum.CODE_SEPARATOR.GetValue()
                                                                        + GlobalMasterDataTypeEnum.SELECTION_VALUE_CODE.GetValue() + GlobalMasterDataTypeEnum.CODE_SEPARATOR.GetValue() + RunningNumber;

                        UpdateResultVo outVo = (UpdateResultVo)base.InvokeCbm(new AddInspectionItemSelectionDatatypeValueCbm(), inVo, false);

                        IntSuccess = outVo.AffectedCount;
                    }
                    else if (mode.Equals(CommonConstants.MODE_UPDATE))
                    {
                        if (SelectionDatatypeValueText_txt.Text == updateData.InspectionItemSelectionDatatypeValueText && updateData.DisplayOrder == Convert.ToInt32(InspectionItemDisplayOrder_txt.Text))
                        {
                            return;
                        }
                        if (updateData.InspectionItemSelectionDatatypeValueText != SelectionDatatypeValueText_txt.Text)
                        {
                            InspectionItemSelectionDatatypeValueVo checkVo = DuplicateCheck(inVo);
                            if (checkVo != null && checkVo.AffectedCount > 0)
                            {
                                messageData = new MessageData("mmce00001", Properties.Resources.mmce00001, SelectionDatatypeValueText_lbl.Text + " : " + SelectionDatatypeValueText_txt.Text);
                                popUpMessage.Information(messageData, Text);

                                return;
                            }
                        }

                        if (updateData.DisplayOrder != Convert.ToInt32(InspectionItemDisplayOrder_txt.Text))
                        {
                            InspectionItemSelectionDatatypeValueVo checkDisplayVo = DuplicateDisplayCheck(inVo);
                            if (checkDisplayVo != null && checkDisplayVo.AffectedCount > 0)
                            {
                                messageData = new MessageData("mmce00001", Properties.Resources.mmce00001, InspectionItemDisplayOrder_lbl.Text + " : " + InspectionItemDisplayOrder_txt.Text);
                                logger.Info(messageData);
                                popUpMessage.Information(messageData, Text);
                                InspectionItemDisplayOrder_txt.Focus();
                                return;
                            }
                        }

                        if (updateData == null)
                        {
                            UpdateResultVo outResultVo = (UpdateResultVo)base.InvokeCbm(new UpdateInspectionItemSelectionDatatypeValueCbm(), inVo, false);
                            if (outResultVo == null)
                            {
                                return;
                            }
                            IntSuccess = outResultVo.AffectedCount;
                        }
                        else
                        {
                            string message = string.Format(Properties.Resources.mmci00037, "Inspection Item Selection Datatype Value", SelectionDatatypeValueText_txt.Text);
                            StartProgress(message);

                            ValueObjectList <ValueObject> inVoList     = new ValueObjectList <ValueObject>();
                            InspectionFormatVo            passformatVo = FormFormatVo(updateData.InspectionItemId);
                            if (passformatVo == null || passformatVo.InspectionFormatId == 0)
                            {
                                return;
                            }

                            inVoList.add(passformatVo);
                            inVoList.add(null);
                            inVoList.add(null);
                            inVoList.add(inVo);
                            inVoList.add(null);
                            inVoList.add(null);
                            inVoList.add(null);

                            InspectionReturnVo outVo = null;

                            try
                            {
                                outVo = (InspectionReturnVo)base.InvokeCbm(new UpdateAllInspectionFunctionMasterMntCbm(), inVoList, false);
                            }
                            catch (Framework.ApplicationException exception)
                            {
                                popUpMessage.ApplicationError(exception.GetMessageData(), Text);
                                logger.Error(exception.GetMessageData());
                                return;
                            }
                            finally
                            {
                                CompleteProgress();
                            }
                            if (outVo != null && outVo.AffectedCount > 0)
                            {
                                IntSuccess       = outVo.AffectedCount;
                                InspectionItemId = outVo.InspectionItemId;

                                InspectionFormatProcessBuzzLogic getprocessid = new InspectionFormatProcessBuzzLogic();
                                InspectionReturnVo invo = new InspectionReturnVo();
                                invo.InspectionItemId = outVo.InspectionItemId;
                                InspectionReturnVo getInspectionVo = getprocessid.RefreshAllFormGrid(invo);
                                if (getInspectionVo != null && getInspectionVo.InspectionProcessId > 0)
                                {
                                    InspectionProcessId = getInspectionVo.InspectionProcessId;
                                }
                            }
                        }
                        //UpdateInspectionItemSelectionDatatypeValueVo = new InspectionItemSelectionDatatypeValueVo();

                        //UpdateInspectionItemSelectionDatatypeValueVo = inVo;
                        //this.Close();
                    }
                }
                catch (Framework.ApplicationException exception)
                {
                    popUpMessage.ApplicationError(exception.GetMessageData(), Text);
                    logger.Error(exception.GetMessageData());
                    return;
                }

                if ((IntSuccess > 0))
                {
                    //messageData = new MessageData("mmci00001", Properties.Resources.mmci00001, null);
                    //logger.Info(messageData);
                    //popUpMessage.Information(messageData, Text);
                    this.Close();
                }
            }
        }
Exemple #60
0
        public static int PostMsg(string MchUName, string MchUPass, string MchIP, int MoPort, int MtPort, string mobile, string content, string customMsgID, out string msg)
        {
            int    result = -1;
            string errMsg = "";

            postMsg.SetUser(MchUName, MchUPass);
            postMsg.SetMOAddress(MchIP, MoPort, LinkType.SHORTLINK);         /// 设置上行网关地址、端口
            postMsg.SetGateWay(MchIP, MtPort, LinkType.SHORTLINK);           /// 设置下行网关地址、端口

            //普通端口,http端口 9050 18088
            //postMsg.SetMOAddress("211.147.239.62",9070, LinkType.SHORTLINK);         /// 设置上行网关地址、端口
            //postMsg.SetGateWay("211.147.239.62",9080, LinkType.SHORTLINK);           /// 设置下行网关地址、端口

            //400端口
            //postMsg.SetMOAddress("211.147.239.62", 8460, LinkType.SHORTLINK);         /// 设置上行网关地址、端口
            //postMsg.SetGateWay("211.147.239.62", 8450, LinkType.SHORTLINK);           /// 设置下行网关地址、端口

            MessageData[] messagedatas = new MessageData[1];   // 号码数量

            #region 群发
            ///////////////////////<<群发>>/////////////////
            for (int i = 0; i < messagedatas.Length; i++)
            {
                messagedatas[i]             = new MessageData();
                messagedatas[i].Content     = content;
                messagedatas[i].Phone       = mobile;
                messagedatas[i].vipFlag     = true;
                messagedatas[i].customMsgID = customMsgID;
                messagedatas[i].customNum   = "";
            }
            #endregion

            #region 组发
            ///////////////////////<<组发>>/////////////////
            //for (int i = 0; i < messagedatas.Length; i++)
            //{
            //    messagedatas[i] = new MessageData();
            //    messagedatas[i].Content = "内容" + i;
            //    messagedatas[i].Phone = "135" + i.ToString("D8");
            //    messagedatas[i].vipFlag = true;
            //    messagedatas[i].customMsgID = "3241111";
            //}
            #endregion

            #region
            ///////////////<<手动>>///////////////////
            //messagedatas[0] = new MessageData();
            //messagedatas[0].Content = "34";
            //messagedatas[0].Phone = "";
            //messagedatas[0].vipFlag = true;
            //messagedatas[0].customMsgID = "121";

            //messagedatas[1] = new MessageData();
            //messagedatas[1].Content = "rw";
            //messagedatas[1].Phone = "13580550705";
            //messagedatas[1].vipFlag = true;
            //messagedatas[1].customMsgID = "121";
            #endregion

            MTPack mtpack = new MTPack();
            mtpack.batchID      = Guid.NewGuid();
            mtpack.batchName    = "Rtxx" + DateTime.Now.ToString("yyyyMMdd"); /// 分批名称
            mtpack.msgs         = messagedatas;
            mtpack.msgType      = 1;
            mtpack.bizType      = 1;
            mtpack.customNum    = "";                      /// 扩展号
            mtpack.scheduleTime = 0;                       /// 时间使用int64类型,是指从1970-1-1 00:00:00开始到当前的毫秒数
            mtpack.sendType     = 0;                       /// 发送类型  0为群发   1为组发
            mtpack.distinctFlag = true;                    /// 是否过滤重复号码
            mtpack.deadline     = 0;                       /// 时间使用int64类型,是指从1970-1-1 00:00:00开始到当前的毫秒数
            mtpack.remark       = "";                      /// 备注

            GsmsResponse gr = postMsg.Post(new Account()
            {
                Name     = MchUName,
                Password = MchUPass
            }, mtpack);

            if (gr != null)
            {
                //Console.WriteLine("发送批次号:" + gr.uuid.ToString() + "\r\n");
                result = gr.result;
                errMsg = gr.message.ToString();
                //Console.WriteLine("结果信息:" + gr.attributes.ToString() + "\r\n");
                if (result != 0)
                {
                    Console.WriteLine("发送失败:" + errMsg + "\r\n");
                }
            }
            msg = errMsg;
            return(result);
        }