Exemple #1
0
    protected void GridInbox_ItemCreated(object sender, GridItemEventArgs e)
    {
        if (e.Item is GridDataItem)
        {
            InboxItem item = e.Item.DataItem as InboxItem;

            if (item == null)
            {
                return;
            }

            DropDownList listActions = (DropDownList)e.Item.FindControl("DropActions");

            if (item.PhoneNumber.EndsWith("708303600"))
            {
                listActions.SelectedIndex = 0; // Debug purposes
            }
            else if (item.Message.ToLowerInvariant().Trim() == "pp igen")
            {
                listActions.SelectedIndex = 1;
            }
            else
            {
                listActions.SelectedIndex = 0;//On request from member service
            }
        }
    }
Exemple #2
0
        /// <summary>
        /// Draw the full thread for the selected conversation. The users current scroll position is not altered
        /// unless resetScrollPosition is true in which case we scroll so that the last message is visible.
        ///
        /// Drawing the thread also optionally marks the conversation as read and triggers an update on the server.
        /// </summary>
        /// <param name="conversation">The conversation to draw</param>
        private void ShowMessage(InboxConversation conversation)
        {
            inboxMessagePane.BeginUpdate();
            inboxMessagePane.Items.Clear();
            if (conversation != null)
            {
                InboxItem lastItem = null;

                foreach (InboxMessage message in conversation.Messages)
                {
                    InboxItem item = new InboxItem(inboxMessagePane, lastItem != null)
                    {
                        ID             = message.RemoteID,
                        Image          = Mugshot.MugshotForUser(message.Author, true).RealImage,
                        ItemColour     = SystemColors.Window,
                        FullDateString = _showFullDate,
                        Message        = message,
                        Font           = _bodyFont
                    };
                    inboxMessagePane.Items.Add(item);
                    lastItem = item;
                }
                inboxMessagePane.SelectedItem = lastItem;
            }
            inboxMessagePane.EndUpdate(null);
        }
        public void OnComplete(Android.Gms.Tasks.Task task)
        {
            if (task.IsSuccessful)
            {
                var documents = (QuerySnapshot)task.Result;

                inboxItems.Clear();
                foreach (var doc in documents.Documents)
                {
                    InboxItem inboxItem = new InboxItem
                    {
                        IsActive  = (bool)doc.Get("isActive"),
                        Name      = doc.Get("name").ToString(),
                        Notes     = doc.Get("notes").ToString(),
                        UserId    = doc.Get("author").ToString(),
                        StartDate = NativeDateToDateTime(doc.Get("startDate") as Date),
                        Id        = doc.Id
                    };

                    inboxItems.Add(inboxItem);
                }
            }
            else
            {
                inboxItems.Clear();
            }
            hasReadInboxItems = true;
        }
        public Dictionary <bool, string> InsertInboxItem(InboxItem inboxItem)
        {
            try
            {
                var collection        = Firebase.Firestore.FirebaseFirestore.Instance.Collection("inboxItems");
                var inboxItemDocument = new Dictionary <string, Java.Lang.Object>
                {
                    { "author", Firebase.Auth.FirebaseAuth.Instance.CurrentUser.Uid },
                    { "name", inboxItem.Name },
                    { "notes", inboxItem.Notes },
                    { "startDate", DateTimeToNativeDate(inboxItem.StartDate) },
                    { "dueDate", DateTimeToNativeDate(inboxItem.DueDate) },
                    { "isActive", inboxItem.IsActive }
                };
                collection.Document(inboxItem.Id).Set(inboxItemDocument);
                //collection.Add(inboxItemDocument);

                return(new Dictionary <bool, string>()
                {
                    { true, "Success" }
                });
            }
            catch (Exception ex)
            {
                return(new Dictionary <bool, string>()
                {
                    { false, ex.Message }
                });
            }
        }
        public async Task <IList <InboxItem> > ReadInboxItems()
        {
            try
            {
                var collection = Firebase.CloudFirestore.Firestore.SharedInstance.GetCollection("inboxItems");
                var query      = collection.WhereEqualsTo("author", Firebase.Auth.Auth.DefaultInstance.CurrentUser.Uid);
                var documents  = await query.GetDocumentsAsync();

                List <InboxItem> inboxItems = new List <InboxItem>();
                foreach (var doc in documents.Documents)
                {
                    var inboxItemDictionary = doc.Data;
                    var inboxItem           = new InboxItem
                    {
                        IsActive  = (bool)(inboxItemDictionary.ValueForKey(new NSString("isActive")) as NSNumber),
                        Name      = inboxItemDictionary.ValueForKey(new NSString("name")) as NSString,
                        Notes     = inboxItemDictionary.ValueForKey(new NSString("notes")) as NSString,
                        UserId    = inboxItemDictionary.ValueForKey(new NSString("author")) as NSString,
                        StartDate = FIRTimeToDateTime(inboxItemDictionary.ValueForKey(new NSString("startDate")) as Firebase.CloudFirestore.Timestamp),
                        DueDate   = FIRTimeToDateTime(inboxItemDictionary.ValueForKey(new NSString("dueDate")) as Firebase.CloudFirestore.Timestamp),
                        Id        = doc.Id
                    };

                    inboxItems.Add(inboxItem);
                }
                return(inboxItems);
            }
            catch (Exception ex)
            {
                return(new List <InboxItem>());
            }
        }
        public InboxDetailView(InboxItem selectedInboxItem)
        {
            InitializeComponent();

            vm           = Resources["vm"] as InboxDetailVM;
            vm.InboxItem = selectedInboxItem;
        }
