Пример #1
0
        public String UpdatebyPutrefuse(CloudTable table, PutRefuse putrefuse)
        {
            RefuseEntity updateEntity = RetrieveRefuse(table, putrefuse);

            if (updateEntity != null)
            {
                DateTime nowDate = DateTime.Now;
                string   time3   = "Time:" + nowDate;
                // Change the collection time
                updateEntity.Timecollected = time3;

                // Create the Replace TableOperation.
                TableOperation updateOperation = TableOperation.Replace(updateEntity);

                // Execute the operation.
                try
                {
                    table.Execute(updateOperation);
                    return("update executed sucessfully");
                }
                catch (Exception e)
                {
                    return("update not executed sucessfully");
                    //do something
                }
            }
            else
            {
                return("update not executed sucessfully");
            }
        }
Пример #2
0
        public RefuseEntity RetrieveRefuse(CloudTable table, PutRefuse putrefuse)
        {
            // Create a retrieve operation that takes a customer entity.
            TableOperation retrieveOperation = TableOperation.Retrieve <RefuseEntity>(putrefuse.id, putrefuse.pareaid);

            // Execute the operation.
            TableResult retrievedResult = table.Execute(retrieveOperation);

            // Assign the result to a CustomerEntity object.
            RefuseEntity refuseEntity = (RefuseEntity)retrievedResult.Result;

            return(refuseEntity);
        }
Пример #3
0
        public String InsertbyPostrefuse(CloudTable table, PostRefuse postrefuse)
        {
            DateTime nowDate = DateTime.Now;

            string time = "time:" + nowDate;

            DateTime collectionDate = nowDate.AddYears(1000);

            string time2 = "time:" + collectionDate;

            RefuseEntity refuse = new RefuseEntity(postrefuse.id, postrefuse.pareaid, postrefuse.platitude, postrefuse.plongitude, time, time2, "false");

            TableOperation insertOperation = TableOperation.Insert(refuse);

            try {
                table.Execute(insertOperation);
                return("insert executed sucessfully");
            }
            catch (Exception e)
            {
                return("insert not executed sucessfully");
                //do something
            }
        }