internal async Task <JsonResult> Complete(PurchaseReturnOrderComplete pro) { SqlConnection cn = null; try { cn = Connection.GetConnection(); SqlCommand smd = new SqlCommand("purchase_return_order_create", cn) { CommandType = CommandType.StoredProcedure }; smd.Parameters.AddWithValue("@pro_no", pro.PurchaseNo); smd.Parameters.AddWithValue("@created_by", pro.CreatedBy); smd.Parameters.AddWithValue("@from_location", pro.FromLocation); smd.Parameters.AddWithValue("@vendor_no", pro.VendorNo); smd.Parameters.AddWithValue("@lines", ToDataTable(pro.Lines)); smd.Parameters.Add("@jsonOutput", SqlDbType.NVarChar, -1).Direction = ParameterDirection.Output; await smd.ExecuteNonQueryAsync().ConfigureAwait(false); string json = smd.Parameters["@jsonOutput"].Value.ToString(); smd.Dispose(); JArray arr = JArray.Parse(json); return(new JsonResult(arr)); } catch (Exception) { throw; } finally { Connection.CloseConnection(ref cn); } }
public async Task <JsonResult> Complete([FromBody] PurchaseReturnOrderComplete pro) { try { return(await _purchaseReturnOrderLogic.Complete(pro).ConfigureAwait(false)); } catch (Exception ee) { return(await _purchaseReturnOrderLogic.SendRespose("False", ee.Message).ConfigureAwait(false)); } }
internal async Task <JsonResult> PurchaseReturnOrderInfo(PurchaseReturnOrderComplete info) { SqlConnection cn = null; try { cn = Connection.GetConnection(); SqlCommand smd = new SqlCommand("[purchase_return_order_info]", cn) { CommandType = CommandType.StoredProcedure }; smd.Parameters.Add("@purchase_return_info_json", SqlDbType.NVarChar, -1).Direction = ParameterDirection.Output; smd.Parameters.Add("@vendor_detail", SqlDbType.NVarChar, -1).Direction = ParameterDirection.Output; smd.Parameters.Add("@location_detail", SqlDbType.NVarChar, -1).Direction = ParameterDirection.Output; smd.Parameters.AddWithValue("@purchase_return_order_no", info.PurchaseNo); // Execute the command await smd.ExecuteNonQueryAsync().ConfigureAwait(false); // Get the values string purchase_return_order_info = smd.Parameters["@purchase_return_info_json"].Value.ToString(); string vendor_detail = smd.Parameters["@vendor_detail"].Value.ToString(); string location_detail = smd.Parameters["@location_detail"].Value.ToString(); smd.Dispose(); Connection.CloseConnection(ref cn); PurchaseReturnOrderResponse proInfoResponse = new PurchaseReturnOrderResponse(); //JArray Jaddress = JArray.Parse(address); proInfoResponse.PurchaseReturnOrderInfo = JArray.Parse(purchase_return_order_info); proInfoResponse.VendorDetail = JArray.Parse(vendor_detail); proInfoResponse.LocationDetail = JArray.Parse(location_detail); return(new JsonResult(proInfoResponse)); } catch (Exception) { throw; } finally { Connection.CloseConnection(ref cn); } }