Exemple #7
0
        public InboxItems SearchByInboxItemName(string InboxItemName)
        {
            List <TransactionCode> tranCodelst = new List <TransactionCode>();
            InboxItems             searchItem  = new InboxItems();

            searchItem.Name = InboxItemName;
            string       url     = HttpContext.Current.Request.PhysicalApplicationPath + this.xmlPath;
            StreamReader sr      = new StreamReader(url);
            XDocument    doc     = XDocument.Load(sr);
            var          records = from InboxItem in doc.Root.Elements("InboxItem")
                                   where (string)InboxItem.Attribute("Name") == InboxItemName
                                   select InboxItem;

            foreach (var i in records)
            {
                var tranCode = from tran in i.Elements("TransactionCode")
                               select tran;
                foreach (var x in tranCode)
                {
                    TransactionCode objTrC = new TransactionCode();
                    objTrC.FlowName = x.Attribute("FlowName").Value;
                    objTrC.Step     = x.Attribute("Step").Value;
                    objTrC.StepName = x.Attribute("StepName").Value;
                    objTrC.Right    = x.Attribute("Right").Value;
                    tranCodelst.Add(objTrC);
                }
                searchItem.TransactionCodeList = tranCodelst;
            }
            sr.Close();
            InboxItems objGrantedItems = new InboxItems();

            searchItem = objGrantedItems.GetGrantedInboxItem(searchItem);
            return(searchItem);
        }
        public async Task <bool> UpdateInboxItem(InboxItem inboxItem)
        {
            try
            {
                var keys = new[]
                {
                    new NSString("name"),
                    new NSString("notes"),
                    new NSString("isActive")
                };

                var values = new NSObject[]
                {
                    new NSString(inboxItem.Name),
                    new NSString(inboxItem.Notes),
                    new NSNumber(inboxItem.IsActive)
                };

                var inboxItemDictionary = new NSDictionary <NSObject, NSObject>(keys, values);

                var collection = Firebase.CloudFirestore.Firestore.SharedInstance.GetCollection("inboxItems");
                await collection.GetDocument(inboxItem.Id).UpdateDataAsync(inboxItemDictionary);

                return(true);
            }
            catch (Exception ex)
            {
                return(false);
            }
        }
 public static WorkflowInbox ToDB(InboxItem inboxItem)
 {
     return(new WorkflowInbox()
     {
         Id = inboxItem.Id,
         ProcessId = inboxItem.ProcessId,
         IdentityId = inboxItem.IdentityId,
         AddingDate = inboxItem.AddingDate,
         AvailableCommands = HelperParser.Join(",", inboxItem.AvailableCommands?.Select(x => x.Name))
     });
 }
