예제 #1
0
        public async Task <string> InsertBatch(dynamic bodyData)
        {
            List <MaterialDeliveryEntity> materialDeliveries;

            string returnCode = "";

            try
            {
                materialDeliveries = Mappings.getMaterialDeliveryEntities(bodyData);
            }
            catch (Exception ex)
            {
                Console.WriteLine("Error when converting HTTP data to Table format: " + ex.ToString());
                return(null);
            }

            foreach (MaterialDeliveryEntity element in materialDeliveries)
            {
                try
                {
                    TableResult tr = await table.InsertorReplace(Mappings.ToMaterialDeliveryTableEntity(element), tableName).ConfigureAwait(false);
                }
                catch (Exception ex)
                {
                    Console.WriteLine("Error in writing to table storage: " + ex.ToString());
                    return(null);
                }
            }

            return(materialDeliveries[0].webguid);
        }
예제 #2
0
        public async Task <string> InsertSerial(string user, string serial)
        {
            string returCode = "";

            AppleDepEntity serial_entry = Mappings.PopulateAppleDepEntity(serial, user);

            TableResult tr = await table.InsertorReplace(Mappings.ToAppleDepTableEntity(serial_entry), tableName);


            return(returCode);
        }
        public async Task <string> InsertBatch(dynamic bodyData)
        {
            string returnCode = "";

            List <PackageCheckEntity> packages = Mappings.InsertPackageCheck(bodyData);

            foreach (PackageCheckEntity re in packages)
            {
                TableResult tr = await table.InsertorReplace(Mappings.ToTableEntity(re, tableName), tableName);
            }

            return(returnCode);
        }
        public async Task <List <string> > UpdateGuidOnGuid(string guid)
        {
            List <string> output = new List <string>();
            List <ReturnForCreditEntityTableEntity> queryResult = await table.RetrieveEntities <ReturnForCreditEntityTableEntity>(ReturnForCreditEntityConstants.ID_FIELD_NAME, QueryComparisons.Equal, guid, tableName);

            if (queryResult is null)
            {
                return(null);
            }
            foreach (ReturnForCreditEntityTableEntity entity in queryResult)
            {
                TableResult tr = await table.Remove(entity, tableName).ConfigureAwait(false);

                entity.RowKey = Guid.NewGuid().ToString();
                tr            = await table.InsertorReplace(entity, tableName).ConfigureAwait(false);

                output.Add(entity.RowKey);
            }
            return(output);
        }
예제 #5
0
        public async Task <TableResult> insertItem(LoadCarrierEntity loadCarrier)
        {
            TableResult tr = await table.InsertorReplace(Mappings.ToTableEntity(loadCarrier), tableName);

            return(tr);
        }