public static void process() { sqlCe = new CE(); api = new CERPService(); dt = new DataTable("table"); dt = sqlCe.dt(api.GetMaterialIssuance()); DataRow[] result1 = dt.Select(); foreach (DataRow m in result1) { int i = Convert .ToInt32(m["id"]); if (!id(i)) { // save material issuance into local database SaveMaterialIssuance(i, m["request_no"].ToString(), m["batch_no"].ToString(), m["requested_date"].ToString(), m["expected_date"].ToString(), m["remarks"].ToString(), m["completion_status"].ToString()); System.Threading.Thread.Sleep(100); // get material issuance items DataRow[] result2 = sqlCe.dt(api.GetMaterialIssuanceItems(i)).Select(); foreach (DataRow l in result2) { // save material issuance items into local database SaveMaterialIssuanceItems(i, l["issue_id"].ToString(), l["code"].ToString(), l["lot_no"].ToString(), l["qty"].ToString(), l["status"].ToString(), l["address"].ToString()); } } } }
public static DataTable getMaterialIssuanceItems(int id) { sqlCe = new CE(); api = new CERPService(); return sqlCe.dt(api.GetMaterialIssuanceItems(id)); }