Exemple #10
0
 public async Task <bool> UpdateInboxItem(InboxItem inboxItem)
 {
     try
     {
         var collection = Firebase.Firestore.FirebaseFirestore.Instance.Collection("inboxItems");
         collection.Document(inboxItem.Id).Update("name", inboxItem.Name, "notes", inboxItem.Notes, "isActive", inboxItem.IsActive);
         return(true);
     }
     catch (Exception ex)
     {
         return(false);
     }
 }
Exemple #11
0
 public async Task <bool> DeleteInboxItem(InboxItem inboxItem)
 {
     try
     {
         var collection = Firebase.Firestore.FirebaseFirestore.Instance.Collection("inboxItems");
         collection.Document(inboxItem.Id).Delete();
         return(true);
     }
     catch (Exception ex)
     {
         return(false);
     }
 }
Exemple #12
0
        public async Task <bool> DeleteInboxItem(InboxItem inboxItem)
        {
            try
            {
                var collection = Firebase.CloudFirestore.Firestore.SharedInstance.GetCollection("inboxItems");
                await collection.GetDocument(inboxItem.Id).DeleteDocumentAsync();

                return(true);
            }
            catch (Exception ex)
            {
                return(false);
            }
        }
        public override void Receive(byte[] data, int startIndex, int length)
        {
            var    processedLength = 0;
            ushort sequenceNumber;
            var    copiedData = new byte[length];

            Array.Copy(data, startIndex, copiedData, 0, length);

            if (_sendAcks && copiedData[0] == 0xff && copiedData[1] == 0xff)
            {
                lock (_outboxLock)
                {
                    sequenceNumber = BitConverter.ToUInt16(copiedData, 2);
                    _outbox.Remove(sequenceNumber);
                }
                return;
            }
            sequenceNumber   = BitConverter.ToUInt16(copiedData, 0);
            processedLength += sizeof(ushort);
            if (_inbox.ContainsKey(sequenceNumber) || _lastProcessedReceiveIndex >= sequenceNumber)
            {
                Debug.LogWarning("Got same sequence twice: " + sequenceNumber);
                return;
            }
            _inbox[sequenceNumber] = new InboxItem()
            {
                data = copiedData, startIndex = processedLength, length = length - processedLength
            };
            if (sequenceNumber > _lastReceiveIndex)
            {
                _lastReceiveIndex = sequenceNumber;
            }
            if (_sendAcks)
            {
                byte[] ackData = new byte[] { 0xff, 0xff, 0, 0 };
                Array.Copy(BitConverter.GetBytes(sequenceNumber), 0, ackData, 2, 2);
                Send(ackData);
                _pendingAcksQueue.Enqueue(sequenceNumber);
                ProcessOutbox();
            }
            ProcessInbox();
        }
Exemple #14
0
        public override void Receive(byte[] data, int startIndex, int length)
        {
            var    processedLength = 0;
            ushort sequenceNumber;

            if (_sendAcks && data[startIndex] == 0xff && data[startIndex + 1] == 0xff)
            {
                lock (_outboxLock)
                {
                    sequenceNumber = BitConverter.ToUInt16(data, startIndex + 2);
                    _outbox.Remove(sequenceNumber);
                }
                return;
            }
            sequenceNumber   = BitConverter.ToUInt16(data, startIndex);
            processedLength += sizeof(ushort);
            if (_inbox.ContainsKey(sequenceNumber))
            {
                Debug.LogWarning("Got same sequence twice: " + sequenceNumber);
            }
            //Debug.LogError("Add to inbox: " + Debugging.TeleportDebugUtils.DebugString(data, startIndex + processedLength, length - processedLength));
            _inbox[sequenceNumber] = new InboxItem()
            {
                data = data, startIndex = startIndex + processedLength, length = length - processedLength
            };
            if (sequenceNumber > _lastReceiveIndex)
            {
                _lastReceiveIndex = sequenceNumber;
            }
            if (_sendAcks)
            {
                byte[] ackData = new byte[] { 0xff, 0xff, 0, 0 };
                Array.Copy(BitConverter.GetBytes(sequenceNumber), 0, ackData, 2, 2);
                Send(ackData);
                _pendingAcksQueue.Enqueue(sequenceNumber);
                ProcessOutbox();
            }
            ProcessInbox();
        }
