Exemplo n.º 1
0
        public void add <T>(T obj)
        {
            string temp = typeof(T).ToString();
            //int i = temp.LastIndexOf('.');
            //temp = temp.Substring(i + 1);
            ecommand c = ecommand.ce;

            if (string.Equals(temp, typeof(caddressBook).ToString()))
            {
                c = ecommand.addaddressBook;
            }
            else if (string.Equals(temp, typeof(ccontacts).ToString()))
            {
                c = ecommand.addcontacts;
            }
            else if (string.Equals(temp, typeof(cdiary).ToString()))
            {
                c = ecommand.adddiary;
            }
            else if (string.Equals(temp, typeof(cmemorandum).ToString()))
            {
                c = ecommand.addmemorandum;
            }
            else if (string.Equals(temp, typeof(cproperty).ToString()))
            {
                c = ecommand.addproperty;
            }

            string       json        = JsonConvert.SerializeObject(obj);
            ctransmitter transmitter = new ctransmitter(id, c, json);

            send(transmitter.ToString());
        }
Exemplo n.º 2
0
        public void delete(object obj, int id)
        {
            ecommand c = ecommand.ce;

            if (obj as caddressBook != null)
            {
                c = ecommand.daddressBook;
            }
            else if (obj as ccontacts != null)
            {
                c = ecommand.dcontacts;
            }
            else if (obj as cdiary != null)
            {
                c = ecommand.ddiary;
            }
            else if (obj as cmemorandum != null)
            {
                c = ecommand.dmemorandum;
            }
            else if (obj as cproperty != null)
            {
                c = ecommand.dproperty;
            }
            string       json        = JsonConvert.SerializeObject(id);
            ctransmitter transmitter = new ctransmitter(this.id, c, json);

            send(transmitter.ToString());
        }
Exemplo n.º 3
0
        public void send(ecommand command, string str)
        {
            ctransmitter transmitter = new ctransmitter(id, command, str);

            send(transmitter.ToString());
        }
Exemplo n.º 4
0
        public void getdata()
        {
            ctransmitter transmitter = new ctransmitter(id, ecommand.getdata, string.Empty);

            send(transmitter.ToString());
        }