How to add/edit MiscCharges to an order using ctDynamicsSL (CTAPI)


The ctDynamicsSL.order object contains a miscCharges DataSet that should contain a single table.

Example of how to create the order.miscCharges.Tables[0] schema in c#:
System.Data.DataSet miscCharges = new System.Data.DataSet();
System.Data.DataTable dtMiscCharges = new DataTable();
dtMiscCharges.Columns.Add("miscChrgID", System.Type.GetType("System.String"));
dtMiscCharges.Columns.Add("miscChrgRef", System.Type.GetType("System.String"));
dtMiscCharges.Columns.Add("curyMiscChrg", System.Type.GetType("System.Double"));
dtMiscCharges.Columns.Add("notes", System.Type.GetType("System.String"));
dtMiscCharges.Columns.Add("deleteFlag", System.Type.GetType("System.Int16"));
dtMiscCharges.AcceptChanges();
miscCharges.Tables.Add(dtMiscCharges);
miscCharges.AcceptChanges();

Example of how to populate a row in order.miscCharges.Tables[0] in c#:
dtMiscCharges.Rows.Add(dtMiscCharges.NewRow());
dtMiscCharges.Rows[0]["miscChrgID"] = "the misc chrgID"; //required, must correspond to a valid value from table.column: miscCharge.miscChrgID
//dtMiscCharges.Rows[0]["miscChrgRef"] = "miscChrgRef"; //only required if editing an order misccharge entry, must corresponsd to a valid soMisc.MiscChrgRef
dtMiscCharges.Rows[0]["curyMiscChrg"] = 123; //the numerical value, required
//dtMiscCharges.Rows[0]["notes"] = ""; //not required
dtMiscCharges.Rows[0]["deleteFlag"] = 0; //required, default to 0, set to 1 if editing an order and wanting to delete a soMisc entry
dtMiscCharges.AcceptChanges();