Exemple #15
0
        public Dictionary <bool, string> InsertInboxItem(InboxItem inboxItem)
        {
            try
            {
                var keys = new[]
                {
                    new NSString("author"),
                    new NSString("name"),
                    new NSString("notes"),
                    new NSString("startDate"),
                    new NSString("dueDate"),
                    new NSString("isActive")
                };

                var values = new NSObject[]
                {
                    new NSString(Firebase.Auth.Auth.DefaultInstance.CurrentUser.Uid),
                    new NSString(inboxItem.Name),
                    new NSString(inboxItem.Notes),
                    DateTimeToNSDate(inboxItem.StartDate),
                    DateTimeToNSDate(inboxItem.DueDate),
                    new NSNumber(inboxItem.IsActive)
                };

                var inboxItemDocument = new NSDictionary <NSString, NSObject>(keys, values);
                Firebase.CloudFirestore.Firestore.SharedInstance.GetCollection("inboxItems").AddDocument(inboxItemDocument);
                return(new Dictionary <bool, string>()
                {
                    { true, "Success" }
                });
            }
            catch (Exception ex)
            {
                return(new Dictionary <bool, string>()
                {
                    { false, ex.Message }
                });
            }
        }
    /// <summary>
    /// Updates the inbox.
    /// </summary>
    void UpdateInbox()
    {
        if (table.transform.childCount > 0)
        {
            List <Transform> childs = new List <Transform>();

            for (int i = 0; i < table.transform.childCount; i++)
            {
                childs.Add(table.transform.GetChild(i));
            }

            for (int i = 0; i < childs.Count; i++)
            {
                childs[i].parent = null;

                NGUITools.Destroy(childs[i].gameObject);
            }
        }

        InboxMetaData data = InboxMetaData.Load();

        InboxMessage[] messages = data.GetAllMessages();

        for (int i = 0; i < messages.Length; i++)
        {
            GameObject newMessage = NGUITools.AddChild(table.gameObject, inboxItemPrefab);

            InboxItem display = newMessage.GetComponent <InboxItem>();

            display.SetInboxItemInfo(messages[i]);
        }

        table.Reposition();

        scrollview.ResetPosition();
    }
 public BuyBlackMarketItemResponseDto(Resources price, InboxItem inboxItem)
 {
 }
Exemple #18
0
 public static Task <bool> DeleteInboxItem(InboxItem inboxItem)
 {
     return(firestore.DeleteInboxItem(inboxItem));
 }
Exemple #19
0
 public InboxRow(InboxItem item)
 {
     _item = item;
 }
Exemple #20
0
 public static Dictionary <bool, string> InsertInboxItem(InboxItem inboxItem)
 {
     return(firestore.InsertInboxItem(inboxItem));
 }
Exemple #21
0
 public static Task <bool> UpdateInboxItem(InboxItem inboxItem)
 {
     return(firestore.UpdateInboxItem(inboxItem));
 }
Exemple #22
0
 public InboxRow(InboxItem item)
 {
     _item = item;
 }
Exemple #23
0
 public OverStoreInboxItem(InboxItem inboxItem, IMapper mapper)
 {
     mapper.Map <InboxItem, OverStoreInboxItem>(inboxItem, this);
 }