public static string get_items_received()
 {
     string result = string.Empty;
     CE sqlCe = new CE();
     dt = new DataTable("table");
     dt = sqlCe.DataTable("SELECT " +
                          "did, " +
                          "mid, " +
                          "received_qty, " +
                          "status, " +
                          "remarks " +
                          "FROM tbl_delivery_items_received " +
                          "WHERE delivery_id = " + delivery_id);
     if (dt != null)
     {
         StringWriter sw = new StringWriter();
         dt.WriteXml(sw);
         result = sw.ToString().Trim().Replace("\r\n", "");
     }
     return result;
 }
        public static void save_to_localdb()
        {
            try
            {
                CE sqlCe = new CE();
                dt = new DataTable("table");
                dt = config.get(api.GetDeliveryItems(delivery_id));
                DataRow[] result = dt.Select();
                string query = string.Empty;
                foreach (DataRow l in result)
                {
                    if (!Is_Exist(Convert.ToInt64(l["id"])))
                    {
                        query = "INSERT INTO tbl_delivery_items_received (delivery_id, did, mid, code, po_qty, received_qty, status) " +
                                "VALUES " +
                                "('" + delivery_id + "', " +
                                "'" + l["id"].ToString() + "', " +
                                "'" + l["mid"].ToString() + "', " +
                                "'" + l["code"].ToString() + "', " +
                                "'" + l["po_qty"].ToString() + "', " +
                                "'" + l["received"].ToString() + "', " +
                                "'22');";
                        sqlCe.Execute(query);
                    }
                }

                query = "SELECT delivery_id, did, mid, code, po_qty, received_qty " +
                        "FROM tbl_delivery_items_received WHERE delivery_id = " + delivery_id;
                dt = new DataTable("table");
                dt = sqlCe.DataTable(query);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
 public static DataTable getMaterialItemsByBarCode(string b_code)
 {
     sqlCe = new CE();
     return sqlCe.DataTable("SELECT * FROM GetMaterialIssuanceItems WHERE id '" + miid + "' AND code = '" + b_code + "'");
 }