public string submitOnlineSales(string companyCode, string json) { clsDataAccessor dataAccessor = new clsDataAccessor(); dataAccessor.connectionstring = dataAccessor.getConnectionString_Vapt(dataAccessor, companyCode); SalesMaster sales = new SalesMaster(); var serializer = new System.Web.Script.Serialization.JavaScriptSerializer(); string response = ""; /* json = @"{""TransNo"":""A1234512"", * ""RetailID"":""ONLINE"", * ""SalesDate"":""2020/02/24 15:20:43"", * ""SalesStatus"":""SALES"", * ""MemberID"":""CUST917800001944774"", * ""SalesTaxType"":""I"", * ""SalesTaxRate"":""7"", * ""SalesTaxTtl"":""49"", * ""SalesRounding"":""0"", * ""SalesTotalAmount"":""700"", * ""ItemSales"":[{""ItemID"":""BSBN104"",""SupBarCode"":"""",""ItemSellPrice"":""350"",""ItemQty"":""2"", * ""ItemUOMDesc"":""Ctn (75gx72)"",""ItemDisc"":""0"",""ItemDisc2"":""0"",""ItemDisc3"":""0"", * ""ItemPrice"":""384.000"",""ItemTax"":""24.50"",""ItemTotal"":""700"", * ""ItemVoucher"":[{""VoucherNo"":""VC123"",""VoucherAmount"":""700"" * }] * }], * ""SalesPayments"":[{""paymentID"":"""",""strPayment"":""VISA"",""SalesPayTtl"":""700"", * ""SalesBalTtl"":""700"",""ChangeAmount"":""0"",""TipsAmount"":""0"", * ""SaleVoucher"":[{""VoucherNo"":""VC122"",""VoucherAmount"":""700"" * }] * }], * ""SalesPersons"":[] * }"; */ try { sales = serializer.Deserialize <SalesMaster>(json); } catch (Exception ex) { return(ex.ToString()); } response = dataAccessor.saveOnlineSales(sales); return(response); }